示例#1
0
$v = $p->get_list('list', array('type' => 'text'));
test::assert_value(count($v), 3);
$v = $p->get_list('list', array('type' => 'text'), 1);
test::assert_value(count($v), 1);
test::assert_value($v[0]['id'], 2);
$v = $p->get_list('list', array('type' => 'text'), 2, 1);
test::assert_value(count($v), 2);
test::assert_value($v[0]['id'], 6);
test::assert_value($v[1]['id'], 7);
$v = $p->get_list('list', array('type' => 'text', 'section' => 'blogs'));
test::assert_value(count($v), 2);
test::assert_value($v[0]['id'], 2);
test::assert_value($v[1]['id'], 7);
$v = $p->get_list('list', array('type' => 'text', 'section' => 'songs'));
test::assert_value(count($v), 0);
$p->delete('list', array('section' => 'blogs'));
$v = $p->get_list('list');
test::assert_value(count($v), 5, 'Deleting');
$v = $p->get_list('list', array('section' => 'blogs'));
test::assert_value(count($v), 0);
$p->delete('list', array('type' => 'text'));
$v = $p->get_list('list');
test::assert_value(count($v), 4);
$v = $p->get_list('list', array('type' => 'text'));
test::assert_value(count($v), 0);
$p->clear('list');
$p->insert('list', array('id' => 1, 'type' => 'image'));
$p->insert('list', array('id' => 2, 'type' => 'text', 'section' => 'blogs'));
$p->insert('list', array('id' => 3, 'type' => 'video'));
$p->insert('list', array('id' => 4, 'type' => 'video'));
$p->insert('list', array('id' => 5, 'type' => 'image'));