in reply to Checking for DB table existence using DBI/DBD
(i.e. without doing an execute).use DBI; use strict; my $db=DBI->connect("DBI:SQLite:dbname=testdb","",""); my $sth = $db->prepare("select * from nosuchtable"); if ($sth){print "Table exists\n"} else{print "No such table\n"}
The code displays a warning from SQLite that the table doesn't exist, and the true test for $sth fails. Of course, this might be a bad way (if it is, I'd like to know so I can change it in my code).
--------------------------------------------------------------
$perlquestion=~s/Can I/How do I/g;
|
---|