Index: openacs-4/packages/acs-core-docs/www/db-api-detailed.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api-detailed.html,v diff -u -r1.48.2.5 -r1.48.2.6 --- openacs-4/packages/acs-core-docs/www/db-api-detailed.html 1 Dec 2015 14:38:40 -0000 1.48.2.5 +++ openacs-4/packages/acs-core-docs/www/db-api-detailed.html 2 Jan 2016 21:55:21 -0000 1.48.2.6 @@ -29,9 +29,9 @@ } db_transaction { -db_dml unused "insert into greeble(bork) values(33)" -foo $db -db_dml unused "insert into greeble(bork) values(50)" + db_dml unused {insert into greeble(bork) values(33)} + foo $db + db_dml unused {insert into greeble(bork) values(50)} }

@@ -314,7 +314,7 @@ set bar "" set baz "" -db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)" +db_dml foo_create {insert into foo(bar, baz) values(:bar, :baz)} # # the values of the "bar" and "baz" columns in the new row are both # null, because Oracle has coerced the empty string (even for the @@ -333,7 +333,7 @@ set bar [db_null] set baz [db_null] -db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)" +db_dml foo_create {insert into foo(bar, baz) values(:bar, :baz)} # # sets the values for both the "bar" and "baz" columns to null @@ -471,11 +471,11 @@ insert. Only one of -blobs, -clobs, -blob_files, and -clob_files may be provided.

Example:

 
-db_dml insert_photos "
+db_dml insert_photos {
         insert photos(photo_id, image, thumbnail_image)
         values(photo_id_seq.nextval, empty_blob(), empty_blob())
         returning image, thumbnail_image into :1, :2
-    "  -blob_files [list "/var/tmp/the_photo" "/var/tmp/the_thumbnail"] 
+    }  -blob_files [list "/var/tmp/the_photo" "/var/tmp/the_thumbnail"] 
 
 

This inserts a new row into the photos table, with the contents @@ -508,17 +508,19 @@ transactions. It is possible to specify an optional on_error code block that will be executed if some code in code_block throws an exception. The variable errmsg will be bound in that scope. -If there is no on_error code, any errors will be propagated.

Example:

+If there is no on_error code, any
+  errors will be propagated. 

+

Example:

 
 proc replace_the_foo { col } {
     db_transaction {
-        db_dml "delete from foo"
-        db_dml "insert into foo(col) values($col)"
+        db_dml delete {delete from foo}
+        db_dml insert {insert into foo(col) values(:col)}
     }
 }
 
 proc print_the_foo {} {
-    doc_body_append "foo is [db_string "select col from foo"]<br>\n"
+    doc_body_append "foo is [db_string get_foo {select col from foo}]<br>\n"
 }
 
 replace_the_foo 8
@@ -527,7 +529,7 @@
 db_transaction {
     replace_the_foo 14
     print_the_foo ; # Writes out "foo is 14"
-    db_dml "insert into some_other_table(col) values(999)"
+    db_dml insert_foo {insert into some_other_table(col) values(999)}
     ...
     db_abort_transaction
 } on_error {
@@ -541,7 +543,7 @@
 
 db_abort_transaction
 

Aborts all levels of a transaction. That is if this is called within -several nested transactions, all of them are terminated. Use this insetead of +several nested transactions, all of them are terminated. Use this instead of db_dml "abort" "abort transaction".