mirror of
https://github.com/dg/dibi.git
synced 2025-07-31 19:30:30 +02:00
examples: dibi:: replaced with $dibi->
This commit is contained in:
@@ -12,7 +12,7 @@ if (@!include __DIR__ . '/../vendor/autoload.php') {
|
||||
}
|
||||
|
||||
|
||||
dibi::connect([
|
||||
$dibi = new Dibi\Connection([
|
||||
'driver' => 'sqlite3',
|
||||
'database' => 'data/sample.s3db',
|
||||
]);
|
||||
@@ -28,7 +28,7 @@ $bar = 2;
|
||||
$name = $cond1 ? 'K%' : null;
|
||||
|
||||
// if & end
|
||||
dibi::test('
|
||||
$dibi->test('
|
||||
SELECT *
|
||||
FROM customers
|
||||
%if', isset($name), 'WHERE name LIKE ?', $name, '%end'
|
||||
@@ -37,7 +37,7 @@ dibi::test('
|
||||
|
||||
|
||||
// if & else & (optional) end
|
||||
dibi::test('
|
||||
$dibi->test('
|
||||
SELECT *
|
||||
FROM people
|
||||
WHERE id > 0
|
||||
@@ -48,7 +48,7 @@ dibi::test('
|
||||
|
||||
|
||||
// nested condition
|
||||
dibi::test('
|
||||
$dibi->test('
|
||||
SELECT *
|
||||
FROM customers
|
||||
WHERE
|
||||
@@ -60,7 +60,7 @@ dibi::test('
|
||||
|
||||
|
||||
// IF()
|
||||
dibi::test('UPDATE products SET', [
|
||||
'price' => ['IF(price_fixed, price, ?)', 123],
|
||||
$dibi->test('UPDATE products SET', [
|
||||
'price' => $dibi->expression('IF(price_fixed, price, ?)', 123),
|
||||
]);
|
||||
// -> SELECT * FROM customers WHERE LIMIT 10
|
||||
|
Reference in New Issue
Block a user