more portable "next record id" code
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Oct 2007 02:51:13 +0000 (02:51 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Oct 2007 02:51:13 +0000 (02:51 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7935 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/import/marc2bre.pl

index 07e5822..7f8323d 100755 (executable)
@@ -69,8 +69,12 @@ my %processing_cache;
 my $dsn = "dbi:$db_driver:host=$db_host;dbname=$db_name";
 
 if (!$recid) {
+    my $table = 'biblio_record_entry';
+    $table = 'biblio.record_entry' if ($db_driver eq 'Pg');
+
        my $dbh = DBI->connect($dsn,$db_user,$db_pw);
-       my $sth = $dbh->prepare("SELECT nextval('biblio.record_entry_id_seq')");
+       my $sth = $dbh->prepare("SELECT MAX(id) + 1 FROM $table");
+
        $sth->execute;
        $sth->bind_col(1, \$recid);
        $sth->fetch;