From: Gerhard Reithofer on 25 Apr 2010 13:53 Hi TCLers, I've a strange problem with sqlite3: % package require sqlite3 3.6.13 % sqlite3 dbh ./filedb % set res [dbh exists {SELECT * FROM ftab WHERE 1=0}] no such table: ftab % puts $res can't read "res": no such variable % info patchlevel 8.5.7 % From the sqlite docs (http://www.sqlite.org): The difference is that the "exists" method always returns a boolean value... Tested on Debian Etch and Ubuntu Karmic (Tcl 8.5.8, sqlite3 3.6.22). Can anyone confirm this bug (Activetcl dist.)? Did I oversee something? It's reused older code which worked in ealier version. -- Gerhard Reithofer Tech-EDV Support Forum - http://support.tech-edv.co.at
From: Manfred Stelzhammer on 25 Apr 2010 16:03 Gerhard Reithofer schrieb: > Hi TCLers, > I've a strange problem with sqlite3: > > % package require sqlite3 > 3.6.13 > % sqlite3 dbh ./filedb > % set res [dbh exists {SELECT * FROM ftab WHERE 1=0}] > no such table: ftab > % puts $res > can't read "res": no such variable > % info patchlevel > 8.5.7 > % > > From the sqlite docs (http://www.sqlite.org): > The difference is that the "exists" method always returns a boolean > value... > > Tested on Debian Etch and Ubuntu Karmic (Tcl 8.5.8, sqlite3 3.6.22). > > Can anyone confirm this bug (Activetcl dist.)? > Did I oversee something? > It's reused older code which worked in ealier version. > The docu sayes: always returns a boolean value which is TRUE if a query in the SQL statement it executes returns one or more rows and FALSE if the SQL returns an empty set. In your case the statement is wrong because the table "ftab" doesn't exist. You can check for errors with "dbh errorcode". If the command returns "1", there is an error in the command, with "0" the commando ist ok. Regards Manfred
From: Gerhard Reithofer on 25 Apr 2010 19:18 Hi Manfred, On Sun, 25 Apr 2010, Manfred Stelzhammer wrote: > Gerhard Reithofer schrieb: > > Hi TCLers, > > I've a strange problem with sqlite3: > > > > % package require sqlite3 > > 3.6.13 > > % sqlite3 dbh ./filedb > > % set res [dbh exists {SELECT * FROM ftab WHERE 1=0}] .... > > Tested on Debian Etch and Ubuntu Karmic (Tcl 8.5.8, sqlite3 3.6.22). > > Can anyone confirm this bug (Activetcl dist.)? > > Did I oversee something? > > It's reused older code which worked in ealier version. > > > The docu sayes: > always returns a boolean value which is TRUE if a query in the SQL statement > it executes returns one or more rows and FALSE if the SQL returns an empty > set. > > In your case the statement is wrong because the table "ftab" doesn't exist. > > You can check for errors with "dbh errorcode". > If the command returns "1", there is an error in the command, with "0" the > commando ist ok. thanks, I didn't read the docs thoroughly enough. I was trying for the check for the existence of a table. c.l.t - the fastest support ;) -- Gerhard Reithofer Tech-EDV Support Forum - http://support.tech-edv.co.at
From: Spam on 25 Apr 2010 21:17 On Mon, 26 Apr 2010, Gerhard Reithofer wrote: > thanks, I didn't read the docs thoroughly enough. > I was trying for the check for the existence of a table. > > c.l.t - the fastest support ;) try selecting for type = table from sqlite_master ... select * from sqlite_master ; If the table exists, you'll find it there .. Cheers, Rob Sciuk
From: Gerhard Reithofer on 26 Apr 2010 03:52 On Sun, 25 Apr 2010, Spam(a)ControlQ.com wrote: > On Mon, 26 Apr 2010, Gerhard Reithofer wrote: > > > > thanks, I didn't read the docs thoroughly enough. > > I was trying for the check for the existence of a table. > > > > c.l.t - the fastest support ;) > > try selecting for type = table from sqlite_master ... > > select * from sqlite_master ; > > If the table exists, you'll find it there .. > > Cheers, > Rob Sciuk Thank you very much, that was I'm searching for. -- Gerhard Reithofer Tech-EDV Support Forum - http://support.tech-edv.co.at
|
Next
|
Last
Pages: 1 2 Prev: "string is dict"? How to get that? Next: ActiveSate tcl 8.5 strange behavior Ubuntu 8.4 |