Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer-Plugin-Database CPAN distribution.

Report information
The Basics
Id: 65825
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-Database

People
Owner: Nobody in particular
Requestors: ms [...] 2scale.net
Cc:
AdminCc:

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



Subject: Dancer::Plugin::Database documentation bug + quick_select bug
Date: Thu, 17 Feb 2011 10:56:36 +0100
To: David Precious via RT <bug-Dancer-Plugin-Database [...] rt.cpan.org>
From: Michael Stiller <ms [...] 2scale.net>
Hi David, unfortunately i guess i found two more bugs: In Dancer::Plugin::Database there is documentation which reads: (around line 230) 230 get '/users/:id' => sub { 231 template 'display_user', { 232 person => database->quick_select('users', id => params->{id}), 233 }; 234 }; This is wrong, the {}'s are missing, shouldn't it read: 232 person => database->quick_select('users', { id => params->{id} }), Beyond that, i'm pretty sure, that the quick_select statement does not honor the where clause. Shouldn't it read: (Handle.pm) 142 if ($type eq 'UPDATE' || $type eq 'DELETE' || $type eq 'SELECT') { 143 $sql .= " WHERE " . join " AND ", 144 map { $self->quote_identifier($_) . '=?' } keys %$where; 145 push @bind_params, values %$where; 146 } Cheers, Michael -- 2scale GmbH, Karlstr. 88, 40210 Düsseldorf Amtsgericht: Düsseldorf HRB 50718 Geschäftsführer: Georg von Zezschwitz, Dirk Vleugels USt-IdNr.: DE 210936505
On Thu Feb 17 04:56:47 2011, ms@2scale.net wrote: Show quoted text
> unfortunately i guess i found two more bugs:
Nothing unfortunate, a bug found is a bug fixed, and I appreciate your help! Show quoted text
> In Dancer::Plugin::Database there is documentation which reads: > > (around line 230) > > 230 get '/users/:id' => sub { > 231 template 'display_user', { > 232 person => database->quick_select('users', id => > params->{id}), > 233 }; > 234 }; > > This is wrong, the {}'s are missing, shouldn't it read: > > 232 person => database->quick_select('users', { id => > params->{id} }),
Absolutely correct. That serves me right for adding that bit of documentation to Database.pm in a hurry before releasing. I should have copied & pasted it from Handle.pm, where the examples are correct. Show quoted text
> Beyond that, i'm pretty sure, that the quick_select statement does not > honor the where clause. Shouldn't it read: > > (Handle.pm) > > 142 if ($type eq 'UPDATE' || $type eq 'DELETE' || $type eq > 'SELECT') { > 143 $sql .= " WHERE " . join " AND ", > 144 map { $self->quote_identifier($_) . '=?' } keys > %$where; > 145 push @bind_params, values %$where;
[...] Ah, bugger, that one is more embarrassing! Seems the basic tests I performed weren't sufficient - I must have tested that it returned data I expected, but not that it didn't return data I didn't expect. Whoops! I'll get a new release out tonight with those issues fixed. I'll also develop some more robust tests for this module :) Thanks again!
I've just released 1.11 which fixes these two bugs. Thanks again!