[limb-svn] r6969 - in 3.x/trunk/limb/dbal/src/drivers: mysql mysqli
svn at limb-project.com
svn at limb-project.com
Mon Apr 28 13:41:25 MSD 2008
Author: korchasa
Date: 2008-04-28 13:41:25 +0400 (Mon, 28 Apr 2008)
New Revision: 6969
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6969
Modified:
3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlRecord.class.php
3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlStatement.class.php
3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlTypeInfo.class.php
3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliRecord.class.php
3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliStatement.class.php
3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliTypeInfo.class.php
Log:
-- added implementation for bit column for mysql and mysqli drivers
Modified: 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlRecord.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlRecord.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlRecord.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -2,9 +2,9 @@
/*
* Limb PHP Framework
*
- * @link http://limb-project.com
+ * @link http://limb-project.com
* @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
lmb_require('limb/dbal/src/drivers/lmbDbBaseRecord.class.php');
@@ -27,7 +27,7 @@
{
if(isset($this->properties[$name]))
return $this->properties[$name];
-
+
if(LIMB_UNDEFINED !== $default)
return $default;
}
@@ -63,6 +63,12 @@
$this->properties = array();
}
+ function getBit($name)
+ {
+ $value = $this->get($name);
+ return is_null($value) ? null : bindec($value);
+ }
+
function getInteger($name)
{
$value = $this->get($name);
Modified: 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlStatement.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlStatement.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlStatement.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -25,7 +25,7 @@
$this->statement = $sql;
$this->connection = $connection;
}
-
+
function setConnection($connection)
{
$this->connection = $connection;
@@ -36,6 +36,11 @@
$this->parameters[$name] = 'null';
}
+ function setBit($name, $value)
+ {
+ $this->parameters[$name] = decbin($value);
+ }
+
function setSmallInt($name, $value)
{
$this->parameters[$name] = is_null($value) ? 'null' : intval($value);
Modified: 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlTypeInfo.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlTypeInfo.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysql/lmbMysqlTypeInfo.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -20,7 +20,7 @@
function getNativeToColumnTypeMapping()
{
return array(
- 'bit' => LIMB_DB_TYPE_INTEGER,
+ 'bit' => LIMB_DB_TYPE_BIT,
'tinyint' => LIMB_DB_TYPE_SMALLINT,
'smallint' => LIMB_DB_TYPE_SMALLINT,
'mediumint' => LIMB_DB_TYPE_INTEGER,
Modified: 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliRecord.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliRecord.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliRecord.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -2,9 +2,9 @@
/*
* Limb PHP Framework
*
- * @link http://limb-project.com
+ * @link http://limb-project.com
* @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
lmb_require('limb/dbal/src/drivers/lmbDbBaseRecord.class.php');
@@ -27,7 +27,7 @@
{
if(isset($this->properties[$name]))
return $this->properties[$name];
-
+
if(LIMB_UNDEFINED !== $default)
return $default;
}
@@ -63,6 +63,12 @@
$this->properties = array();
}
+ function getBit($name)
+ {
+ $value = $this->get($name);
+ return is_null($value) ? null : bindec($value);
+ }
+
function getInteger($name)
{
$value = $this->get($name);
Modified: 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliStatement.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliStatement.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliStatement.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -25,7 +25,7 @@
$this->statement = $sql;
$this->connection = $connection;
}
-
+
function setConnection($connection)
{
$this->connection = $connection;
@@ -36,6 +36,11 @@
$this->parameters[$name] = 'null';
}
+ function setBit($name, $value)
+ {
+ $this->parameters[$name] = decbin($value);
+ }
+
function setSmallInt($name, $value)
{
$this->parameters[$name] = is_null($value) ? 'null' : intval($value);
@@ -111,7 +116,7 @@
'null' :
"'" . $this->_escape_string((string) $value) . "'";
}
-
+
protected function _escape_string($string)
{
return mysqli_real_escape_string($this->connection->getConnectionId(), $string);
Modified: 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliTypeInfo.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliTypeInfo.class.php 2008-04-28 09:39:28 UTC (rev 6968)
+++ 3.x/trunk/limb/dbal/src/drivers/mysqli/lmbMysqliTypeInfo.class.php 2008-04-28 09:41:25 UTC (rev 6969)
@@ -20,7 +20,7 @@
function getNativeToColumnTypeMapping()
{
return array(
- 'bit' => LIMB_DB_TYPE_INTEGER,
+ 'bit' => LIMB_DB_TYPE_BIT,
'tinyint' => LIMB_DB_TYPE_SMALLINT,
'smallint' => LIMB_DB_TYPE_SMALLINT,
'mediumint' => LIMB_DB_TYPE_INTEGER,
More information about the limb-svn
mailing list