Index: openacs-4/packages/acs-core-docs/www/db-api.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api.html,v diff -u -r1.50.2.6 -r1.50.2.7 --- openacs-4/packages/acs-core-docs/www/db-api.html 2 Jan 2016 21:55:21 -0000 1.50.2.6 +++ openacs-4/packages/acs-core-docs/www/db-api.html 9 Jun 2016 08:44:49 -0000 1.50.2.7 @@ -1,5 +1,5 @@ -
+
By Pete Su and Jon Salz. Modified by Roberto Mello.
One of OpenACS's great strengths is that code written for it is
@@ -526,11 +526,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
@@ -573,7 +573,7 @@
}
proc print_the_foo {} {
- doc_body_append "foo is [db_string get_foo {select col from foo}]<br>\n"
+ doc_body_append "foo is [db_string "select col from foo"]<br>\n"
}
replace_the_foo 8
@@ -638,10 +638,9 @@
# Clean out the foo table
#
-db_dml unused "delete from foo"
+db_dml unused {delete from foo}
+db_dml unused {insert into foo(baz) values(:baz)}
-db_dml unused "insert into foo(baz) values('$baz')"
-
set n_rows [db_string unused "select count(*) from foo where baz is null"]
#
# $n_rows is 1; in effect, the "baz is null" criterion is matching
@@ -653,7 +652,7 @@
null
by writing:
-db_dml foo_insert "insert into foo(baz) values(:1)" {[db_nullify_empty_string $baz]} +db_dml foo_insert {insert into foo(baz) values(:1)} {[db_nullify_empty_string $baz]}