Hi,
I would handle different db-tables with one TIBCQuery. Is there a method to generate the sql's (update, insert, delete) on TIBCQuery on runtime?
thanks for help in advanced
bye
Robert
Generate SQL on runtime
in Delphi
//select
TIBCQuery.SQL.Clear;
TIBCQuery.SQL.ADD('SELECT FIELD_NAME FROM TABLE');
TIBCQuery.OPEN;
IF NOT TIBCQuery.ISEMPTY THEN
BEGIN
FIELD := TIBCQuery.FIELDBYNAME('FIELD_NAME').VALUE;
END;
TIBCQuery.CLOSE;
//delete,update
TIBCQuery.SQL.Clear;
TIBCQuery.SQL.ADD('DELETE FROM TABLE where ...');
TIBCQuery.ExecSQL;
//select
TIBCQuery.SQL.Clear;
TIBCQuery.SQL.ADD('SELECT FIELD_NAME FROM TABLE');
TIBCQuery.OPEN;
IF NOT TIBCQuery.ISEMPTY THEN
BEGIN
FIELD := TIBCQuery.FIELDBYNAME('FIELD_NAME').VALUE;
END;
TIBCQuery.CLOSE;
//delete,update
TIBCQuery.SQL.Clear;
TIBCQuery.SQL.ADD('DELETE FROM TABLE where ...');
TIBCQuery.ExecSQL;
-
- Posts: 7
- Joined: Mon 26 Oct 2009 12:55
Ok that's clear. But that is not what I have answerd for.
I have many master-tables on my db, and I would not type for any of this master-tables the SQLUpdate, SQLInsert and SQLDelete statments. Designtime there is the SQL Generator on TIBCQuery to do this.
Because I don't wont use a separate TIBCQuery component for each table, I have to generate this SQL-Statements dynamically on runtime.
Is there a solution for this?
bye
Robert
I have many master-tables on my db, and I would not type for any of this master-tables the SQLUpdate, SQLInsert and SQLDelete statments. Designtime there is the SQL Generator on TIBCQuery to do this.
Because I don't wont use a separate TIBCQuery component for each table, I have to generate this SQL-Statements dynamically on runtime.
Is there a solution for this?
bye
Robert
-
- Posts: 7
- Joined: Mon 26 Oct 2009 12:55
But in this way I have to change every time the code of my programm. 
And I would avoid this with automating this procedure:
Pass the table name on my procedure
I create the "select * from table_name" in the way you have explained
At this point I don't know how many fields this table has
The missing part: create via a method (like SQL Generator) the update, insert and delete statements.
I hope I have explained it more clearly now
bye
Robert

And I would avoid this with automating this procedure:
Pass the table name on my procedure
I create the "select * from table_name" in the way you have explained
At this point I don't know how many fields this table has
The missing part: create via a method (like SQL Generator) the update, insert and delete statements.
I hope I have explained it more clearly now

bye
Robert