From: <dr...@hw...> - 2006-08-24 14:41:35
|
Thanks everybody for the input. Responses below. Arjen Markus <arjen.markus=40wldelft.nl> wrote: > Why not an extra, optional, argument to the connect procedure. > If present, it contains the command to perform on/ just before connecti= ng > to the database.=20 If the user is required to specify the initialization procedure on each connection, then the user might as well just call the initialization procedure themselves, manually, as an extra step. I'm looking for a way to create initialization that can be changed in one place - without having to modify every place in the code where a new connection is established. Reinhard Max <max=40tclers.tk> wrote: >=20 > sqlite3 configure -onopen myopencallback >=20 I thought of that. The problem is that the sqlite3 command must be active for it to occur. I was really looking for a way to set up an initialization procedure prior to the package require sqlite3 I can create an sqlite3_init proc at any time. But I cannot do an -onopen option to the sqlite3 command until after the sqlite3 package has been loaded. I'm wanting the sqlite3_init proc in order to provide some default initialization to new SQLite connections in starkits. I want a user to be able do: source sqlite-3_3_7.kit package require sqlite3 sqlite3 db =24databasefile and nothing else, yet have some custom initialization occur to the database connection as it is opened. This would allow different starkits to be published that have SQLite configured in different ways. There could be the SQLite plus extra functions starkit. Or the SQLite with full-text search starkit. And so forth. I thought creating an sqlite3_init proc that gets loaded when the starkit is sourced would do the job. I suppose I could play some strange games with =22package ifneeded=22. But an sqlite3_init proc seems preferable to that. Still looking for ideas.... -- D. Richard Hipp <drh=40hwaci.com> |