[open-ils-commits] r7935 - trunk/Open-ILS/src/extras/import

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 25 23:05:11 EDT 2007


Author: miker
Date: 2007-10-25 22:51:13 -0400 (Thu, 25 Oct 2007)
New Revision: 7935

Modified:
   trunk/Open-ILS/src/extras/import/marc2bre.pl
Log:
more portable "next record id" code

Modified: trunk/Open-ILS/src/extras/import/marc2bre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2bre.pl	2007-10-26 00:45:16 UTC (rev 7934)
+++ trunk/Open-ILS/src/extras/import/marc2bre.pl	2007-10-26 02:51:13 UTC (rev 7935)
@@ -69,8 +69,12 @@
 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;



More information about the open-ils-commits mailing list