Recent

Author Topic: [SOLVED] TSQLQUERY : automatically generated update,insert delete statement  (Read 479 times)

k1attila1

  • Full Member
  • ***
  • Posts: 108
HI

I have a TQuery with SELECT sql statement.
TQuery can automatically generate update,insert, delete statement from this. OK so far.

Question :
Is there any way I can get these generated statements ?

thank you Attila

« Last Edit: October 26, 2024, 05:30:24 pm by k1attila1 »

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: TSQLQUERY : automatically generated update,insert delete statement
« Reply #1 on: October 26, 2024, 05:17:37 pm »
Really 'ugly' method:

Code: Pascal  [Select][+][-]
  1. type
  2.   THackMyConnection = class(TSQLConnection);
  3.  
  4. var
  5.   S: String;
  6.   ReturningClause: boolean;
  7. //..
  8.   SQLQuery1.Open;
  9.   ReturningClause := false;
  10.   S := THackMyConnection(SQLite3Connection1).ConstructInsertSQL(SQLQuery1, ReturningClause);
  11.   Showmessage(S);

You might be better off to make your own ConstructInsertSQL from the source from TSQLConnection.ConstructInsertSQL().

Otherwise you can also monitor the insert itself (while doing an actual INSERT) and catch the SQL statement.
(not sure which monitor component you need for that)

k1attila1

  • Full Member
  • ***
  • Posts: 108
Re: TSQLQUERY : automatically generated update,insert delete statement
« Reply #2 on: October 26, 2024, 05:30:01 pm »
Thank you, Sir
This is what I was looking for

 

TinyPortal © 2005-2018