Skip to content

Commit

Permalink
Preparing to release 1.30 with change for gnusosa.
Browse files Browse the repository at this point in the history
  • Loading branch information
bigpresh committed May 23, 2011
1 parent 36eba08 commit e25f520
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Changes
@@ -1,5 +1,10 @@
Revision history for Dancer-Plugin-Database

1.30 2011-05-23
- Allow passing an empty hashref for where clause to signify that no
where clause is desired (i.e. return all rows).
Requested by Carlos Sosa (gnusosa) - thanks!

1.24 2011-05-09
- Bugfixes in logging - avoid DBI swallowing up the param I'd wrongly
named, and avoid warnings if any params are undef.
Expand Down
7 changes: 7 additions & 0 deletions README
Expand Up @@ -177,6 +177,9 @@ CONVENIENCE FEATURES (quick_select, quick_update, quick_insert, quick_delete)
# Delete the row with id 42:
database->quick_delete($table_name, { id => 42 });

# Fetch all rows from a table (since version 1.30):
database->quick_select($table_name, {});

AUTHOR
David Precious, `<davidp@preshweb.co.uk>'

Expand All @@ -202,6 +205,10 @@ ACKNOWLEDGEMENTS

Michael Stiller

Martin J Evans

Carlos Sosa

BUGS
Please report any bugs or feature requests to
`bug-dancer-plugin-database at rt.cpan.org', or through the web
Expand Down
7 changes: 6 additions & 1 deletion lib/Dancer/Plugin/Database.pm
Expand Up @@ -12,7 +12,7 @@ Dancer::Plugin::Database - easy database connections for Dancer applications
=cut

our $VERSION = '1.24';
our $VERSION = '1.30';

my $settings = undef;

Expand Down Expand Up @@ -423,6 +423,9 @@ Examples:
# Delete the row with id 42:
database->quick_delete($table_name, { id => 42 });
# Fetch all rows from a table (since version 1.30):
database->quick_select($table_name, {});
=head1 AUTHOR
Expand Down Expand Up @@ -456,6 +459,8 @@ Michael Stiller
Martin J Evans
Carlos Sosa
=head1 BUGS
Please report any bugs or feature requests to C<bug-dancer-plugin-database at rt.cpan.org>, or through
Expand Down
15 changes: 13 additions & 2 deletions lib/Dancer/Plugin/Database/Handle.pm
Expand Up @@ -5,7 +5,7 @@ use Carp;
use DBI;
use base qw(DBI::db);

our $VERSION = '0.05';
our $VERSION = '0.06';

=head1 NAME
Expand All @@ -24,9 +24,13 @@ Subclassed DBI connection handle with added convenience features
# Updating a record where id = 42:
database->quick_update($tablename, { id => 42 }, { foo => 'New value' });
# Fetching a row quickly
# Fetching a single row quickly in scalar context
my $employee = database->quick_select('employees', { id => $emp_id });
# Fetching multiple rows in list context - passing an empty hashref to signify
# no where clause (i.e. return all rows - so "select * from $table_name"):
my @all_employees = database->quick_select('employees', {});
=head1 Added features
Expand Down Expand Up @@ -225,6 +229,13 @@ Will result in:
injection attacks will not work, but it's easier to illustrate as though the
values were interpolated directly. Don't worry, they're not.))
You can pass an empty hashref if you want all rows, e.g.:
database->quick_select('mytable', {});
... is the same as C<"SELECT * FROM 'mytable'">
TODO: this isn't very flexible; it would be nice to easily use other logic
combinations, and other comparisons other than a straightforward equality
comparison. However, supporting this abstraction without the syntax used
Expand Down

0 comments on commit e25f520

Please sign in to comment.