Class ::xo::db::sql::timespan (public)
::xo::db::Class ::xo::db::sql::timespan
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo::db::sql {}
::nsf::object::alloc ::xo::db::Class ::xo::db::sql::timespan {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::timespan
set :security_inherit_p t
set :sql_package_name timespan
set :supertype acs_object
set :with_table true}
::xo::db::sql::timespan proc join_interval {{-dbn {}} -timespan_id:required -interval_id:required {-copy_p true}} {
foreach var [list TIMESPAN_ID INTERVAL_ID COPY_P] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__join_interval($_TIMESPAN_ID, $_INTERVAL_ID, $_COPY_P)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc join {{-dbn {}} -timespan_id:required -start_date -end_date} {
foreach var [list TIMESPAN_ID START_DATE END_DATE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__join($_TIMESPAN_ID, $_START_DATE, $_END_DATE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc new {{-dbn {}} -start_date -end_date -childof} {
foreach var [list START_DATE END_DATE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__new($_START_DATE, $_END_DATE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc multi_interval_p {{-dbn {}} -timespan_id:required} {
foreach var [list TIMESPAN_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__multi_interval_p($_TIMESPAN_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc exists_p {{-dbn {}} -timespan_id:required} {
foreach var [list TIMESPAN_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__exists_p($_TIMESPAN_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc copy {{-dbn {}} -timespan_id:required -offset:required} {
foreach var [list TIMESPAN_ID OFFSET] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__copy($_TIMESPAN_ID, $_OFFSET)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc overlaps_p {{-dbn {}} -timespan_id:required -start_date -end_date} {
foreach var [list TIMESPAN_ID START_DATE END_DATE] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__overlaps_p($_TIMESPAN_ID, $_START_DATE, $_END_DATE)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc overlaps_interval_p {{-dbn {}} -timespan_id:required -interval_id} {
foreach var [list TIMESPAN_ID INTERVAL_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__overlaps_interval_p($_TIMESPAN_ID, $_INTERVAL_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc interval_delete {{-dbn {}} -timespan_id:required -interval_id:required} {
foreach var [list TIMESPAN_ID INTERVAL_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__interval_delete($_TIMESPAN_ID, $_INTERVAL_ID)
"
db_with_handle -dbn $dbn db {
return [ ns_set value [ns_pg_bind 0or1row $db $sql] 0 ]
}
}
::xo::db::sql::timespan proc delete {{-dbn {}} -timespan_id:required} {
foreach var [list TIMESPAN_ID] {
set varname [string tolower $var]
if {[info exists $varname]} {
set $var [set $varname]
set _$var :$var
} else {
set _$var null
}
}
set sql "
select timespan__delete($_TIMESPAN_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 ]