RB Smissaert wrote:
Just one question; as I log nearly all my SQL statements to
a SQLite table, will this be OK with the double quotes added?

If I understand your question correctly the answer is of course, you are simply logging the text of the SQL as a literal string.

The literal string can be specified using the sqlite3_bind_text API or by generating a custom insert statement. In the later case the literal string must be surrounded by single quote characters and you will need to escape any single quote characters in the string. Avoiding this kind of quoting is a real benefit of using the bind APIs. If you can't do that you may want to use an squote function that will do the quoting and escaping for the SQL string and return a safely quoted literal string.

   Function SQuote(sql As String) As String
       SQuote = "'" & Replace(sql, "'", "''") & "'"
   End Function

This will take an SQL statement like

insert into "t"("a", "b") values ('test', 'it''s a string with "quotes" in it.');

and produce a string like

'insert into "t"("a", "b") values (''test'', ''it''''s a string with "quotes" in it.'');'

which sqlite will treat as a single literal string which can be inserted into your log like this

   logSQL = "insert into log values (" & SQuote(strSQL) & ")";
   execute(logSQL);

HTH
Dennis Cote


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to