mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 13:47:33 +02:00
- added connection directive 'substitutes'
- better ArrayObject handling in DibiTranslator
This commit is contained in:
@@ -98,6 +98,12 @@ class DibiConnection extends DibiObject
|
|||||||
$this->setProfiler(new $class);
|
$this->setProfiler(new $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($config['substitutes'])) {
|
||||||
|
foreach ($config['substitutes'] as $key => $value) {
|
||||||
|
dibi::addSubst($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($config['lazy'])) {
|
if (empty($config['lazy'])) {
|
||||||
$this->connect();
|
$this->connect();
|
||||||
}
|
}
|
||||||
|
@@ -142,6 +142,10 @@ final class DibiTranslator extends DibiObject
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($arg instanceof ArrayObject) {
|
||||||
|
$arg = (array) $arg;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($arg)) {
|
if (is_array($arg)) {
|
||||||
if (is_string(key($arg))) {
|
if (is_string(key($arg))) {
|
||||||
// associative array -> autoselect between SET or VALUES & LIST
|
// associative array -> autoselect between SET or VALUES & LIST
|
||||||
@@ -196,8 +200,11 @@ final class DibiTranslator extends DibiObject
|
|||||||
public function formatValue($value, $modifier)
|
public function formatValue($value, $modifier)
|
||||||
{
|
{
|
||||||
// array processing (with or without modifier)
|
// array processing (with or without modifier)
|
||||||
if (is_array($value) || $value instanceof ArrayObject) {
|
if ($value instanceof ArrayObject) {
|
||||||
|
$value = (array) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($value)) {
|
||||||
$vx = $kx = array();
|
$vx = $kx = array();
|
||||||
switch ($modifier) {
|
switch ($modifier) {
|
||||||
case 'and':
|
case 'and':
|
||||||
|
Reference in New Issue
Block a user