mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
- improved examples
This commit is contained in:
@@ -10,12 +10,14 @@ dibi::connect(array(
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
// create new substitution :blog: ==> wp_
|
||||
dibi::addSubst('blog', 'wp_');
|
||||
|
||||
|
||||
// generate and dump SQL
|
||||
dibi::test("UPDATE [:blog:items] SET [text]='Hello World'");
|
||||
// -> UPDATE [wp_items] SET [text]='Hello World'
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,22 +25,20 @@ dibi::test("UPDATE [:blog:items] SET [text]='Hello World'");
|
||||
// create new substitution :: (empty) ==> my_
|
||||
dibi::addSubst('', 'my_');
|
||||
|
||||
|
||||
// generate and dump SQL
|
||||
dibi::test("UPDATE [database.::table] SET [text]='Hello World'");
|
||||
// -> UPDATE [database].[my_table] SET [text]='Hello World'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// create substitution fallback
|
||||
function substFallBack($expr)
|
||||
{
|
||||
return 'the_' . $expr;
|
||||
}
|
||||
|
||||
// create substitution fallback
|
||||
dibi::setSubstFallBack('substFallBack');
|
||||
|
||||
|
||||
// generate and dump SQL
|
||||
dibi::test("UPDATE [:account:user] SET [name]='John Doe'");
|
||||
// -> UPDATE [the_accountuser] SET [name]='John Doe'
|
||||
|
Reference in New Issue
Block a user