Index: openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs-oracle.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl 27 Jan 2003 21:20:12 -0000 1.18 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs-oracle.tcl 12 Feb 2003 16:00:16 -0000 1.19 @@ -17,14 +17,105 @@ } } -proc_doc db_nextval { sequence } { Returns the next value for a sequence. This can utilize a pool of sequence values to save hits to the database. } { +ad_proc -public db_nextval { sequence } { + + Returns the next value for a sequence. This can utilize a pool of + sequence values. + +
+ + Example: + +
+ set new_object_id [db_nextval acs_object_id_seq] ++ + @param sequence the name of an sql sequence + @see /doc/db-api-detailed.html + +} { return [db_string "nextval" "select $sequence.nextval from dual"] } -proc_doc db_exec_plsql { statement_name sql args } { +ad_proc -public db_exec_plsql { statement_name sql args } { - Executes a PL/SQL statement, returning the variable of bind variable
:1
.
+ Executes a PL/SQL statement, returning the variable of bind
+ variable :1
.
+ + + Example: + +
+ db_exec_plsql delete_note { + begin + note.delete(:note_id); + end; + } ++ + If you need the return value, then do something like this: + +
+ set new_note_id [db_exec_plsql create_note { + begin + :1 := note.new( + owner_id => :user_id, + title => :title, + body => :body, + creation_user => :user_id, + creation_ip => :peeraddr, + context_id => :package_id + ); + end; + }] ++ + You can call several pl/sql statements at once, like this: + +
+ db_exec_plsql delete_note { + begin + note.delete(:note_id); + note.delete(:another_note_id); + note.delete(:yet_another_note_id); + end; + } ++ + If you are using xql files then put the body of the query in a +
yourfilename-oracle.xql
file. E.g. the first example
+ transformed to use xql files looks like this:
+
+
+ yourfilename.tcl
:
+
+
+ db_exec_plsql delete_note { } ++ +
yourfilename-oracle.xql
:+ <fullquery name="delete_note"> + <querytext> + begin + note.delete(:note_id); + end; + </querytext> + </fullquery> ++ + +
+ + Note that this description is oracle specific, because + this api-browser is running under oracle. + + + @see /doc/db-api-detailed.html + + } { ad_arg_parser { bind_output bind } $args @@ -94,8 +185,12 @@ return -code $errno -errorinfo $errorInfo -errorcode $errorCode $error } -proc_doc db_dml { statement_name sql args } { +ad_proc -public db_dml { statement_name sql args } { + Do a DML statement. + + @see /doc/db-api-detailed.html + } { ad_arg_parser { clobs blobs clob_files blob_files bind } $args