I'm not an expert on Aducom SQLite components, but anyway i'll try to help.

Maybe you should consider using parameters in your query. Parameters in
SQLite start with ':', '@' or '?', however ASGSQlite supports only ':' in my
opinion. Your SQL query should look like this:
INSERT INTO Stuff (Title) VALUES (:Title);

To use params in ASGSQLite:

with TASQLite3query.Create(nil) do
try
  Connection := ASQLite3DB1;
  // Force parsing of SQL. You don't have to do this since this property is
False by default.
  // It's only to emphasize that this property must be set to False.
  RawSQL := False; 
  // Set command text (it automatically parses SQL into Params collection).
  SQL.Text := 'INSERT INTO Stuff (Title) VALUES (:Title)';
  // Set param values
  Params.ParamByName('Title') := 'Let''s meet at the pub tonight!';
  // execute SQL
  ExecSQL;
finally
  Free;
end;


Another way is to execute SQL directly with SQLite3_Execute() method of
TASQLite3DB. If so you have to create Params collection by your own.

Never compiled or tested the code above, use it at your own risk. I hope I
helped a bit.


Gilles Ganault wrote:
> 
> Hello
> 
>       I'm having a problem saving strings into a colum from a Delphi
> application 
> because they might contain the ( ' ) single quote character:
> 
> =========
> // Input := 'Let's meet at the pub tonight!';
> MyFormat := 'insert into stuff (title) values ('''%s')';
> SQL := Format(MyFormat, Input);
> 
> try
>      ASQLite3DB1.Database := db;
>      ASQLite3DB1.DefaultDir := ExtractFileDir(Application.ExeName);
>      ASQLite3DB1.Open;
> 
>      ASQLite3DB1.SQLite3_ExecSQL(SQL);
>      ASQLite3DB1.Close;
> except
>      ShowMessage('Bad');
> end;
> =========
> 
> Is there a function I should call either in SQLite or Delphi before
> running 
> the SQL query?
> 
> Thank you.
> 
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-Delphi--Escaping-quote--tf3983235.html#a12158672
Sent from the SQLite mailing list archive at Nabble.com.


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

Reply via email to