cvs: pear /MDB2/MDB2/Driver/Datatype mysql.php mysqli.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 10 Jun 2005 15:54:10 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype mysql.php mysqli.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32464@lists.php.net to get a copy of this message | ||
dufuz Fri Jun 10 11:54:10 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver/Datatype mysqli.php mysql.php
Log:
Implement auto increment support in mysql(i)
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mysqli.php?r1=1.7&r2=1.8&ty=u
Index: pear/MDB2/MDB2/Driver/Datatype/mysqli.php
diff -u pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.7 pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.8
--- pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.7 Mon May 23 15:33:32 2005
+++ pear/MDB2/MDB2/Driver/Datatype/mysqli.php Fri Jun 10 11:54:09 2005
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: mysqli.php,v 1.7 2005/05/23 19:33:32 lsmith Exp $
+// $Id: mysqli.php,v 1.8 2005/06/10 15:54:09 dufuz Exp $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -89,11 +89,21 @@
function _getIntegerDeclaration($name, $field)
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
+
+ if (isset($field['autoincrement'])) {
+ $autoinc = ' AUTO_INCREMENT';
+ if ($field['autoincrement'] > '1') {
+ $autoinc .= ' = ' . $field['autoincrement'];
+ }
+ } else {
+ $autoinc = '';
+ }
+
$unsigned = (isset($field['unsigned']) && $field['unsigned']) ?
' UNSIGNED' : '';
$default = isset($field['default']) ? ' DEFAULT '.
$this->quote($field['default'], 'integer') : '';
$notnull = (isset($field['notnull']) && $field['notnull']) ?
' NOT NULL' : '';
- return $name.' INT'.$unsigned.$default.$notnull;
+ return $name.' INT'.$unsigned.$default.$notnull.$autoinc;
}
// }}}
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.14&r2=1.15&ty=u
Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php
diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.14 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.15
--- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.14 Tue Jun 7 06:12:16 2005
+++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Fri Jun 10 11:54:10 2005
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.14 2005/06/07 10:12:16 lsmith Exp $
+// $Id: mysql.php,v 1.15 2005/06/10 15:54:10 dufuz Exp $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -89,11 +89,21 @@
function _getIntegerDeclaration($name, $field)
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
+
+ if (isset($field['autoincrement'])) {
+ $autoinc = ' AUTO_INCREMENT';
+ if ($field['autoincrement'] > '1') {
+ $autoinc .= ' = ' . $field['autoincrement'];
+ }
+ } else {
+ $autoinc = '';
+ }
+
$unsigned = (isset($field['unsigned']) && $field['unsigned']) ?
' UNSIGNED' : '';
$default = isset($field['default']) ? ' DEFAULT '.
$this->quote($field['default'], 'integer') : '';
$notnull = (isset($field['notnull']) && $field['notnull']) ?
' NOT NULL' : '';
- return $name.' INT'.$unsigned.$default.$notnull;
+ return $name.' INT'.$unsigned.$default.$notnull.$autoinc;
}
// }}}