cvs: pear /MDB2/MDB2/Driver/Datatype Common.php ibase.php mysql.php mysqli.php oci8.php
| From: | Lorenzo Alberton | Date: | Wed, 18 Jan 2006 15:18:15 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype Common.php ibase.php mysql.php mysqli.php oci8.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-37633@lists.php.net to get a copy of this message | ||
quipo Wed Jan 18 15:18:15 2006 UTC
Modified files:
/pear/MDB2/MDB2/Driver/Datatype Common.php ibase.php mysql.php
mysqli.php oci8.php
Log:
Use INT/TINYINT/SMALLINT by default instead of CHAR(1) for the boolean datatype
BC BREAK!!! Please test...
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.51&r2=1.52&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/Common.php
diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.51
pear/MDB2/MDB2/Driver/Datatype/Common.php:1.52
--- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.51 Mon Jan 16 12:55:55 2006
+++ pear/MDB2/MDB2/Driver/Datatype/Common.php Wed Jan 18 15:18:14 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.51 2006/01/16 12:55:55 lsmith Exp $
+// $Id: Common.php,v 1.52 2006/01/18 15:18:14 quipo Exp $
require_once 'MDB2/LOB.php';
@@ -139,7 +139,7 @@
case 'integer':
return intval($value);
case 'boolean':
- return $value == 'Y';
+ return !empty($value);
case 'decimal':
return $value;
case 'float':
@@ -305,7 +305,7 @@
case 'integer':
return 'INT';
case 'boolean':
- return 'CHAR (1)';
+ return 'INT';
case 'date':
return 'CHAR ('.strlen('YYYY-MM-DD').')';
case 'time':
@@ -1127,10 +1127,7 @@
*/
function _quoteBoolean($value, $quote)
{
- if (!$quote) {
- return ($value ? 'Y' : 'N');
- }
- return ($value ? "'Y'" : "'N'");
+ return ($value ? 1 : 0);
}
// }}}
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.58&r2=1.59&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php
diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.58 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.59
--- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.58 Mon Jan 16 14:34:35 2006
+++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Wed Jan 18 15:18:14 2006
@@ -44,7 +44,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: ibase.php,v 1.58 2006/01/16 14:34:35 quipo Exp $
+// $Id: ibase.php,v 1.59 2006/01/18 15:18:14 quipo Exp $
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -131,7 +131,7 @@
case 'integer':
return 'INT';
case 'boolean':
- return 'CHAR (1)';
+ return 'SMALLINT';
case 'date':
return 'DATE';
case 'time':
@@ -307,9 +307,6 @@
case 'varchar':
case 'cstring':
$type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- }
break;
case 'date':
$type[] = 'date';
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/mysql.php?r1=1.30&r2=1.31&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/mysql.php
diff -u pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.30 pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.31
--- pear/MDB2/MDB2/Driver/Datatype/mysql.php:1.30 Mon Jan 16 12:55:55 2006
+++ pear/MDB2/MDB2/Driver/Datatype/mysql.php Wed Jan 18 15:18:14 2006
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.30 2006/01/16 12:55:55 lsmith Exp $
+// $Id: mysql.php,v 1.31 2006/01/18 15:18:14 quipo Exp $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -135,7 +135,7 @@
}
return 'INT';
case 'boolean':
- return 'CHAR (1)';
+ return 'TINYINT';
case 'date':
return 'DATE';
case 'time':
@@ -274,12 +274,6 @@
case 'char':
case 'varchar':
$type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/[is|has]/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
break;
case 'enum':
preg_match_all('/\'.+\'/U', $field['type'], $matches);
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/mysqli.php?r1=1.26&r2=1.27&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/mysqli.php
diff -u pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.26
pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.27
--- pear/MDB2/MDB2/Driver/Datatype/mysqli.php:1.26 Mon Jan 16 12:55:55 2006
+++ pear/MDB2/MDB2/Driver/Datatype/mysqli.php Wed Jan 18 15:18:14 2006
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: mysqli.php,v 1.26 2006/01/16 12:55:55 lsmith Exp $
+// $Id: mysqli.php,v 1.27 2006/01/18 15:18:14 quipo Exp $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -135,7 +135,7 @@
}
return 'INT';
case 'boolean':
- return 'CHAR (1)';
+ return 'TINYINT';
case 'date':
return 'DATE';
case 'time':
@@ -274,12 +274,6 @@
case 'char':
case 'varchar':
$type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/[is|has]/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
break;
case 'enum':
preg_match_all('/\'.+\'/U', $field['type'], $matches);
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Datatype/oci8.php?r1=1.37&r2=1.38&diff_format=u
Index: pear/MDB2/MDB2/Driver/Datatype/oci8.php
diff -u pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.37 pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.38
--- pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.37 Mon Jan 16 12:55:55 2006
+++ pear/MDB2/MDB2/Driver/Datatype/oci8.php Wed Jan 18 15:18:14 2006
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
-// $Id: oci8.php,v 1.37 2006/01/16 12:55:55 lsmith Exp $
+// $Id: oci8.php,v 1.38 2006/01/18 15:18:14 quipo Exp $
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -125,7 +125,7 @@
case 'integer':
return 'INT';
case 'boolean':
- return 'CHAR (1)';
+ return 'INTEGER(1)';
case 'date':
case 'time':
case 'timestamp':