Home Forums kbmMW LIMIT & OFFSET with ORM

This topic contains 4 replies, has 2 voices, and was last updated by  mrluigi2017 2 months, 3 weeks ago.

  • Author
  • #53500



    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!

  • #53502


    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.

  • #53504


    Thanks for both answers! It would be nice feature if there wouldn’t be a need to write the kbmmw syntax.

    • This reply was modified 2 months, 3 weeks ago by  kimbomadsen.
  • #53505


    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.


  • #53507


    Well the thing is that you make it to easy so we get a little lazy 😉

You must be logged in to reply to this topic.