Index: openacs-4/packages/acs-core-docs/www/db-api.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-core-docs/www/db-api.adp 12 Feb 2019 17:12:18 -0000 1.6 +++ openacs-4/packages/acs-core-docs/www/db-api.adp 12 Feb 2019 17:43:02 -0000 1.7 @@ -525,34 +525,6 @@ } -
-db_nullify_empty_string
-db_nullify_empty_string string
-
For true SQL purists, we provide the convenience function
-db_nullify_empty_string
, which
-returns [db_null] if its string
argument is the empty
-string and can be used to encapsulate another Oracle quirk:
- -set baz "" - -# Clean out the foo table -# -db_dml unused {delete from foo} -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 -# the empty string we just inserted (because of Oracle's coercion -# quirk) - -
To balance out this asymmetry, you can explicitly set
-baz
to null
by writing:
- -db_dml foo_insert {insert into foo(baz) values(:1)} {[db_nullify_empty_string $baz]} - -
($Id: db-api.xml,v 1.14 2017/08/07 23:47:54 gustafn Exp $)