1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-30 09:19:48 +02:00

- REWRITTEN DibiTranslar

- allows modifiers inside SQL -> modifiers become placeholders
- new modifier %ex - expand array
- new modifiers %or and %and
- changed interface IDibiVariable and implementation DibiVariable
This commit is contained in:
David Grudl
2008-01-18 07:35:45 +00:00
parent f6b781f12d
commit 18e02de80c
7 changed files with 177 additions and 197 deletions

View File

@@ -78,7 +78,7 @@ class dibi
// special
FIELD_COUNTER = 'C', // counter or autoincrement, is integer
IDENTIFIER = 'I',
IDENTIFIER = 'n',
// dibi version
VERSION = '0.9 (Revision: $WCREV$, Date: $WCDATE$)';
@@ -246,8 +246,7 @@ class dibi
*/
public static function query($args)
{
if (!is_array($args)) $args = func_get_args();
$args = func_get_args();
return self::getConnection()->query($args);
}
@@ -274,8 +273,7 @@ class dibi
*/
public static function test($args)
{
if (!is_array($args)) $args = func_get_args();
$args = func_get_args();
return self::getConnection()->test($args);
}
@@ -290,8 +288,7 @@ class dibi
*/
public static function fetch($args)
{
if (!is_array($args)) $args = func_get_args();
$args = func_get_args();
return self::getConnection()->query($args)->fetch();
}
@@ -306,8 +303,7 @@ class dibi
*/
public static function fetchAll($args)
{
if (!is_array($args)) $args = func_get_args();
$args = func_get_args();
return self::getConnection()->query($args)->fetchAll();
}
@@ -322,8 +318,7 @@ class dibi
*/
public static function fetchSingle($args)
{
if (!is_array($args)) $args = func_get_args();
$args = func_get_args();
return self::getConnection()->query($args)->fetchSingle();
}
@@ -446,7 +441,7 @@ class dibi
public static function date($date = NULL)
{
$var = self::datetime($date);
$var->type = dibi::FIELD_DATE;
$var->modifier = dibi::FIELD_DATE;
return $var;
}
@@ -578,7 +573,7 @@ class dibi
$sql = preg_replace("#\n{2,}#", "\n", $sql);
// syntax highlight
$sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])($keywords1)(?=[\\s,)])|(?<=[\\s,(])($keywords2)(?=[\\s,)])#i", array('dibi', 'highlightCallback'), $sql);
$sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])($keywords1)(?=[\\s,)])|(?<=[\\s,(=])($keywords2)(?=[\\s,)=])#i", array('dibi', 'highlightCallback'), $sql);
$sql = trim($sql);
echo '<pre class="dump">', $sql, "</pre>\n";
}