1
0
mirror of https://github.com/dg/dibi.git synced 2025-09-01 18:12:51 +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

@@ -12,23 +12,19 @@ dibi::connect(array(
// no limit
$res = dibi::query('SELECT * FROM [products]');
foreach ($res as $n => $row) {
print_r($row);
}
dibi::test('SELECT * FROM [products]');
// -> SELECT * FROM [products]
echo '<hr>';
// with limit = 2
$res = dibi::query('SELECT * FROM [products] %lmt', 2);
foreach ($res as $n => $row) {
print_r($row);
}
dibi::test('SELECT * FROM [products] %lmt', 2);
// -> SELECT * FROM [products] LIMIT 2
echo '<hr>';
// with limit = 2, offset = 1
$res = dibi::query('SELECT * FROM [products] %lmt %ofs', 2, 1);
foreach ($res as $n => $row) {
print_r($row);
}
dibi::test('SELECT * FROM [products] %lmt %ofs', 2, 1);
// -> SELECT * FROM [products] LIMIT 2 OFFSET 1