Feature #998

Allow rows ? (to ?) sql clause in Query.C and Query_impl.h (not only offset and limit)

Added by Łukasz Matuszewski 8 months ago. Updated 6 months ago.

Status:Closed Start:09/23/2011
Priority:Normal Due date:
Assigned to:Koen Deforche % Done:

0%

Category:-
Target version:3.2.0

Description

I have changed a little class Query to allow processing of Firebird 2.1 (and up). The change is about to be limit and offset select statement.
In Firebird 2.1 (and up) you have to use ROWS statement like:

select * from mir_something rows 1 to 20

ROWS A TO B (where A > 0 and B > 0).

Typical change would be to allow Query to use ROWS instead limit and offset. For example simply add a method:

  void useROWSInSELECT(bool queryIsUsingROWS);

and then use SELECT with ROWS subclause if queryIsUsingROWS == true (otherwise use limit and offset).

Subclassing would be a little overhead.

BR,
Łukasz Matuszewski

Query.C (4.8 KB) Łukasz Matuszewski, 09/23/2011 10:59 am

Query_impl.h (11.9 KB) Łukasz Matuszewski, 09/23/2011 10:59 am

mir_firebird.cpp (23.2 KB) Łukasz Matuszewski, 09/23/2011 10:59 am

History

Updated by Łukasz Matuszewski 8 months ago

Actually mir_firebird.cpp should be a little modified to be purely using ibpp.h - which is a C++ library for Firebird (now it uses my wrapper DatabaseModule and its types (found somewhere else in this forum :)))

Updated by Koen Deforche 8 months ago

  • Status changed from New to Assigned
  • Assigned to set to Koen Deforche

Hey Lukasz,

It sounds that we should provide a dialect option to indicate how the (indeed non-SQL standard function of) offset and limit is supported ?
Do you have any plans for releasing and supporting the firebird sql connector, btw ?

Regards,
koen

Updated by Łukasz Matuszewski 8 months ago

Do you have any plans for releasing and supporting the firebird sql connector, btw ?

Yes i have, but using ibpp Firebird library.

Yes a dialect option would be perfect (to switch between ROWS / LIMIT OFFSET subclause).

BR,
Lukasz Matuszewski

Updated by Koen Deforche 8 months ago

  • Status changed from Assigned to Resolved
  • Target version set to 3.2.0

Hey Lukasz,

I've added this dialect option to SqlConnection, but haven't actually tested the "rows ? to ?" variant...
Pending a push to the git repository.

Regards,
koen

Updated by Koen Deforche 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF