mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 13:17:58 +02:00
added JSON support [Closes #269]
This commit is contained in:
@@ -189,6 +189,7 @@ class Helpers
|
|||||||
'TIME' => Type::DATETIME, // DATETIME, TIMESTAMP
|
'TIME' => Type::DATETIME, // DATETIME, TIMESTAMP
|
||||||
'DATE' => Type::DATE,
|
'DATE' => Type::DATE,
|
||||||
'BOOL' => Type::BOOL,
|
'BOOL' => Type::BOOL,
|
||||||
|
'JSON' => Type::JSON,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($patterns as $s => $val) {
|
foreach ($patterns as $s => $val) {
|
||||||
|
@@ -495,6 +495,9 @@ class Result implements IDataSource
|
|||||||
|
|
||||||
} elseif ($type === Type::BINARY) {
|
} elseif ($type === Type::BINARY) {
|
||||||
$row[$key] = $this->getResultDriver()->unescapeBinary($value);
|
$row[$key] = $this->getResultDriver()->unescapeBinary($value);
|
||||||
|
|
||||||
|
} elseif ($type === Type::JSON) {
|
||||||
|
$row[$key] = json_decode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ class Type
|
|||||||
public const
|
public const
|
||||||
TEXT = 's', // as 'string'
|
TEXT = 's', // as 'string'
|
||||||
BINARY = 'bin',
|
BINARY = 'bin',
|
||||||
|
JSON = 'json',
|
||||||
BOOL = 'b',
|
BOOL = 'b',
|
||||||
INTEGER = 'i',
|
INTEGER = 'i',
|
||||||
FLOAT = 'f',
|
FLOAT = 'f',
|
||||||
|
Reference in New Issue
Block a user