Dear All,
I have a question regarding SQLite.
I got an error: 'database schema has changed' when I run the following code (code 1) (when I execute the second Insert Query). If I run the code 2 I don't get the error and the program works fine. This always happens when I create a Table, then I create a query with parameters, then I create another table and then I run the query. Otherwise (code 2) if I create a table, then I create and run the query as a statement without parameters, then I create another table and then run the same insert query statement without parameter I don't get the error. Is it a bug or something related to SQLite? (Same situation, same queries and table I don't get any error using Firebird). Thanks,
Andrea
code1:
if FileExists('e:\temp\prova.db') then
DeleteFile('e:\temp\prova.db');
SQLite3Connection1.DatabaseName:= 'e:\temp\prova.db';
SQLite3Connection1.ExecuteDirect('create table T1 (ID integer not
null, NOME varchar(200))');
sqlquery1.SQL.Text:= 'insert into T1 (ID, NOME) values (:ID, :NOME)';
SQLQuery1.Params.ParamByName('ID').AsInteger:= 1;
SQLQuery1.Params.ParamByName('NOME').AsString:= 'Andrea';
SQLQuery1.ExecSQL;
SQLite3Connection1.ExecuteDirect('create table T2 (ID integer not null,
COGNOME varchar(200))');
SQLQuery1.Params.ParamByName('ID').AsInteger:= 2;
SQLQuery1.Params.ParamByName('NOME').AsString:= 'Marco';
SQLQuery1.ExecSQL;
SQLTransaction1.CommitRetaining;code 2:
if FileExists('e:\temp\prova.db') then
DeleteFile('e:\temp\prova.db');
SQLite3Connection1.DatabaseName:= 'e:\temp\prova.db';
SQLite3Connection1.ExecuteDirect('create table T1 (ID integer not
null, NOME varchar(200))');
sqlquery1.SQL.Text:= 'insert into T1 (ID, NOME) values (1, ''Andrea'')';
SQLQuery1.ExecSQL;
SQLite3Connection1.ExecuteDirect('create table T2 (ID integer not
null, COGNOME varchar(200))');
sqlquery1.SQL.Text:= 'insert into T1 (ID, NOME) values (2, ''Pippo'')';
SQLQuery1.ExecSQL;
SQLTransaction1.CommitRetaining;