Class ::xo::db::sql::file_storage (public)
::xo::db::Class ::xo::db::sql::file_storage
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo::db::sql {}
::nsf::object::alloc ::xo::db::Class ::xo::db::sql::file_storage {set :__default_metaclass ::xotcl::Class
set :__default_superclass ::xotcl::Object
set :abstract_p f
set :auto_save false
set :name_method {}
set :object_type ::xo::db::sql::file_storage
set :security_inherit_p t
set :sql_package_name file_storage
set :supertype acs_object
set :with_table true}
::xo::db::sql::file_storage proc new_file {{-dbn {}} -name:required -folder_id:required -user_id:required -creation_ip:required -indb_p:required -item_id:required -package_id:required} {
foreach var [list NAME FOLDER_ID USER_ID CREATION_IP INDB_P ITEM_ID PACKAGE_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__new_file($_NAME, $_FOLDER_ID, $_USER_ID, $_CREATION_IP, $_INDB_P, $_ITEM_ID, $_PACKAGE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_content_type {{-dbn {}} -file_id:required} {
foreach var [list FILE_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_content_type($_FILE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc new_folder {{-dbn {}} -name:required -folder_name:required -parent_id:required -creation_user:required -creation_ip:required} {
foreach var [list NAME FOLDER_NAME PARENT_ID CREATION_USER CREATION_IP] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__new_folder($_NAME, $_FOLDER_NAME, $_PARENT_ID, $_CREATION_USER, $_CREATION_IP)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc move_file {{-dbn {}} -file_id:required -target_folder_id:required -creation_user:required -creation_ip:required} {
foreach var [list FILE_ID TARGET_FOLDER_ID CREATION_USER CREATION_IP] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__move_file($_FILE_ID, $_TARGET_FOLDER_ID, $_CREATION_USER, $_CREATION_IP)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc new_version {{-dbn {}} -filename:required -description:required -mime_type:required -item_id:required -creation_user:required -creation_ip:required} {
foreach var [list FILENAME DESCRIPTION MIME_TYPE ITEM_ID CREATION_USER CREATION_IP] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__new_version($_FILENAME, $_DESCRIPTION, $_MIME_TYPE, $_ITEM_ID, $_CREATION_USER, $_CREATION_IP)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc delete_version {{-dbn {}} -file_id:required -version_id:required} {
foreach var [list FILE_ID VERSION_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__delete_version($_FILE_ID, $_VERSION_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc new_root_folder {{-dbn {}} -package_id:required -folder_name:required -url:required -description:required} {
foreach var [list PACKAGE_ID FOLDER_NAME URL DESCRIPTION] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__new_root_folder($_PACKAGE_ID, $_FOLDER_NAME, $_URL, $_DESCRIPTION)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_title {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_title($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc copy_file {{-dbn {}} -file_id:required -target_folder_id:required -creation_user:required -creation_ip:required -name -title} {
foreach var [list FILE_ID TARGET_FOLDER_ID CREATION_USER CREATION_IP NAME TITLE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__copy_file($_FILE_ID, $_TARGET_FOLDER_ID, $_CREATION_USER, $_CREATION_IP, $_NAME, $_TITLE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc delete_file {{-dbn {}} -file_id:required} {
foreach var [list FILE_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__delete_file($_FILE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_folder_name {{-dbn {}} -folder_id:required} {
foreach var [list FOLDER_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_folder_name($_FOLDER_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_parent_id {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_parent_id($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc delete_folder {{-dbn {}} -folder_id:required -cascade_p:required} {
foreach var [list FOLDER_ID CASCADE_P] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__delete_folder($_FOLDER_ID, $_CASCADE_P)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_root_folder {{-dbn {}} -package_id:required} {
foreach var [list PACKAGE_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_root_folder($_PACKAGE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc get_package_id {{-dbn {}} -item_id:required} {
foreach var [list ITEM_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__get_package_id($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::file_storage proc rename_file {{-dbn {}} -file_id:required -name:required} {
foreach var [list FILE_ID NAME] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select file_storage__rename_file($_FILE_ID, $_NAME)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]