File: README

package info (click to toggle)
libgda5 5.2.10-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,168 kB
  • sloc: ansic: 495,319; xml: 10,486; yacc: 5,165; sh: 4,451; makefile: 4,095; php: 1,416; java: 1,300; javascript: 1,298; python: 896; sql: 879; perl: 116
file content (62 lines) | stat: -rw-r--r-- 3,067 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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)