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.31.2.4 -r1.31.2.5 --- openacs-4/packages/acs-core-docs/www/db-api.html 22 Oct 2004 02:38:14 -0000 1.31.2.4 +++ openacs-4/packages/acs-core-docs/www/db-api.html 1 Nov 2004 23:39:38 -0000 1.31.2.5 @@ -1,14 +1,14 @@ -The OpenACS Database Access API

The OpenACS Database Access API

+The OpenACS Database Access API

The OpenACS Database Access API

By Pete Su and Jon Salz. Modified by Roberto Mello. -

Overview

+

Overview

One of OpenACS's great strengths is that code written for it is very close to the database. It is very easy to interact with the database from anywhere within OpenACS, and we have a coherent API for database access which makes this even easier.

More detailed information about the DB api is available at Database Access API. -

DB API Examples

+

DB API Examples

The OpenACS database API is meant to save developers from making common mistakes and to provide a more structured syntax for specifying database operations, including transactions. Here's @@ -57,7 +57,7 @@ Finally and most importantly, there API implements bind variables, which we will cover next.

-

Bind Variables

+

Bind Variables

Bind variables are placeholders for literal values in an SQL query being sent to the server. In the old way, data was generally passed to directly to the DB backend, via Tcl string @@ -141,7 +141,7 @@ Finally, the DB API has several different styles for passing bind variable values to queries. In general, use the style presented here because it is the most convenient. -

Usage

Every db_* command accepting a SQL command as an argument +

Usage

Every db_* command accepting a SQL command as an argument supports bind variables. You can either

  • Specify the -bind switch to provide a set with bind variable values, or @@ -208,7 +208,7 @@ # of "administrator" } -

Nulls and Bind Variables

+

Nulls and Bind Variables

When processing a DML statement, Oracle coerces empty strings into null. (This coercion does not occur in the WHERE clause of a query, i.e. @@ -252,7 +252,7 @@ db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)" # -# sets the values for both the "bar" and "baz" columns to null

Sequence Pooling

+# sets the values for both the "bar" and "baz" columns to null

Sequence Pooling

The database library can transparently maintain pools of sequence values, so that each request for a new sequence value (using db_nextval) does not incur a roundtrip to the server. For instance, this functionality is @@ -283,7 +283,7 @@ yourservername /acs/database] configuration section.) -

Basic API

+

Basic API

The Database API has several functions that wrap familiar parts of the AOLserver database API.