[Jifty-commit] r5011 - in Jifty-DBI/branches/tisql: lib/Jifty/DBI t
Jifty commits
jifty-commit at lists.jifty.org
Tue Feb 5 21:15:13 EST 2008
Author: ruz
Date: Tue Feb 5 21:15:13 2008
New Revision: 5011
Modified:
Jifty-DBI/branches/tisql/ (props changed)
Jifty-DBI/branches/tisql/lib/Jifty/DBI/Collection.pm
Jifty-DBI/branches/tisql/t/01searches.t
Log:
r4508 at cubic-pc (orig r4507): ishigaki | 2007-11-20 23:22:27 +0300
JDBI: changed escape character in the t/01searches.t from backslashes to at mark, which is cleaner and kind to postgres; added pod
Modified: Jifty-DBI/branches/tisql/lib/Jifty/DBI/Collection.pm
==============================================================================
--- Jifty-DBI/branches/tisql/lib/Jifty/DBI/Collection.pm (original)
+++ Jifty-DBI/branches/tisql/lib/Jifty/DBI/Collection.pm Tue Feb 5 21:15:13 2008
@@ -1130,6 +1130,10 @@
=back
+=item escape
+
+If you need to escape wildcard characters in the value *explicitly* with "ESCAPE", set the escape character here. Note that backslashes may be required special treatment (e.g. Postgres).
+
=item entry_aggregator
Can be AND or OR (or anything else valid to aggregate two clauses in SQL)
Modified: Jifty-DBI/branches/tisql/t/01searches.t
==============================================================================
--- Jifty-DBI/branches/tisql/t/01searches.t (original)
+++ Jifty-DBI/branches/tisql/t/01searches.t Tue Feb 5 21:15:13 2008
@@ -130,7 +130,10 @@
# LIKE with escaped wildcard
$users_obj->clean_slate;
is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
- $users_obj->limit( column => 'name', operator => 'MATCHES', value => 'G\\_ass', escape => '\\' );
+ # XXX: don't use backslashes; Pg (only Pg?) requires special
+ # treatment like "LIKE E'%g\\_ass%'" for that case,
+ # which is not supported yet (but this should be fixed)
+ $users_obj->limit( column => 'name', operator => 'MATCHES', value => 'G at _ass', escape => '@' );
is( $users_obj->count, 0, "should not find users with 'Glass' in the name" );
# LIKE with wildcard
@@ -145,7 +148,8 @@
# LIKE with escaped wildcard
$users_obj->clean_slate;
is_deeply( $users_obj, $clean_obj, 'after clean_slate looks like new object');
- $users_obj->limit( column => 'name', operator => 'MATCHES', value => 'Glass\\%', escape => '\\' );
+ # XXX: don't use backslashes; reason above
+ $users_obj->limit( column => 'name', operator => 'MATCHES', value => 'Glass@%', escape => '@' );
is( $users_obj->count, 0, "should not find users with 'Glass' in the name" );
# STARTSWITH
More information about the Jifty-commit
mailing list