chintan39 / wildblog

Automatically exported from code.google.com/p/wildblog
Other
0 stars 0 forks source link

filters definition by functional model (10h) #255

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Custom sql queries are now created by creating string and assigning values, 
which is not right approach. It would be better to create the query by 
functions call.

Original issue reported on code.google.com by horak.honza@gmail.com on 14 Nov 2011 at 10:16

GoogleCodeExporter commented 9 years ago
Some first nits how it could work:
Query::select('*')
  ->from(this->getTable())
  ->join(other->getTable()) //will be generated automaticaly
  ->where()
    ->equal(id, 5)
    ->and()
    ->rpar()
    ->ge(some, 5)
    ->or()
    ->like(text, 'key')
    ->rpar()
will generate:
select * from table1 left join table2 where id=5 and (some>5 or text like 'key')

Original comment by horak.honza@gmail.com on 14 Nov 2011 at 10:33

GoogleCodeExporter commented 9 years ago
Or just use PDO :labelled approach.

Original comment by horak.honza@gmail.com on 14 Nov 2011 at 10:35

GoogleCodeExporter commented 9 years ago
targets: easy and safe query definition

Original comment by horak.honza@gmail.com on 14 Nov 2011 at 10:36