Changeset 212 for trunk/DNSDB.pm
- Timestamp:
- 12/21/11 17:49:46 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r209 r212 262 262 or return (undef, $DBI::errstr) if(!$dbh); 263 263 264 # Return here if we can't select. Note that this indicates a 265 # problem executing the select. 266 my $sth = $dbh->prepare("select group_id from groups limit 1"); 264 ##fixme: initialize the DB if we can't find the table (since, by definition, there's 265 # nothing there if we can't select from it...) 266 my $tblsth = $dbh->prepare("SELECT count(*) FROM pg_catalog.pg_class WHERE relkind='r' AND relname=?"); 267 my ($tblcount) = $dbh->selectrow_array($tblsth, undef, ('misc')); 268 return (undef,$DBI::errstr) if $dbh->err; 269 270 #if ($tblcount == 0) { 271 # # create tables one at a time, checking for each. 272 # return (undef, "check table misc missing"); 273 #} 274 275 276 # Return here if we can't select. 277 # This should retrieve the dbversion key. 278 my $sth = $dbh->prepare("SELECT key,value FROM misc WHERE misc_id=1"); 267 279 $sth->execute(); 268 280 return (undef,$DBI::errstr) if ($sth->err); 281 282 ##fixme: do stuff to the DB on version mismatch 283 # x.y series should upgrade on $DNSDB::VERSION > misc(key=>version) 284 # DB should be downward-compatible; column defaults should give sane (if possibly 285 # useless-and-needs-help) values in columns an older software stack doesn't know about. 269 286 270 287 # See if the select returned anything (or null data). This should
Note:
See TracChangeset
for help on using the changeset viewer.