Skip to content

Instantly share code, notes, and snippets.

@Ronmi
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save Ronmi/db71bb3ba8c0265017fa to your computer and use it in GitHub Desktop.

Select an option

Save Ronmi/db71bb3ba8c0265017fa to your computer and use it in GitHub Desktop.
某 SQL Builder 將使用的 WHERE 建立語法
<?php
$where = $b->o( // OR
$b->o(
$b->eq($m2->col2, 1),
$b->a( //AND
$b->ne($m1->id, 2),
$b->lt($m1->id, $b->raw('3*', $m2->id, '-10'))
)
),
$b->not($b->like($m2->col1, 'abc')),
$b->in($m1->col1, $b->lists(1, 2, 3, 4, 5))
);
@Ronmi

Ronmi commented May 22, 2014

Copy link
Copy Markdown
Author
string(150) "((`model2`.`col2`=1 OR (`model1`.`id`!=2 AND `model1`.`id`<3*`model2`.`id`-10)) OR NOT (`model2`.`col1` LIKE 'abc') OR `model1`.`col1` IN (1,2,3,4,5))"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment