I've successfully compiled libtclslqite3.so on CentOS 5.5 Linux and
have run the example sqlite3 code from
http://www.sqlite.org/tclsqlite.html.

The TCL script below is almost verbatim from the above web page's examples.

Problem - After the first pass, it obviously attempts to CREATE TABLE
again, even though the table already exists (Lines 22-25 below.)

Is there a function provided by libtclslqite3.so that could either
list the existing tables, or trap this error?  Would it be TCL's
"catch" function?  I'd like the TCL script to continue after throwing
this error.

     1  #!/usr/bin/tclsh
     2  #load ./tclsqlite3.o
     3  load ./libtclsqlite3.so
     4  
     5  sqlite3 db1 ./tcl_interface.db
     6  
     7  db1 eval {CREATE TABLE t1(a int, b text)}
     8  
     9  db1 eval {INSERT INTO t1 VALUES('1','hello')}
    10  db1 eval {INSERT INTO t1 VALUES('2','goodbye')}
    11  db1 eval {INSERT INTO t1 VALUES('3','howdy!')}
    12  
    13  set x [db1 eval {SELECT * FROM t1 ORDER BY a}]
    14  
    15  db1 eval {SELECT * FROM t1 ORDER BY a} values {
    16          parray values
    17                  puts ""
    18  }
    19  
    20  
    21  [kchristian@linux1 ~]$ ./sqlite_tcl_so_test.tcl
    22  table t1 already exists
    23      while executing
    24  "db1 eval {CREATE TABLE t1(a int, b text)}"
    25      (file "./sqlite_tcl_so_test.tcl" line 8)
    26  [kchristian@linux1 ~]$


Thanks!

========Keith
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to