Skip Menu |

This queue is for tickets about the DBIx-DataModel CPAN distribution.

Report information
The Basics
Id: 55411
Status: resolved
Priority: 0/
Queue: DBIx-DataModel

People
Owner: Nobody in particular
Requestors: DTADY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Add Support for Multiple LIMIT/OFFSET dialects
Hi, We are heavy users of DBIx::DM and I would like to thank you for your great work. We have hit a minor issue with LIMIT/OFFSET feature and we would like to propose if it is possible to support multiple dialects of LIMIT/OFFSET. Queries like select() with -limit -offset queries breaks with MySQL 4.x. For MySQL 5.x, LIMIT/OFFSET is supported and is a non-issue. Given the dependency to SQL::Abstract, there is another module SQL::Abstract::Limit that may be a starting point. Either the API directly includes a -limitDialect param in the select() method. Alternatively, unintrusively introduce a Schema level setting for specifying/overriding the limit dialect. Thanks! Dex
Subject: Re: [rt.cpan.org #55411] Add Support for Multiple LIMIT/OFFSET dialects
Date: Thu, 11 Mar 2010 21:32:19 +0100
To: bug-DBIx-DataModel [...] rt.cpan.org
From: laurent dami <laurent.dami [...] free.fr>
Le 10.03.2010 09:39, Dexter Tad-y via RT a écrit : Show quoted text
> Wed Mar 10 03:39:15 2010: Request 55411 was acted upon. > Transaction: Ticket created by DTADY > Queue: DBIx-DataModel > Subject: Add Support for Multiple LIMIT/OFFSET dialects > Broken in: (no value) > Severity: Wishlist > Owner: Nobody > Requestors: DTADY@cpan.org > Status: new > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=55411> > > > Hi, > > We are heavy users of DBIx::DM and I would like to thank you for your > great work. > > We have hit a minor issue with LIMIT/OFFSET feature and we would like to > propose if it is possible to support multiple dialects of LIMIT/OFFSET. > Queries like select() with -limit -offset queries breaks with MySQL 4.x. > For MySQL 5.x, LIMIT/OFFSET is supported and is a non-issue. > > Given the dependency to SQL::Abstract, there is another module > SQL::Abstract::Limit that may be a starting point. Either the API > directly includes a -limitDialect param in the select() method. > Alternatively, unintrusively introduce a Schema level setting for > specifying/overriding the limit dialect. > > Thanks! > > Dex > >
Hi Dex, Nice to hear of DBIx::DM users. True enough, LIMIT/OFFSET is currently hardcoded in Statement.pm, so it's a good idea to parameterize it. One way would be to exploit the Schema(sqlAbstract => ..) parameter and then rely on SQL::Abstract::Limit. Another way would be to add it within the Schema(sqlDialect => ...) parameter. This is a schema thing, so I'm not so keen of adding it in select(..., -limitDialect => ...). Need to think a bit of various options ... Which kind of dialect do you need (which syntax for Limit/Offset) ? Cheers, Laurent D.
RT-Send-CC: dtady [...] cpan.org, laurent.dami [...] free.fr
On Thu Mar 11 15:40:24 2010, laurent.dami@free.fr wrote: Show quoted text
> Le 10.03.2010 09:39, Dexter Tad-y via RT a écrit :
> > Wed Mar 10 03:39:15 2010: Request 55411 was acted upon. > > Transaction: Ticket created by DTADY > > Queue: DBIx-DataModel > > Subject: Add Support for Multiple LIMIT/OFFSET dialects > > Broken in: (no value) > > Severity: Wishlist > > Owner: Nobody > > Requestors: DTADY@cpan.org > > Status: new > > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=55411> > > > > > > Hi, > > > > We are heavy users of DBIx::DM and I would like to thank you for your > > great work. > > > > We have hit a minor issue with LIMIT/OFFSET feature and we would like to > > propose if it is possible to support multiple dialects of LIMIT/OFFSET. > > Queries like select() with -limit -offset queries breaks with MySQL 4.x. > > For MySQL 5.x, LIMIT/OFFSET is supported and is a non-issue. > > > > Given the dependency to SQL::Abstract, there is another module > > SQL::Abstract::Limit that may be a starting point. Either the API > > directly includes a -limitDialect param in the select() method. > > Alternatively, unintrusively introduce a Schema level setting for > > specifying/overriding the limit dialect. > > > > Thanks! > > > > Dex > > > >
> Hi Dex, > > Nice to hear of DBIx::DM users. > > True enough, LIMIT/OFFSET is currently hardcoded in Statement.pm, so > it's a good idea to parameterize it. > One way would be to exploit the Schema(sqlAbstract => ..) parameter and > then rely on SQL::Abstract::Limit. > Another way would be to add it within the Schema(sqlDialect => ...) > parameter. > This is a schema thing, so I'm not so keen of adding it in select(..., > -limitDialect => ...). > Need to think a bit of various options ... > Which kind of dialect do you need (which syntax for Limit/Offset) ? > > Cheers, Laurent D.
Hi Laurent, The dialect were using, in SQL::Abstract::Limit's terminology, are: LimitOffset => PostgreSQL, SQLite, MySQL 5.x LimitXY => MySQL 4.x (encountered when I deployed on a older system) You are right in pointing out that it is a schema thing. I feel it is flexible if one can specify his/her own SQL::Abstract instance. Please, feel free to implement whatever is/feels correct, design-wise. Looking forward for a better DBIx::DM. Thanks! Dex
RT-Send-CC: dtady [...] cpan.org
Le Mer 10 Mar 2010 03:39:15, DTADY a écrit : Show quoted text
> We have hit a minor issue with LIMIT/OFFSET feature and we would like to > propose if it is possible to support multiple dialects of LIMIT/OFFSET.
Solved in v1.22 (just posted to PAUSE). Instanciate your schema with DBIx::DataModel->Schema('MySchema', -sqlDialect => 'MySQL') or DBIx::DataModel->Schema('MySchema', -sqlDialect => {limitOffset => 'LimitXY'}) or DBIx::DataModel->Schema('MySchema', -sqlDialect => {limitOffset => sub {...}) see the doc/Reference/Schema for more details.