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

Collapse
Posted by Dan Wickstrom on
00-database-procs-postgresql.tcl has a bind variable emulation routine that is used for the pg version of db_exec_plsql and for handling content stored as files.  The routine is called db_bind_var_substitution.  It's regexp based and it works ok as long as tcl vars are not mixed with bind variables.  Tcl vars can contain strings that will fool the regexp parsing and cause errors.  It should probably be rewritten to sequentially parse the query string instead of using regexps that way it would be more robust regardless of how the queries are constructed.  As Don suggested, lifting the bind variable emulation from the pg driver would be the best approach, and it would probably be quite simple to implement in the nsodbc driver.