mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
- DibiTranslator: added brackets for %and %or (thanks to Jiri Sutera)
- DibiMySqlDriver: added common error constants
This commit is contained in:
@@ -693,7 +693,7 @@ class dibi
|
|||||||
static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|TRUE|FALSE';
|
static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|TRUE|FALSE';
|
||||||
|
|
||||||
// insert new lines
|
// insert new lines
|
||||||
$sql = ' ' . $sql;
|
$sql = " $sql ";
|
||||||
$sql = preg_replace("#(?<=[\\s,(])($keywords1)(?=[\\s,)])#i", "\n\$1", $sql);
|
$sql = preg_replace("#(?<=[\\s,(])($keywords1)(?=[\\s,)])#i", "\n\$1", $sql);
|
||||||
|
|
||||||
// reduce spaces
|
// reduce spaces
|
||||||
|
@@ -43,6 +43,10 @@
|
|||||||
*/
|
*/
|
||||||
class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||||
{
|
{
|
||||||
|
const ERROR_ACCESS_DENIED = 1045;
|
||||||
|
const ERROR_DUPLICATE_ENTRY = 1062;
|
||||||
|
const ERROR_DATA_TRUNCATED = 1265;
|
||||||
|
|
||||||
/** @var resource Connection resource */
|
/** @var resource Connection resource */
|
||||||
private $connection;
|
private $connection;
|
||||||
|
|
||||||
|
@@ -43,6 +43,10 @@
|
|||||||
*/
|
*/
|
||||||
class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||||
{
|
{
|
||||||
|
const ERROR_ACCESS_DENIED = 1045;
|
||||||
|
const ERROR_DUPLICATE_ENTRY = 1062;
|
||||||
|
const ERROR_DATA_TRUNCATED = 1265;
|
||||||
|
|
||||||
/** @var mysqli Connection resource */
|
/** @var mysqli Connection resource */
|
||||||
private $connection;
|
private $connection;
|
||||||
|
|
||||||
|
@@ -234,7 +234,7 @@ final class DibiTranslator extends DibiObject
|
|||||||
$vx[] = $this->formatValue($v, 'ex');
|
$vx[] = $this->formatValue($v, 'ex');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return implode(' ' . strtoupper($modifier) . ' ', $vx);
|
return '(' . implode(') ' . strtoupper($modifier) . ' (', $vx) . ')';
|
||||||
|
|
||||||
case 'n': // identifier names
|
case 'n': // identifier names
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
|
Reference in New Issue
Block a user