Libgda simple example
=====================

Description:
------------

The example in this directory illustrate how to use a GdaSqlBuilder to build statement from their structure.
The "example_cnc" program differs from the "example" in that SQL rendering is done for an opened
connection which has the GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE flag set.

Compiling and running:
----------------------

To compile (make sure Libgda is installed prior to this):
> make

and to run:
> ./example
or
> ./example_cnc

Output:
-------
Running should produce the following output:

SQL: INSERT INTO customers (e, f, g) VALUES (##p1::string, 15, 'joe')
SQL: UPDATE products SET ref='A0E''FESP' WHERE id = 14
SQL: UPDATE products SET ref='A0E''FESP' WHERE id = ##theid::int
SQL: DELETE FROM items WHERE id = ##theid::int
SQL: SELECT c."date", name AS person FROM "select" AS c INNER JOIN orders 
SQL: SELECT c."date", name AS person FROM "select" AS c INNER JOIN orders USING (id) 
SQL: SELECT myfunc (a, 5, 'Joe') FROM mytable
SQL: SELECT myfunc (a, 5, 'Joe'), MAX (myfunc (a, 5, 'Joe'), b, 10) FROM mytable
SQL: UPDATE "select" SET "date"='2009-05-27' WHERE id = 14
SQL: SELECT date (a, 5, 'Joe') FROM "date", MyTable
SQL: SELECT name FROM master WHERE id IN (SELECT id FROM subdata)
SQL: SELECT id, name, (SELECT MAX (ts) FROM documents AS d WHERE t.id = d.topic) FROM topics AS t
SQL: INSERT INTO customers (e, f, g) SELECT id, name, location FROM subdate
SQL: SELECT id, name FROM subdata1 UNION SELECT ident, lastname FROM subdata2
SQL: SELECT CASE WHEN price < 1.200000 THEN 2 ELSE 1 END FROM data
SQL: SELECT CASE tag WHEN 'Alpha' THEN 1 WHEN 'Bravo' THEN 2 WHEN 'Charlie' THEN 3 END FROM data
SQL: SELECT people.firstname AS person, people.lastname, "date" AS birthdate, age FROM people
SQL: INSERT INTO customers (f, g) VALUES (15, 'joe')
SQL: DELETE FROM items WHERE id = ##theid::int
SQL: SELECT id FROM mytable WHERE (name = ##thename::string) AND (id = ##theid::int)
SQL: SELECT name FROM (SELECT id, name FROM subdata) AS sub

and for example_cnc:
SQL: INSERT INTO "customers" ("e", "f", "g") VALUES (##p1::string, 15, 'joe')
SQL: UPDATE "products" SET "ref"='A0E''FESP' WHERE "id" = 14
SQL: UPDATE "products" SET "ref"='A0E''FESP' WHERE "id" = ##theid::int
SQL: DELETE FROM "items" WHERE "id" = ##theid::int
SQL: SELECT "c"."date", "name" AS person FROM "select" AS c INNER JOIN "orders" 
SQL: SELECT "c"."date", "name" AS person FROM "select" AS c INNER JOIN "orders" USING ("id") 
SQL: SELECT myfunc ("a", 5, 'Joe') FROM "mytable"
SQL: SELECT myfunc ("a", 5, 'Joe'), MAX (myfunc ("a", 5, 'Joe'), "b", 10) FROM "mytable"
SQL: UPDATE "select" SET "date"='2009-05-27' WHERE "id" = 14
SQL: SELECT date ("a", 5, 'Joe') FROM "date", "MyTable"
SQL: SELECT "people"."firstname" AS person, "people"."lastname", "date" AS birthdate, "age" FROM "people"
SQL: INSERT INTO "customers" ("f", "g") VALUES (15, 'joe')
SQL: DELETE FROM "items" WHERE "id" = ##theid::int
SQL: SELECT "id" FROM "mytable" WHERE ("name" = ##thename::string) AND ("id" = ##theid::int)
