Hello again,
I am now fairly sure that this a bug in Zeos. The same minimalistic example with SQLdb as Connection and Query don't show this behavior. I've also tested with Zeos-trunc-7.2, the bug is also there.
Maybe I have to tell you something more:
This works:
1. test whether the column of table exists
2. if not, insert that column
3. Connection.Disconnect
4. Connection.Connect
5. test whether the ID exists
6. insert data, Update/Insert in case of exists (a function UpSert I can't use, cause if there are different data, I want to give it back to proof it)
next 1
This works not:
1. test whether the column of table exists
2. if not, insert that column
3. test whether the ID exists
4. insert data
next
1. test whether the column of table exists
2. if not insert that column
3. test whether the ID exists <- here it comes the SIGSEGV, why???
These are my SQL-commands:
Code: Select all
//1. test whether the column of table exists
Query.SQL.Text:='SELECT column_name FROM information_schema.COLUMNS WHERE table_name = ''tab1'';';
Query.Open;
//2. if not insert that column
Connection.ExecuteDirect('ALTER TABLE tab1 ADD COLUMN '+Spalte+' INTEGER;');
//or
Query.SQL.Text:='ALTER TABLE tab1 ADD COLUMN '+Spalte+' INTEGER;';
Query.ExecSQL;
//3. test whether the ID exists
Query.SQL.Text:='SELECT * FROM tab1 WHERE id = :id;';
Query.ParamByName('id').AsInteger:=aID;
Query.Open;
//4. Insert
Query.SQL.Text:='INSERT INTO tab1 (id, '+Spalte+') VALUES (:id, :wert);';
Query.ParamByName('id').AsInteger:=aID;
Query.ParamByName('wert').AsInteger:=aI;
Query.ExecSQL;
there is nothing special - isn't it?