I am tasked with changing what a delphi program does here at work. The application used to connect too a mysql server and, with ado, run queries. Now that the server has changed to one that won’t accept external connections it was decided that we would convert the application to connect to a webservice and send the mysql update query thru there.
I have everything working except for one thing. Since I did not want to change too many things (did a lot of c++builder back in the days but thats 10 years back now) I decided to leave the ado object in place and try to have it output the mysql it generates so I can send it to the webservice (hope I make sense).
The problem I have is the only thing I found was
ShowMessage (DataModuleDB.adoqClients.SQL.Text);
But this outputs the mysql before it is changed by ado:
insert into table clients (id, name) values (:id, :name)
So my question is how (if its possible) could I get the “real” mysql query to show without executing it.
Obviously if I cannot do it like that I’ll just change everything and construct the query myself.
Thanks in advance.
The actual parameter substitution is happening outside the VCL and as late as in the SQL Server itself (allowing reusing the query plan).
If you still need the substituted SQL, you can use the ADOQuery’s
Command.CommandObject.CommandTextand replace the ‘?’ with the parameters value yourself.AFAIK, ADO only cares for the right order and type…
Something like: