::xotcl::Class
::xo::db::temp_table
Class Hierarchy of ::xo::db::temp_table
- ::xotcl::Object
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Methods for instances:
- __api_make_doc, __api_make_forward_doc, __nextC, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, checkC, classC, cleanupC, configureC, contains, copy, db_1rowC, debug, defaultmethod, destroyC, destroy_on_cleanup, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearchC, forwardC, hasclass, incrC, infoC, init, instvarC, invarC, isclassC, ismetaclassC, ismixinC, isobjectC, istypeC, lappendC, log, method, mixinC, mixinguardC, move, msg, noinitC, parametercmdC, procC, procsearchC, qn, requireNamespaceC, self, serialize, setC, substC, traceC, unsetC, uplevelC, upvarC, volatileC, vwaitC
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- __exitHandler, getExitHandler, setExitHandler, unsetExitHandler
- ::xo::db::temp_table
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- name, query, vars
- Methods for instances:
- destroy, init
- Methods to be applied on the class:
- Methods provided by the meta-class
Class Relations
- superclass: ::xotcl::Object
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xo::db::temp_table \
-superclass ::xotcl::Object \
-parameter {name query vars}
Methods
instproc destroy
::xo::db::temp_table instproc destroy {} {
# A session spans multiple connections in OpenACS.
# We want to get rid the data when we are done.
db_dml [my qn truncate_temp_table] "truncate table [my name]"
next
}instproc init
::xo::db::temp_table instproc init {} {
# The cleanup order is - at least under aolserver 4.01 - hard to get right.
# When destroy_on_cleanup is executed, ther might be already some global
# data for the database interaction gone.... So, destroy these objects
# by hand for now.
# my destroy_on_cleanup
# PRESERVE ROWS means that the data will be available until the end of the SQL session
set sql_create "CREATE global temporary table [my name] on commit PRESERVE ROWS as "
# When the table exists already, simply insert into it ...
if {[::xo::db::require exists_table [my name]]} {
db_dml . "insert into [my name] ([my vars]) ([my query])"
} else {
# ... otherwise, create the table with the data in one step
db_dml [my qn get_n_most_recent_contributions] $sql_create[my query]
}
}