Example #1
0
function set_where($t)
{
    $cond1 = new SQLMakerCondition();
    $cond1->add(array('name' => 'john'));
    $cond2 = new SQLMakerCondition();
    $cond2->add(array('type' => array('in' => array(1, 2, 3))));
    $sql = _ns()->add_select('c')->add_from('foo')->set_where($cond1->compose_and($cond2))->as_sql();
    $t->is($sql, 'SELECT c FROM foo WHERE ((name = ?)) AND ((type IN (?, ?, ?)))');
}