foreach (\test\db\Find::find(Q::neq('value1', 'ccc'), new \ebi\Paginator(1, 3), Q::order('-id')) as $obj) { eq(isset($r[$i]) ? $r[$i] : null, $obj->value1()); $i++; } foreach (\test\db\Find::find(Q::neq('value1', 'abc'), new \ebi\Paginator(1, 3), Q::order('id')) as $obj) { eq('jkl', $obj->value1()); } $i = 0; $r = array('mno', 'aaa'); foreach (\test\db\Find::find(Q::neq('value1', 'ccc'), new \ebi\Paginator(1, 2), Q::order('order,-id')) as $obj) { eq(isset($r[$i]) ? $r[$i] : null, $obj->value1()); $i++; } $result = \test\db\Find::find_all(Q::match('AAA')); eq(3, sizeof($result)); $result = \test\db\Find::find_all(Q::match('AA')); eq(3, sizeof($result)); $result = \test\db\Find::find_all(Q::eq('value2', null)); eq(1, sizeof($result)); $result = \test\db\Find::find_all(Q::neq('value2', null)); eq(7, sizeof($result)); $result = \test\db\Find::find_all(Q::eq('updated', null)); eq(6, sizeof($result)); $result = \test\db\Find::find_all(Q::neq('updated', null)); eq(2, sizeof($result)); eq('2008-12-24T10:00:00+09:00', $result[0]->fm_updated()); $c = 0; for ($i = 0; $i < 10; $i++) { $a = $b = []; foreach (\test\db\Find::find_all(Q::random_order()) as $o) { $a[] = $o->id();
<?php use ebi\Q; \test\db\Match::create_table(); \test\db\Match::find_delete(); (new \test\db\Match())->data1(10)->data2('XXX')->data3('AAABBB')->save(); (new \test\db\Match())->data1(20)->data2('YYY')->data3('BBBCCC')->save(); (new \test\db\Match())->data1(30)->data2('BBB')->data3('CCCDDD')->save(); (new \test\db\Match())->data1(40)->data2('IIIAAABBBEEE')->data3('AAADDDBBB')->save(); (new \test\db\Match())->data1(50)->data2('JJJ')->data3('EEEFFFIII')->save(); eq(4, \test\db\Match::find_count(Q::match('BBB'))); eq(2, \test\db\Match::find_count(Q::match('AAA BBB'))); eq(0, \test\db\Match::find_count(Q::match('BB YY'))); eq(1, \test\db\Match::find_count(Q::match('BBB III'))); eq(2, \test\db\Match::find_count(Q::match('EE II'))); eq(1, \test\db\Match::find_count(Q::match(30))); eq(1, \test\db\Match::find_count(Q::match('BB CC'))); // 全角スペース eq(1, \test\db\Match::find_count(Q::match('BBB CCC', ['data3'])));