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

- improved examples

This commit is contained in:
David Grudl
2008-10-28 02:06:55 +00:00
parent ab892255d3
commit 7a6cdc8afa
14 changed files with 105 additions and 45 deletions

View File

@@ -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'