Is it possible to create a statement like sql generator which generates at runtime?
Something like:
myquery1.sql.text := select * from customers;
myquery1.execute;
"myquery1.generatesqlinsert"
showmessage(myquery1.sqlinsert.text);
SQL Generator
Re: SQL Generator
Here is a code example that demonstrates generating INSERT SQL statements at run-time:
Note that to run this code, you should add the CRAccess and DASQLGenerator units to the USES clause of your unit.
But we don't recommend to use this, because internal methods are used in the code and incorrect usage of them can lead to unpredictable consequences.
Code: Select all
TDBAccessUtils.SQLGenerator(MyQuery1).SubstituteParamName := False;
ShowMessage(TDBAccessUtils.SQLGenerator(MyQuery1).GenerateSQL(TDAParamsInfo.Create(TDAParamInfo) , _stInsert, true));
But we don't recommend to use this, because internal methods are used in the code and incorrect usage of them can lead to unpredictable consequences.
-
- Posts: 118
- Joined: Mon 12 Sep 2005 17:31
- Location: Argentina
Re: SQL Generator
Thank you very much
Re: SQL Generator
Feel free to contact us if you have any further questions.