[EMAIL PROTECTED] wrote:

1. Is there a way using SQL code alone to open databases, or will
that always be done by my native (Delphi) code calling the DLL?


I suppose another way to ask that question is: Would "scripts" which could manage ALL database activities require embedded SQL in another language, or could SQL do the job alone?


Opening a database is a function of the library, not SQL. You need to have the database open for there to be something for the SQL to act on.

2. If I wish to write and test SQL code "live" can/should I open
one or more databases (however) and manipulate them via SQL at leisure, or should each invocation of SQL code open, run, then close the files?


It's perfectly fine to execute multiple queries on a single connection. In fact I use the sqlite[3] client to test out my SQL while my program is running.

3. If I want to exchange data between files, what's the general algorithm for opening, doing transactions, then closing? As an extension to this question, if one wished to backup data by doing
a record-for-record copy during application idle time, what would be a good strategy for doing this quickly yet safely (given the possibility of premature computer power-down)?




The answer here depends on how you want your backups. If you want to make sure that nothing is committed until all of the data has been copied, starting a transaction, copying all of the data, then commiting the transaction would be a good bet. It you're willing to risk partially incomplete data, smaller transactions for single tables are suitable and probably provide a better backup of your data. For that matter, simply copying the file is often suitable. With a compression utility you can even make a relatively compact backup of your data.

Clay Dowling

Reply via email to