bigpresh / bigpresh/Dancer-Plugin-Database

Auto adding "LIMIT" to quick_select lets fail queries for DBD::Oracle

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
39
Forks
36
PR merge metrics
No merged PRs in 30d

Description

DBD::Oracle or rather Oracle in common doesn't have a "LIMIT" key word, so
database->quick_select
produces invalid queries!

Dancer::Plugin::Database::Handle

``` perl
306: } elsif ($type eq 'SELECT' && !wantarray) {
307: # We're only returning one row in scalar context, so don't ask for any
308: # more than that
309: $sql .= " LIMIT 1";
310: }
```

So the following

``` perl
my $row = database->quick_select('mytable', { id => params->{id} });
```

Produces

(DBD ERROR: error possibly near <_> indicator at char 46 in 'SELECT \* FROM "mytable" WHERE "id"=:p1 <_>LIMIT 1') [for Statement "SELECT \* FROM "mytable" WHERE "id"=? LIMIT 1"] at /usr/lib/perl5/site_perl/5.10.0/Dancer/Plugin/Database/Handle.pm line 336

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.