mirror of
https://github.com/dg/dibi.git
synced 2025-09-03 02:52:47 +02:00
- added DibiDataSource as default implementation of IDataSource
- new modifiers %lmt %ofs - removed old modifier %p (alias for %sql)
This commit is contained in:
34
examples/apply-limit.php
Normal file
34
examples/apply-limit.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<h1>dibi apply limit/offset example</h1>
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once '../dibi/dibi.php';
|
||||
|
||||
|
||||
dibi::connect(array(
|
||||
'driver' => 'sqlite',
|
||||
'database' => 'sample.sdb',
|
||||
));
|
||||
|
||||
|
||||
// no limit
|
||||
$res = dibi::query('SELECT * FROM [products]');
|
||||
foreach ($res as $n => $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
echo '<hr>';
|
||||
|
||||
// with limit = 2
|
||||
$res = dibi::query('SELECT * FROM [products] %lmt', 2);
|
||||
foreach ($res as $n => $row) {
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user