- This topic has 4 replies, 2 voices, and was last updated 6 years, 9 months ago by .
Viewing 4 reply threads
Viewing 4 reply threads
- You must be logged in to reply to this topic.
Hi,
Is there any build in support in the ORM for LIMIT and OFFSET or do I need to write the query the oldschool way?
Thanks in advance!
The ORM supports LIMIT and OFFSET via its kbmMW SQL syntax:
o:=orm.Query<…>(‘SELECT … FROM uData.Txxxx p WHERE … LIMIT 10 OFFSET 50’);
It will be automatically converted to the correct syntax for the destination database if at all possible.
Thanks for both answers! It would be nice feature if there wouldn’t be a need to write the kbmmw syntax.
It would require many more variations of Query and all the other data returning methods, to hold all the possible combinations of optional parameters.
What about sort order, and joins, and calculations, and complex selection filters etc?
For that to work, one would either have to build the query statement painstakingly piece by piece, like is being done in some ORM implementations, or invent a query language…. ahh… but thats what is there already… the SQL language, but in a database agnostic way, the kbmMW way 🙂
I decided against the artificial piece by piece combination of a selection statement simply because it is much less readable and solves absolutely no problems at all.
I also decided against inventing and/or using XML or JSON based query language, which also just complicates things without solving any problems.
The best, universal and quite well understood query language that exists, is SQL. The problem with SQL as such, is that different databases provides different dialects, and have different additions. That is what kbmMW tries to solve.
One simply understood query language for all supported databases.
Well the thing is that you make it to easy so we get a little lazy 😉