build error
[csql.git] / examples / isql / README
blob9d15710038f503d42290e4bc029a816a9fbbc021
1 ----------------------------------README---------------------------------------
2 This contains an example program that demonstates usage of csql tool.
4 What it does?
5 -------------
6 A) create.sql
7 It creates table t1 with two fields f1 integer (primary key) and f2 string.
9 B) insert.sql
10 Inserts 5 rows into the table t1
12 C) select.sql
13 select value of f2 from table t1 for tuple with f1 value 3
14 select all the tuples from table t1
16 D) delete.sql
17 delete all rows from table t1 with f1 value 3
18 delete all rows from table t1;
20 E) Drop the table
21 drop the table object
23 How to run
24 ----------
25 1. Set the CSQL_CONFIG_FILE environment variable to absolute path of csql.conf file.
26         $export CSQL_CONFIG_FILE=/tmp/csql.conf
27 2. Set the LD_LIBRARY_PATH environment variable to csql library path
28         $export LD_LIBRARY_PATH=$CSQL_INSTALL_ROOT/lib:$LD_LIBRARY_PATH
30 3. Run the csql tool with appropriate sql script as input
31         $csql -u root -p manager -s create.sql
33 Output of example:
34 ------------------
35 A) create.sql
36 echo create table t1 (f1 integer, f2 char (20), primary key(f1));
37 Statement Executed
39 B) insert.sql
40 Statement Executed: Rows Affected = 1
41 Statement Executed: Rows Affected = 1
42 Statement Executed: Rows Affected = 1
43 Statement Executed: Rows Affected = 1
44 Statement Executed: Rows Affected = 1
46 C)select.sql
47 echo select f2 from t1 where f1 =3;
48 ---------------------------------------------------------
49         f2
50 ---------------------------------------------------------
51         Baskar
53 echo select * from t1;
54 ---------------------------------------------------------
55         f1      f2
56 ---------------------------------------------------------
57         1       Hari
58         2       Mani
59         3       Baskar
60         4       Babu
61         5       Raghu
63 D)delete.sql
64 echo delete from t1 where f1 =3;
65 Statement Executed: Rows Affected = 1
66 echo delete from t1;
67 Statement Executed: Rows Affected = 4
69 E)drop.sql
70 Statement Executed