- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::temp_table
::xo::db::temp_table create ... \
[ -name name ] \
[ -query query ] \
[ -vars vars ]
Class Relations
::xotcl::Class create ::xo::db::temp_table \ -superclass ::xotcl::ObjectMethods (to be applied on instances)
destroy (scripted)
# A session spans multiple connections in OpenACS. # We want to get rid the data when we are done. ::xo::dc dml truncate_temp_table "truncate table ${:name}" nextinit (scripted)
# # The cleanup order is - at least under AOLserver 4.01 - hard to get right. # When destroy_on_cleanup is executed, there might be already some global # data for the database interaction gone.... So, destroy these objects # by hand for now. # :destroy_on_cleanup # # The "GLOBAL" keyword on temp tables is deprecated (and currently # ignored) on PostgreSQL. Not sure, what's the state on various # Oracle versions. Therefore, we keep the comment for now. # if {![info exists :name]} { # # If there is no temp table name provided, create a name # avoiding name clashes. We assume, that the set of variables is # unique for such temp tables. # set :name "temp_table_[ns_md5 $vars]" } # # PRESERVE ROWS means that the data will be available until the # end of the SQL session.. # set sql_create "CREATE temporary table ${:name} on commit PRESERVE ROWS as " # When the table exists already, simply insert into it ... if {[::xo::db::require exists_table ${:name}]} { ::xo::dc dml . "insert into ${:name} ([:vars]) (${:query})" } else { # ... otherwise, create the table with the data in one step ::xo::dc dml get_n_most_recent_contributions $sql_create${:query} }name (setter)
query (setter)
vars (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables