Class ::xo::db::sql::image (public)
::xo::db::Class ::xo::db::sql::image
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo::db::sql {}
::nsf::object::alloc ::xo::db::Class ::xo::db::sql::image {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::image
set :security_inherit_p t
set :sql_package_name image
set :supertype acs_object
set :with_table true}
::xo::db::sql::image proc new_revision {{-dbn {}} -item_id:required -revision_id:required -title:required -description:required -publish_date:required -mime_type:required -nls_language:required -creation_user:required -creation_ip:required -height:required -width:required -package_id:required} {
foreach var [list ITEM_ID REVISION_ID TITLE DESCRIPTION PUBLISH_DATE MIME_TYPE NLS_LANGUAGE CREATION_USER CREATION_IP HEIGHT WIDTH 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 image__new_revision($_ITEM_ID, $_REVISION_ID, $_TITLE, $_DESCRIPTION, $_PUBLISH_DATE, $_MIME_TYPE, $_NLS_LANGUAGE, $_CREATION_USER, $_CREATION_IP, $_HEIGHT, $_WIDTH, $_PACKAGE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::image proc new {{-dbn {}} -name:required -parent_id -item_id -revision_id {-mime_type jpeg} -creation_user -creation_ip -relation_tag -title -description {-is_live f} {-publish_date now()} -path:required -file_size:required -height:required -width:required -package_id -childof} {
foreach var [list NAME PARENT_ID ITEM_ID REVISION_ID MIME_TYPE CREATION_USER CREATION_IP RELATION_TAG TITLE DESCRIPTION IS_LIVE PUBLISH_DATE PATH FILE_SIZE HEIGHT WIDTH 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 image__new($_NAME, $_PARENT_ID, $_ITEM_ID, $_REVISION_ID, $_MIME_TYPE, $_CREATION_USER, $_CREATION_IP, $_RELATION_TAG, $_TITLE, $_DESCRIPTION, $_IS_LIVE, $_PUBLISH_DATE, $_PATH, $_FILE_SIZE, $_HEIGHT, $_WIDTH, $_PACKAGE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::image proc delete {{-dbn {}} -v_item_id:required} {
foreach var [list V_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 image__delete($_V_ITEM_ID)
"
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 ]