mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
mysql handler: _FIELD_TYPES aliases, new type 'null' added
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
* mySQL Handler
|
* mySQL Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||||
* $Revision: 1.50 $
|
* $Revision: 1.51 $
|
||||||
* $Date: 2009-09-10 15:24:57 $
|
* $Date: 2009-09-10 19:13:39 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(defined('MYSQL_LIGHT'))
|
if(defined('MYSQL_LIGHT'))
|
||||||
@@ -46,7 +46,7 @@ elseif(defined('E107_INSTALL')) //TODO Remove the need for this if possible
|
|||||||
define('MPREFIX', $mySQLprefix);
|
define('MPREFIX', $mySQLprefix);
|
||||||
|
|
||||||
$sql = new db;
|
$sql = new db;
|
||||||
$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -63,8 +63,8 @@ $db_ConnectionID = NULL; // Stores ID for the first DB connection used - which s
|
|||||||
*
|
*
|
||||||
* @package e107
|
* @package e107
|
||||||
* @category e107_handlers
|
* @category e107_handlers
|
||||||
* @version $Revision: 1.50 $
|
* @version $Revision: 1.51 $
|
||||||
* @author $Author: e107coders $
|
* @author $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class e_db_mysql {
|
class e_db_mysql {
|
||||||
@@ -88,8 +88,10 @@ class e_db_mysql {
|
|||||||
var $mySQLtableListLanguage = array(); // Db table list for the currently selected language
|
var $mySQLtableListLanguage = array(); // Db table list for the currently selected language
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public MySQL Charset
|
* MySQL Charset
|
||||||
**/
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $mySQLcharset;
|
public $mySQLcharset;
|
||||||
|
|
||||||
var $total_results; // Total number of results
|
var $total_results; // Total number of results
|
||||||
@@ -493,24 +495,24 @@ class e_db_mysql {
|
|||||||
global $db_ConnectionID;
|
global $db_ConnectionID;
|
||||||
$this->mySQLaccess = $db_ConnectionID;
|
$this->mySQLaccess = $db_ConnectionID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($arg)) // Remove the need for a separate db_UpdateArray() function.
|
if (is_array($arg)) // Remove the need for a separate db_UpdateArray() function.
|
||||||
{
|
{
|
||||||
$new_data = '';
|
$new_data = '';
|
||||||
if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data']))
|
if(!isset($arg['_FIELD_TYPES']) && !isset($arg['data']))
|
||||||
{
|
{
|
||||||
//Convert data if not using 'new' format (is this needed?)
|
//Convert data if not using 'new' format (is this needed?)
|
||||||
$_tmp = array();
|
$_tmp = array();
|
||||||
if(isset($arg['WHERE']))
|
if(isset($arg['WHERE']))
|
||||||
{
|
{
|
||||||
$_tmp['WHERE'] = $arg['WHERE'];
|
$_tmp['WHERE'] = $arg['WHERE'];
|
||||||
unset($arg['WHERE']);
|
unset($arg['WHERE']);
|
||||||
}
|
}
|
||||||
$_tmp['data'] = $arg;
|
$_tmp['data'] = $arg;
|
||||||
$arg = $_tmp;
|
$arg = $_tmp;
|
||||||
unset($_tmp);
|
unset($_tmp);
|
||||||
}
|
}
|
||||||
if(!isset($arg['data'])) { return false; }
|
if(!isset($arg['data'])) { return false; }
|
||||||
|
|
||||||
$fieldTypes = $this->_getTypes($arg);
|
$fieldTypes = $this->_getTypes($arg);
|
||||||
foreach ($arg['data'] as $fn => $fv)
|
foreach ($arg['data'] as $fn => $fv)
|
||||||
@@ -570,6 +572,7 @@ class e_db_mysql {
|
|||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 'int':
|
case 'int':
|
||||||
|
case 'integer':
|
||||||
return (int)$fieldValue;
|
return (int)$fieldValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -577,9 +580,14 @@ class e_db_mysql {
|
|||||||
return $fieldValue;
|
return $fieldValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'str':
|
||||||
case 'string':
|
case 'string':
|
||||||
return "'{$fieldValue}'";
|
return "'{$fieldValue}'";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'null':
|
||||||
|
return ($fieldValue ? "'{$fieldValue}'" : 'NULL');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'escape':
|
case 'escape':
|
||||||
return "'".mysql_real_escape_string($fieldValue)."'";
|
return "'".mysql_real_escape_string($fieldValue)."'";
|
||||||
|
Reference in New Issue
Block a user