1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-29 08:49:50 +02:00

- smarter handling of substitutions :subst: outside of brackets []

This commit is contained in:
David Grudl
2009-03-08 23:27:31 +00:00
parent d0097d6c9c
commit 97969edace
3 changed files with 33 additions and 22 deletions

View File

@@ -36,10 +36,14 @@ dibi::test("UPDATE [database.::table] SET [text]='Hello World'");
// create substitution fallback
function substFallBack($expr)
{
return 'the_' . $expr;
if (defined($expr)) {
return constant($expr);
} else {
return 'the_' . $expr;
}
}
dibi::setSubstFallBack('substFallBack');
dibi::test("UPDATE [:account:user] SET [name]='John Doe'");
// -> UPDATE [the_accountuser] SET [name]='John Doe'
dibi::test("UPDATE [:account:user] SET [name]='John Doe', [active]=:true:");
// -> UPDATE [the_accountuser] SET [name]='John Doe', [active]=1