MS SQL PHP Generator online Help
| Prev | Return to chapter overview | Next |
Custom SQL queries
To add a query within the editor, use the Create Query button or select the corresponding popup menu item, then type the query name and text, and click OK. The query text must meet the following condition: such query as
select * from
(
YOUR_QUERY_TEXT
) tb_alias
must be valid. The Objects list displays the names of invalid queries in red.
Creating updatable datasets (For Professional Edition Only)
To get an updatable dataset based on an SQL query, you have to provide up to three SQL queries: UPDATE, INSERT, and DELETE to be able to modify, add and remove records accordingly. The first query provides an UPDATE statement for modifying existing records; the second query provides an INSERT statement to add a new record to the tables; and the third one provides a DELETE statement to remove the records. Each of these queries can contain several parameterized statements that use parameters like :field_name.
Example
Assume that we have the following SELECT statement:
SELECT
id,
first_name,
last_name
FROM customer
WHERE last_name LIKE 'A%'
To create an updatable dataset based on this query, INSERT, UPDATE and DELETE statements can be specified as follows:
INSERT INTO
customer
VALUES (:id, :first_name, :last_name);
UPDATE customer
SET id = :id,
first_name = :first_name,
last_name = :last_name
WHERE id = :OLD_id;
DELETE FROM customer
WHERE id = :id;
| Prev | Return to chapter overview | Next |







