FAQ - Question #6

Top Previous Next

Q. Should I use TPSQLUpdateSQL everytime with TPSQLQuery?

A. No, it should be used only for the following queries types.

Multitable queries:

SELECT table1.field1, table2.field2, func.field1 FROM table, table2, some_func() AS func(field1);

Queries with operators in the field list:

SELECT field1 || field2, field2::varchar FROM some_table;

Queries with constants or function calls in the field list:

SELECT 2, 'char constant', version() FROM ...;

In other words, Query may be modified automatically (without using TPSQLUpdateSQL), if it consists of plain field list taken from one and only one table.

This, however, doesn't mean that you can not use other table or function references in FROM clause, e.g.

SELECT DISTINCT(customer_id) FROM customer, order WHERE order.cust_id = customer.customer_id

See also: Questions list