I’m using the statement: select count(*) from sqlite_master where type = 'table' and name = ‘$NAME’;
This statement works fine in the sqlite3 shell. This statement does not work in my API. Is there a PRAGMA I need to issue so I can check for table existence? TIA Mike PERL code to check for table existence: sub tableexists($$) { my $dbh = shift; my $name = shift; my $tableexists = 0; $dbh->do("pragma writable_schema = 'on';"); my $sql = "select count(*) from sqlite_master where type = 'table' and name = '$name';"; my $stmt = $dbh->prepare($sql); $stmt->execute or die "$0: verifying table name failed: $DBI::errstr"; while(my @row = $stmt->fetchrow_array) { $tableexists = $row[0]; } $stmt->finish; $dbh->do("pragma writable_schema = 'off';"); return $tableexists; } _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users