[Jifty-commit] jifty-dbi branch, master, updated. 91b7ff2f08416fc64d6b6dfae5eeb0c2dd8ce00a
Jifty commits
jifty-commit at lists.jifty.org
Thu Dec 31 14:09:00 EST 2009
The branch, master has been updated
via 91b7ff2f08416fc64d6b6dfae5eeb0c2dd8ce00a (commit)
via 220a254315006ba5c42d2dce5b33cad4ef5ad535 (commit)
from 4ea6d4e39ee5798a4b70ad88f12d09f614fd7f9f (commit)
Summary of changes:
lib/Jifty/DBI/Collection.pm | 22 +++++-----------------
lib/Jifty/DBI/Handle.pm | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 220a254315006ba5c42d2dce5b33cad4ef5ad535
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Dec 31 14:08:06 2009 -0500
Move quote_value into Jifty::DBI::Handle
It existed in ::Collection for purely historical reasons; move it
somewhere useful.
diff --git a/lib/Jifty/DBI/Collection.pm b/lib/Jifty/DBI/Collection.pm
index 1d2fd09..a92b352 100755
--- a/lib/Jifty/DBI/Collection.pm
+++ b/lib/Jifty/DBI/Collection.pm
@@ -1482,22 +1482,10 @@ sub _set_clause {
$self->{$type} = $value;
}
-# quote the search value
+# stub for back-compat
sub _quote_value {
my $self = shift;
- my ($value) = @_;
-
- my $tmp = $self->_handle->dbh->quote($value);
-
- # Accomodate DBI drivers that don't understand UTF8
- if ( $] >= 5.007 ) {
- require Encode;
- if ( Encode::is_utf8($tmp) ) {
- Encode::_utf8_on($tmp);
- }
- }
- return $tmp;
-
+ return $self->_handle->quote_value(@_);
}
=head2 order_by_cols DEPRECATED
diff --git a/lib/Jifty/DBI/Handle.pm b/lib/Jifty/DBI/Handle.pm
index bad3348..d013d1f 100755
--- a/lib/Jifty/DBI/Handle.pm
+++ b/lib/Jifty/DBI/Handle.pm
@@ -739,6 +739,29 @@ sub _make_clause_case_insensitive {
return ( $column, $operator, $value );
}
+=head2 quote_value VALUE
+
+Calls the database's L<DBD/quote> method and returns the result.
+Additionally, turns on perl's utf8 flag if the returned content is
+UTF8.
+
+=cut
+
+sub quote_value {
+ my $self = shift;
+ my ($value) = @_;
+ my $tmp = $self->dbh->quote($value);
+
+ # Accomodate DBI drivers that don't understand UTF8
+ if ( $] >= 5.007 ) {
+ require Encode;
+ if ( Encode::is_utf8($tmp) ) {
+ Encode::_utf8_on($tmp);
+ }
+ }
+ return $tmp;
+}
+
=head2 begin_transaction
Tells Jifty::DBI to begin a new SQL transaction. This will
commit 91b7ff2f08416fc64d6b6dfae5eeb0c2dd8ce00a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Dec 31 14:08:47 2009 -0500
Change existing called to use the new moved quote_value
diff --git a/lib/Jifty/DBI/Collection.pm b/lib/Jifty/DBI/Collection.pm
index a92b352..44e80ef 100755
--- a/lib/Jifty/DBI/Collection.pm
+++ b/lib/Jifty/DBI/Collection.pm
@@ -1265,15 +1265,15 @@ sub limit {
if ( $args{'quote_value'} && $args{'operator'} !~ /IS/i ) {
if ( $value_ref eq 'ARRAY' ) {
- map { $_ = $self->_quote_value($_) } @{ $args{'value'} };
+ map { $_ = $self->_handle->quote_value($_) } @{ $args{'value'} };
} else {
- $args{'value'} = $self->_quote_value( $args{'value'} );
+ $args{'value'} = $self->_handle->quote_value( $args{'value'} );
}
}
}
if ( $args{'escape'} ) {
- $args{'escape'} = 'ESCAPE ' . $self->_quote_value( $args{escape} );
+ $args{'escape'} = 'ESCAPE ' . $self->_handle->quote_value( $args{escape} );
}
# If we're trying to get a leftjoin restriction, lets set
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list