Forum OpenACS Development: Response to Bind variable emulation in Tcl?

Collapse
Posted by Andrew Piskorski on
Don, you were right. Adding the bind variable emulation stuff into the nsodbc driver was pretty easy. It all seems to work for me now. But, in the process of doing this though, I came up with a few question about some of the (Open)ACS DB API stuff.

First of all, what is the deal with the args parameter in the Oracle version of db_exec? E.g.:

  Oracle:  return [eval [list ns_ora $type $db -bind $bind $sql] $args]
Postgres:  return [eval [list ns_pg_bind $type $db -bind $bind $sql]]
The principle users of this db_exec args parameter seem to be the db_exec_plsql, db_dml, and db_blob_get_file procs. Looks like the $args parameter is only important for lobs, but I'm at a loss as to what exactly is going on there.

Secondly, I grabbed the OpenACS code out of CVS, and noticed that the ACS Tcl package has three separate *database-procs*.tcl files:

00-database-procs-oracle.tcl
00-database-procs-postgresql.tcl
00-database-procs.tcl

I guess you guys went with separate -oracle and -postgresql files in order to avoid switch statements?

Well, now that I've added support for multiple database drivers to my 10-database-procs.tcl, I've got switch statements in there for Oracle, Postgres, and nsodbc anyway. So, seems to me that if at some point I want to try and add this same feature to OpenACS, I might as well merge the three files back into one, with switch statements galore, no? What do you think?