cvs: pear /MDB2/MDB2/Driver fbsql.php mssql.php mysql.php sqlite.php /MDB2/MDB2/Driver/Manager fbsql.php mssql.php mysql.php sqlite.php
| From: | Lukas Smith | Date: | Wed, 07 Apr 2004 21:15:31 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver fbsql.php mssql.php mysql.php sqlite.php /MDB2/MDB2/Driver/Manager fbsql.php mssql.php mysql.php sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-18002@lists.php.net to get a copy of this message | ||
lsmith Wed Apr 7 17:15:31 2004 EDT
Modified files:
/pear/MDB2/MDB2/Driver fbsql.php mssql.php mysql.php sqlite.php
/pear/MDB2/MDB2/Driver/Manager fbsql.php mssql.php mysql.php
sqlite.php
Log:
- added seqname_col_name option to modify the column name used inside sequence emulation tables
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/fbsql.php?r1=1.6&r2=1.7&ty=u Index: pear/MDB2/MDB2/Driver/fbsql.php diff -u pear/MDB2/MDB2/Driver/fbsql.php:1.6 pear/MDB2/MDB2/Driver/fbsql.php:1.7 --- pear/MDB2/MDB2/Driver/fbsql.php:1.6 Wed Mar 10 09:41:00 2004 +++ pear/MDB2/MDB2/Driver/fbsql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.6 2004/03/10 14:41:00 lsmith Exp $ +// $Id: fbsql.php,v 1.7 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -446,7 +446,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result = $this->query("INSERT INTO $sequence_name (dummy) VALUES (1)"); + $result = $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -466,7 +466,7 @@ return $result; } $value = $this->queryOne("SELECT UNIQUE FROM $sequence_name", 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mssql.php?r1=1.7&r2=1.8&ty=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.7 pear/MDB2/MDB2/Driver/mssql.php:1.8 --- pear/MDB2/MDB2/Driver/mssql.php:1.7 Wed Mar 10 09:41:00 2004 +++ pear/MDB2/MDB2/Driver/mssql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.7 2004/03/10 14:41:00 lsmith Exp $ +// $Id: mssql.php,v 1.8 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -491,7 +491,7 @@ return $result; } $value = $this->queryOne("SELECT @@IDENTITY FROM $sequence_name", 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values'; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mysql.php?r1=1.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.8 pear/MDB2/MDB2/Driver/mysql.php:1.9 --- pear/MDB2/MDB2/Driver/mysql.php:1.8 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/mysql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.8 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mysql.php,v 1.9 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -668,7 +668,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $result =& $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -688,7 +688,7 @@ return $result; } $value = $this->queryOne('SELECT LAST_INSERT_ID()', 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -708,7 +708,7 @@ function currID($seq_name) { $sequence_name = $this->getSequenceName($seq_name); - return $this->queryOne("SELECT MAX(sequence) FROM $sequence_name", 'integer'); + return $this->queryOne("SELECT MAX(".$this->options['seqname_col_name'].") FROM $sequence_name", 'integer'); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.10 pear/MDB2/MDB2/Driver/sqlite.php:1.11 --- pear/MDB2/MDB2/Driver/sqlite.php:1.10 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/sqlite.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.10 2004/03/28 12:12:57 lsmith Exp $ +// $Id: sqlite.php,v 1.11 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -606,7 +606,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $result = $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -626,7 +626,7 @@ return $result; } $value = @sqlite_last_insert_rowid($this->connection); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -646,7 +646,7 @@ function currID($seq_name) { $sequence_name = $this->getSequenceName($seq_name); - return $this->queryOne("SELECT MAX(sequence) FROM $sequence_name", 'integer'); + return $this->queryOne("SELECT MAX(".$this->options['seqname_col_name'].") FROM $sequence_name", 'integer'); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/fbsql.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/fbsql.php diff -u pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.4 pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.4 Fri Mar 5 10:56:03 2004 +++ pear/MDB2/MDB2/Driver/Manager/fbsql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.4 2004/03/05 15:56:03 lsmith Exp $ +// $Id: fbsql.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -560,16 +560,17 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - $res = $db->query("CREATE TABLE $sequence_name - (sequence INTEGER DEFAULT UNIQUE, dummy int, PRIMARY KEY(sequence))"); - $res = $db->query("set unique = 1 for $sequence_name"); + $seqname_col_name = $db->options['seqname_col_name']; + $query = "CREATE TABLE $sequence_name ($seqname_col_name INTEGER DEFAULT UNIQUE, PRIMARY KEY($seqname_col_name))"; + $res = $db->query($query); + $res = $db->query("SET UNIQUE = 1 FOR $sequence_name"); if (MDB2::isError($res)) { return $res; } if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/mssql.php?r1=1.3&r2=1.4&ty=u Index: pear/MDB2/MDB2/Driver/Manager/mssql.php diff -u pear/MDB2/MDB2/Driver/Manager/mssql.php:1.3 pear/MDB2/MDB2/Driver/Manager/mssql.php:1.4 --- pear/MDB2/MDB2/Driver/Manager/mssql.php:1.3 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/Manager/mssql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.3 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mssql.php,v 1.4 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -317,7 +317,8 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - return $db->query("CREATE TABLE $sequence_name (sequence INT NOT NULL IDENTITY($start,1) PRIMARY KEY CLUSTERED)"); + $query = "CREATE TABLE $sequence_name (".$db->options['seqname_col_name']." INT NOT NULL IDENTITY($start,1) PRIMARY KEY CLUSTERED)"; + return $db->query($query); } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/mysql.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/mysql.php diff -u pear/MDB2/MDB2/Driver/Manager/mysql.php:1.4 pear/MDB2/MDB2/Driver/Manager/mysql.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/mysql.php:1.4 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/Manager/mysql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.4 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mysql.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -628,12 +628,13 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); + $seqname_col_name = $db->options['seqname_col_name']; $result = $this->_verifyTableType($db->options['default_table_type']); if (MDB2::isError($result)) { return $result; } $res = $db->query("CREATE TABLE $sequence_name". - "(sequence INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (sequence))". + "($seqname_col_name INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ($seqname_col_name))". (strlen($db->options['default_table_type']) ? ' TYPE='.$db->options['default_table_type'] : '')); if (MDB2::isError($res)) { return $res; @@ -641,7 +642,7 @@ if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/sqlite.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/sqlite.php diff -u pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.4 pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.4 Tue Mar 2 05:31:58 2004 +++ pear/MDB2/MDB2/Driver/Manager/sqlite.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.4 2004/03/02 10:31:58 lsmith Exp $ +// $Id: sqlite.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -425,7 +425,8 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - $query = "CREATE TABLE $sequence_name (sequence INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)"; + $seqname_col_name = $db->options['seqname_col_name']; + $query = "CREATE TABLE $sequence_name ($seqname_col_name INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)"; $res = $db->query($query); if (MDB2::isError($res)) { return $res; @@ -433,7 +434,7 @@ if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; }
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/fbsql.php?r1=1.6&r2=1.7&ty=u Index: pear/MDB2/MDB2/Driver/fbsql.php diff -u pear/MDB2/MDB2/Driver/fbsql.php:1.6 pear/MDB2/MDB2/Driver/fbsql.php:1.7 --- pear/MDB2/MDB2/Driver/fbsql.php:1.6 Wed Mar 10 09:41:00 2004 +++ pear/MDB2/MDB2/Driver/fbsql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.6 2004/03/10 14:41:00 lsmith Exp $ +// $Id: fbsql.php,v 1.7 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -446,7 +446,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result = $this->query("INSERT INTO $sequence_name (dummy) VALUES (1)"); + $result = $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -466,7 +466,7 @@ return $result; } $value = $this->queryOne("SELECT UNIQUE FROM $sequence_name", 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mssql.php?r1=1.7&r2=1.8&ty=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.7 pear/MDB2/MDB2/Driver/mssql.php:1.8 --- pear/MDB2/MDB2/Driver/mssql.php:1.7 Wed Mar 10 09:41:00 2004 +++ pear/MDB2/MDB2/Driver/mssql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.7 2004/03/10 14:41:00 lsmith Exp $ +// $Id: mssql.php,v 1.8 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -491,7 +491,7 @@ return $result; } $value = $this->queryOne("SELECT @@IDENTITY FROM $sequence_name", 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values'; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mysql.php?r1=1.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.8 pear/MDB2/MDB2/Driver/mysql.php:1.9 --- pear/MDB2/MDB2/Driver/mysql.php:1.8 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/mysql.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.8 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mysql.php,v 1.9 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -668,7 +668,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $result =& $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -688,7 +688,7 @@ return $result; } $value = $this->queryOne('SELECT LAST_INSERT_ID()', 'integer'); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -708,7 +708,7 @@ function currID($seq_name) { $sequence_name = $this->getSequenceName($seq_name); - return $this->queryOne("SELECT MAX(sequence) FROM $sequence_name", 'integer'); + return $this->queryOne("SELECT MAX(".$this->options['seqname_col_name'].") FROM $sequence_name", 'integer'); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.10 pear/MDB2/MDB2/Driver/sqlite.php:1.11 --- pear/MDB2/MDB2/Driver/sqlite.php:1.10 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/sqlite.php Wed Apr 7 17:15:31 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.10 2004/03/28 12:12:57 lsmith Exp $ +// $Id: sqlite.php,v 1.11 2004/04/07 21:15:31 lsmith Exp $ // /** @@ -606,7 +606,7 @@ { $sequence_name = $this->getSequenceName($seq_name); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result = $this->query("INSERT INTO $sequence_name (sequence) VALUES (NULL)"); + $result = $this->query("INSERT INTO $sequence_name VALUES (NULL)"); $this->popExpect(); if (MDB2::isError($result)) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { @@ -626,7 +626,7 @@ return $result; } $value = @sqlite_last_insert_rowid($this->connection); - $result = $this->query("DELETE FROM $sequence_name WHERE sequence < $value"); + $result = $this->query("DELETE FROM $sequence_name WHERE ".$this->options['seqname_col_name']." < $value"); if (MDB2::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -646,7 +646,7 @@ function currID($seq_name) { $sequence_name = $this->getSequenceName($seq_name); - return $this->queryOne("SELECT MAX(sequence) FROM $sequence_name", 'integer'); + return $this->queryOne("SELECT MAX(".$this->options['seqname_col_name'].") FROM $sequence_name", 'integer'); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/fbsql.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/fbsql.php diff -u pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.4 pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/fbsql.php:1.4 Fri Mar 5 10:56:03 2004 +++ pear/MDB2/MDB2/Driver/Manager/fbsql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.4 2004/03/05 15:56:03 lsmith Exp $ +// $Id: fbsql.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -560,16 +560,17 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - $res = $db->query("CREATE TABLE $sequence_name - (sequence INTEGER DEFAULT UNIQUE, dummy int, PRIMARY KEY(sequence))"); - $res = $db->query("set unique = 1 for $sequence_name"); + $seqname_col_name = $db->options['seqname_col_name']; + $query = "CREATE TABLE $sequence_name ($seqname_col_name INTEGER DEFAULT UNIQUE, PRIMARY KEY($seqname_col_name))"; + $res = $db->query($query); + $res = $db->query("SET UNIQUE = 1 FOR $sequence_name"); if (MDB2::isError($res)) { return $res; } if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/mssql.php?r1=1.3&r2=1.4&ty=u Index: pear/MDB2/MDB2/Driver/Manager/mssql.php diff -u pear/MDB2/MDB2/Driver/Manager/mssql.php:1.3 pear/MDB2/MDB2/Driver/Manager/mssql.php:1.4 --- pear/MDB2/MDB2/Driver/Manager/mssql.php:1.3 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/Manager/mssql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.3 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mssql.php,v 1.4 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -317,7 +317,8 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - return $db->query("CREATE TABLE $sequence_name (sequence INT NOT NULL IDENTITY($start,1) PRIMARY KEY CLUSTERED)"); + $query = "CREATE TABLE $sequence_name (".$db->options['seqname_col_name']." INT NOT NULL IDENTITY($start,1) PRIMARY KEY CLUSTERED)"; + return $db->query($query); } // }}} http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/mysql.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/mysql.php diff -u pear/MDB2/MDB2/Driver/Manager/mysql.php:1.4 pear/MDB2/MDB2/Driver/Manager/mysql.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/mysql.php:1.4 Sun Mar 28 07:12:57 2004 +++ pear/MDB2/MDB2/Driver/Manager/mysql.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.4 2004/03/28 12:12:57 lsmith Exp $ +// $Id: mysql.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -628,12 +628,13 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); + $seqname_col_name = $db->options['seqname_col_name']; $result = $this->_verifyTableType($db->options['default_table_type']); if (MDB2::isError($result)) { return $result; } $res = $db->query("CREATE TABLE $sequence_name". - "(sequence INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (sequence))". + "($seqname_col_name INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ($seqname_col_name))". (strlen($db->options['default_table_type']) ? ' TYPE='.$db->options['default_table_type'] : '')); if (MDB2::isError($res)) { return $res; @@ -641,7 +642,7 @@ if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Manager/sqlite.php?r1=1.4&r2=1.5&ty=u Index: pear/MDB2/MDB2/Driver/Manager/sqlite.php diff -u pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.4 pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.5 --- pear/MDB2/MDB2/Driver/Manager/sqlite.php:1.4 Tue Mar 2 05:31:58 2004 +++ pear/MDB2/MDB2/Driver/Manager/sqlite.php Wed Apr 7 17:15:31 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.4 2004/03/02 10:31:58 lsmith Exp $ +// $Id: sqlite.php,v 1.5 2004/04/07 21:15:31 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -425,7 +425,8 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $sequence_name = $db->getSequenceName($seq_name); - $query = "CREATE TABLE $sequence_name (sequence INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)"; + $seqname_col_name = $db->options['seqname_col_name']; + $query = "CREATE TABLE $sequence_name ($seqname_col_name INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)"; $res = $db->query($query); if (MDB2::isError($res)) { return $res; @@ -433,7 +434,7 @@ if ($start == 1) { return MDB2_OK; } - $res = $db->query("INSERT INTO $sequence_name (sequence) VALUES (".($start-1).')'); + $res = $db->query("INSERT INTO $sequence_name VALUES (".($start-1).')'); if (!MDB2::isError($res)) { return MDB2_OK; }