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:
@@ -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
|
Reference in New Issue
Block a user