namespace eval ::xo::db::sql {}
::nsf::object::alloc ::xo::db::Class ::xo::db::sql::news {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::news
set :security_inherit_p t
set :sql_package_name news
set :supertype acs_object
set :with_table true}
::xo::db::sql::news proc status {{-dbn {}} -publish_date:required -archive_date:required} {
foreach var [list PUBLISH_DATE ARCHIVE_DATE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__status($_PUBLISH_DATE, $_ARCHIVE_DATE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc revision_new {{-dbn {}} -item_id:required -publish_date -text -title:required -description:required {-mime_type text/plain} -package_id -archive_date -approval_user -approval_date -approval_ip {-creation_date current_timestamp} -creation_ip -creation_user {-make_active_revision_p f} -lead:required} {
foreach var [list ITEM_ID PUBLISH_DATE TEXT TITLE DESCRIPTION MIME_TYPE PACKAGE_ID ARCHIVE_DATE APPROVAL_USER APPROVAL_DATE APPROVAL_IP CREATION_DATE CREATION_IP CREATION_USER MAKE_ACTIVE_REVISION_P LEAD] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__revision_new($_ITEM_ID, $_PUBLISH_DATE, $_TEXT, $_TITLE, $_DESCRIPTION, $_MIME_TYPE, $_PACKAGE_ID, $_ARCHIVE_DATE, $_APPROVAL_USER, $_APPROVAL_DATE, $_APPROVAL_IP, $_CREATION_DATE, $_CREATION_IP, $_CREATION_USER, $_MAKE_ACTIVE_REVISION_P, $_LEAD)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc set_approve {{-dbn {}} -revision_id:required {-approve_p t} -publish_date -archive_date -approval_user {-approval_date current_timestamp} -approval_ip {-live_revision_p t}} {
foreach var [list REVISION_ID APPROVE_P PUBLISH_DATE ARCHIVE_DATE APPROVAL_USER APPROVAL_DATE APPROVAL_IP LIVE_REVISION_P] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__set_approve($_REVISION_ID, $_APPROVE_P, $_PUBLISH_DATE, $_ARCHIVE_DATE, $_APPROVAL_USER, $_APPROVAL_DATE, $_APPROVAL_IP, $_LIVE_REVISION_P)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc name {{-dbn {}} -news_id:required} {
foreach var [list NEWS_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__name($_NEWS_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc revision_set_active {{-dbn {}} -revision_id:required} {
foreach var [list REVISION_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__revision_set_active($_REVISION_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc revision_delete {{-dbn {}} -revision_id:required} {
foreach var [list REVISION_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__revision_delete($_REVISION_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc clone {{-dbn {}} -old_package_id:required -new_package_id:required} {
foreach var [list OLD_PACKAGE_ID NEW_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 news__clone($_OLD_PACKAGE_ID, $_NEW_PACKAGE_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc new {{-dbn {}} -item_id -locale -publish_date -text -nls_language -title {-mime_type text/plain} -package_id -archive_date -approval_user -approval_date -approval_ip -relation_tag -creation_ip -creation_user {-is_live_p f} -lead:required -childof} {
foreach var [list ITEM_ID LOCALE PUBLISH_DATE TEXT NLS_LANGUAGE TITLE MIME_TYPE PACKAGE_ID ARCHIVE_DATE APPROVAL_USER APPROVAL_DATE APPROVAL_IP RELATION_TAG CREATION_IP CREATION_USER IS_LIVE_P LEAD] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__new($_ITEM_ID, $_LOCALE, $_PUBLISH_DATE, $_TEXT, $_NLS_LANGUAGE, $_TITLE, $_MIME_TYPE, $_PACKAGE_ID, $_ARCHIVE_DATE, $_APPROVAL_USER, $_APPROVAL_DATE, $_APPROVAL_IP, $_RELATION_TAG, $_CREATION_IP, $_CREATION_USER, $_IS_LIVE_P, $_LEAD)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc archive {{-dbn {}} -item_id:required {-archive_date current_timestamp}} {
foreach var [list ITEM_ID ARCHIVE_DATE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select news__archive($_ITEM_ID, $_ARCHIVE_DATE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc delete {{-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 news__delete($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::news proc make_permanent {{-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 news__make_permanent($_ITEM_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}