Difference between SQLUpdate.Text and SQL.Text.

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
piopio
Posts: 17
Joined: Tue 22 Nov 2011 23:41

Difference between SQLUpdate.Text and SQL.Text.

Post by piopio » Fri 20 Jan 2012 06:56

Hello,

I am struggling to understand the difference between SQLUpdate.Text and SQL.Text.

the following code works correctly
SQL.Clear;
SQL.Text:=('UPDATE tbl_invoices .........
pgquery1.Execute;


but the following one doesn't
SQLUpdate.Clear;
SQLUpdate.Text:=('UPDATE tbl_invoices .........
pgquery1.Execute;


I understand that pgquery1.Execute operates on SQL.Text only and I can use this parameter for updates, deletions etc.

If so, why do I have the parameters SQLUpdate, SQLRefresh, SQLInsert etc. ? How and when do I have to use them ?

Many thanks


Pio Pio

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 20 Jan 2012 11:16

Hello,

The SQLinsert, SQLUpdate, SQLDelete, and SQLRefresh properties are used to create SQL operators that are called after calling of the Post method of the corresponding DataSet and if they are not specified, they will be set by default. I. e., if the Select operator is specified in SQL.Text and you need to have specific Insert, Update, etc. operations, you can use these properties.
You can find more detailed information in the help file.

PgQuery1.Exec SQL -> used PgQuery1.SQL.Text

PgQuery1.Edit [Insert, Delete]
PgQuery1.Post - > used PgQuery1.SQLUpdate [SQLInsert, SQLDelete]

Post Reply