mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 21:28:02 +02:00
- BYTEA detection fixed
This commit is contained in:
@@ -232,14 +232,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
|||||||
return "'" . sqlite_escape_string($value) . "'";
|
return "'" . sqlite_escape_string($value) . "'";
|
||||||
|
|
||||||
/*case dibi::BINARY: // SQLite 3
|
/*case dibi::BINARY: // SQLite 3
|
||||||
static $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
|
return "X'" . bin2hex((string) $value) . "'";*/
|
||||||
$value = (string) $value;
|
|
||||||
$len = strlen($value);
|
|
||||||
$res = "X'";
|
|
||||||
for ($i = 0; $i < $len; $i++) {
|
|
||||||
$res .= $hex[ord($value[$i]) >> 4] . $hex[ord($value[$i]) & 15];
|
|
||||||
}
|
|
||||||
return $res . "'";*/
|
|
||||||
|
|
||||||
case dibi::IDENTIFIER:
|
case dibi::IDENTIFIER:
|
||||||
return '[' . str_replace('.', '].[', strtr($value, '[]', ' ')) . ']';
|
return '[' . str_replace('.', '].[', strtr($value, '[]', ' ')) . ']';
|
||||||
|
@@ -476,12 +476,12 @@ class DibiColumnInfo extends DibiObject
|
|||||||
public static function detectType($type)
|
public static function detectType($type)
|
||||||
{
|
{
|
||||||
static $patterns = array(
|
static $patterns = array(
|
||||||
|
'BYTEA|BLOB|BIN' => dibi::BINARY,
|
||||||
'BYTE|COUNTER|SERIAL|INT|LONG' => dibi::INTEGER,
|
'BYTE|COUNTER|SERIAL|INT|LONG' => dibi::INTEGER,
|
||||||
'CURRENCY|REAL|MONEY|FLOAT|DOUBLE|DECIMAL|NUMERIC|NUMBER' => dibi::FLOAT,
|
'CURRENCY|REAL|MONEY|FLOAT|DOUBLE|DECIMAL|NUMERIC|NUMBER' => dibi::FLOAT,
|
||||||
'^TIME$' => dibi::TIME,
|
'^TIME$' => dibi::TIME,
|
||||||
'TIME' => dibi::DATETIME, // DATETIME, TIMESTAMP
|
'TIME' => dibi::DATETIME, // DATETIME, TIMESTAMP
|
||||||
'YEAR|DATE' => dibi::DATE,
|
'YEAR|DATE' => dibi::DATE,
|
||||||
'BYTEA|BLOB|BIN' => dibi::BINARY,
|
|
||||||
'BOOL|BIT' => dibi::BOOL,
|
'BOOL|BIT' => dibi::BOOL,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user