rockdai / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
213 stars 25 forks source link

Added "LIMIT" support #58

Closed CodeTrol closed 10 years ago

CodeTrol commented 10 years ago

Example usage:

``` select().from('test_table').limit(0,5).toString() 'SELECT * FROM test_table LIMIT 0,5'

prust commented 10 years ago

Thanks @CodeTrol, but LIMIT and OFFSET are intentionally excluded from the core SQL-Bricks library, since the syntax and keywords for these differ widely across SQL engines/dialects and the core library is focused solely on comprehensive support for the cross-dialect core of SQL-92.

LIMIT and OFFSET are included in the sqlite and postgres extensions to SQL-Bricks. If you're interested in MySQL or in a different engine/dialect, feel free to create your own extension, it shouldn't be too hard, especially if you follow the example of the postgres extension, since it uses the latest extension mechanism (I still need to update the sqlite extension to match it).

prust commented 10 years ago

@CodeTrol: If you do create a dialect-specific SQL-Bricks extension, please let me know so I can link to it for others.

CodeTrol commented 10 years ago

Thanks for pointing this out. I thought library is focused only to MySQL dialect.