Skip Menu |

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

Report information
The Basics
Id: 79139
Status: rejected
Priority: 0/
Queue: DBIx-Class

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

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



Subject: Arbitrary SQL through a custom ResultSource is hard to pass bind params to
I've followed the recipe in the Cookbook at "Arbitrary SQL through a custom ResultSource", and it's Hard to pass the right bind params. It would be helpful if they could be named parameters instead of having to be an ordered list when I make a query. Right now I have to do this: bind => [ $customer_id, $service_id, ... ] but it would be more convenient, and easier to maintain, if I could do this: bind => { customer_id => $customer_id, service_id => $service_id, ... }
On Wed Aug 22 13:01:03 2012, DCANTRELL wrote: Show quoted text
> I've followed the recipe in the Cookbook at "Arbitrary SQL through a > custom ResultSource", and it's Hard to pass the right bind params. It > would be helpful if they could be named parameters instead of having to > be an ordered list when I make a query. > > Right now I have to do this: > bind => [ $customer_id, $service_id, ... ] > > but it would be more convenient, and easier to maintain, if I could do > this: > bind => { > customer_id => $customer_id, > service_id => $service_id, > ... > }
I am sceptical this can be done. Consider that DBIC resultsets are designed to be composable. There is no guarantee that there is only one 'customer_id' in existence. Where would we apply the bind value then? Or furthwrmore, if your arbitrary SQL contains ... WHERE customer_id > ? AND customer_id < ?... what happens then? Furthermore given this is *arbitrary* SQL, how can we even tell what each placeholder corresponds to in the black-boxy SQL string the user supplied? Please elaborate what you have in mind.
Stalling ticket for a bit due to lack of replies from the reporter.
Rejecting ticket as no reply from original requestor. Feel free to reopen if more discussion is in order.