Skip to content

Commit

Permalink
Merge branch 'stevieb9-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ambs committed Mar 23, 2016
2 parents 96cc885 + c478e36 commit 6bf1882
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 87 deletions.
30 changes: 4 additions & 26 deletions Dancer1/README
Expand Up @@ -196,35 +196,13 @@ GETTING A DATABASE HANDLE
You can also pass a hashref of settings if you wish to provide settings
at runtime.

CONVENIENCE FEATURES (quick_select, quick_update, quick_insert, quick_delete)
CONVENIENCE FEATURES
The handle returned by the `database' keyword is a
Dancer::Plugin::Database::Core::Handle object, which subclasses the `DBI::db'
DBI connection handle. This means you can use it just like you'd
normally use a DBI handle, but extra convenience methods are provided,
as documented in the POD for Dancer::Plugin::Database::Core::Handle.
normally use a DBI handle, but extra convenience methods are provided.

Examples:

# Quickly fetch the (first) row whose ID is 42 as a hashref:
my $row = database->quick_select($table_name, { id => 42 });

# Fetch all badgers as an array of hashrefs:
my @badgers = database->quick_select('animals', { genus => 'Mellivora' });

# Update the row where the 'id' column is '42', setting the 'foo' column to
# 'Bar':
database->quick_update($table_name, { id => 42 }, { foo => 'Bar' });

# Insert a new row, using a named connection (see above)
database('connectionname')->quick_insert($table_name, { foo => 'Bar' });

# 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, {});

There's more extensive documentation on these features in
There's extensive documentation on these features in
Dancer::Plugin::Database::Core::Handle, including using the `order_by',
`limit', `columns' options to sort / limit results and include only
specific columns.
Expand Down Expand Up @@ -351,7 +329,7 @@ SUPPORT
<irc.perl.org>.

LICENSE AND COPYRIGHT
Copyright 2010-12 David Precious.
Copyright 2010-2016 David Precious.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
Expand Down
33 changes: 4 additions & 29 deletions Dancer1/lib/Dancer/Plugin/Database.pm
Expand Up @@ -259,39 +259,14 @@ You can also pass a hashref of settings if you wish to provide settings at
runtime.
=head1 CONVENIENCE FEATURES (quick_select, quick_update, quick_insert, quick_delete, quick_count)
=head1 CONVENIENCE FEATURES
The handle returned by the C<database> keyword is a
L<Dancer::Plugin::Database::Core::Handle> object, which subclasses the C<DBI::db> DBI
connection handle. This means you can use it just like you'd normally use a DBI
handle, but extra convenience methods are provided, as documented in the POD for
L<Dancer::Plugin::Database::Core::Handle>.
handle, but extra convenience methods are provided.
Examples:
# Quickly fetch the (first) row whose ID is 42 as a hashref:
my $row = database->quick_select($table_name, { id => 42 });
# Fetch all badgers as an array of hashrefs:
my @badgers = database->quick_select('animals', { genus => 'Mellivora' });
# Update the row where the 'id' column is '42', setting the 'foo' column to
# 'Bar':
database->quick_update($table_name, { id => 42 }, { foo => 'Bar' });
# Insert a new row, using a named connection (see above)
database('connectionname')->quick_insert($table_name, { foo => 'Bar' });
# 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, {});
# Retrieve a count of rows matching the criteria:
database->quick_count($table_name, {});
There's more extensive documentation on these features in
There's extensive documentation on these features in
L<Dancer::Plugin::Database::Core::Handle>, including using the C<order_by>, C<limit>,
C<columns> options to sort / limit results and include only specific columns.
Expand Down Expand Up @@ -441,7 +416,7 @@ You can find the author on IRC in the channel C<#dancer> on <irc.perl.org>.
=head1 LICENSE AND COPYRIGHT
Copyright 2010-2015 David Precious.
Copyright 2010-2016 David Precious.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
Expand Down
2 changes: 1 addition & 1 deletion Dancer2/README
Expand Up @@ -351,7 +351,7 @@ SUPPORT
<irc.perl.org>.

LICENSE AND COPYRIGHT
Copyright 2010-12 David Precious.
Copyright 2010-2016 David Precious.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
Expand Down
33 changes: 4 additions & 29 deletions Dancer2/lib/Dancer2/Plugin/Database.pm
Expand Up @@ -279,39 +279,14 @@ You can also pass a hashref of settings if you wish to provide settings at
runtime.
=head1 CONVENIENCE FEATURES (quick_select, quick_update, quick_insert, quick_delete, quick_count)
=head1 CONVENIENCE FEATURES
The handle returned by the C<database> keyword is a
L<Dancer::Plugin::Database::Core::Handle> object, which subclasses the C<DBI::db> DBI
connection handle. This means you can use it just like you'd normally use a DBI
handle, but extra convenience methods are provided, as documented in the POD for
L<Dancer::Plugin::Database::Core::Handle>.
handle, but extra convenience methods are provided.
Examples:
# Quickly fetch the (first) row whose ID is 42 as a hashref:
my $row = database->quick_select($table_name, { id => 42 });
# Fetch all badgers as an array of hashrefs:
my @badgers = database->quick_select('animals', { genus => 'Mellivora' });
# Update the row where the 'id' column is '42', setting the 'foo' column to
# 'Bar':
database->quick_update($table_name, { id => 42 }, { foo => 'Bar' });
# Insert a new row, using a named connection (see above)
database('connectionname')->quick_insert($table_name, { foo => 'Bar' });
# 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, {});
# Retrieve a count of rows matching the criteria:
database->quick_count($table_name, {});
There's more extensive documentation on these features in
There's extensive documentation on these features in
L<Dancer::Plugin::Database::Core::Handle>, including using the C<order_by>, C<limit>,
C<columns> options to sort / limit results and include only specific columns.
Expand Down Expand Up @@ -460,7 +435,7 @@ You can find the author on IRC in the channel C<#dancer> on <irc.perl.org>.
=head1 LICENSE AND COPYRIGHT
Copyright 2010-13 David Precious.
Copyright 2010-2016 David Precious.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
Expand Down
2 changes: 1 addition & 1 deletion Shared/README
Expand Up @@ -42,7 +42,7 @@ SUPPORT

ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2013 David Precious.
Copyright 2016 David Precious.

This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a copy
Expand Down
2 changes: 1 addition & 1 deletion Shared/lib/Dancer/Plugin/Database/Core.pm
Expand Up @@ -396,7 +396,7 @@ L<http://search.cpan.org/dist/Dancer-Plugin-Database-Core/>
=head1 LICENSE AND COPYRIGHT
Copyright 2013 David Precious.
Copyright 2016 David Precious.
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
Expand Down
40 changes: 40 additions & 0 deletions Shared/lib/Dancer/Plugin/Database/Core/Handle.pm
Expand Up @@ -639,6 +639,46 @@ L<Dancer> and L<Dancer2>
L<DBI>
=head1 LICENSE AND COPYRIGHT
Copyright 2016 David Precious.
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:
L<http://www.perlfoundation.org/artistic_license_2_0>
Any use, modification, and distribution of the Standard or Modified
Versions is governed by this Artistic License. By using, modifying or
distributing the Package, you accept this license. Do not use, modify,
or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made
by someone other than you, you are nevertheless required to ensure that
your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service
mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge
patent license to make, have made, use, er to sell, sell, import and
otherwise transfer the Package with respect to any patent claims
licensable by the Copyright Holder that are necessarily infringed by the
Package. If you institute patent litigation (including a cross-claim or
counterclaim) against any party alleging that the Package constitutes
direct or contributory patent infringement, then this Artistic License
to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=cut

1;
Expand Down

0 comments on commit 6bf1882

Please sign in to comment.