[Jifty-commit] r4507 - in Jifty-DBI/trunk: lib/Jifty/DBI
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Nov 20 15:22:33 EST 2007
Author: ishigaki
Date: Tue Nov 20 15:22:27 2007
New Revision: 4507
Modified:
Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm
Jifty-DBI/trunk/t/01searches.t
Log:
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/trunk/lib/Jifty/DBI/Collection.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Collection.pm Tue Nov 20 15:22:27 2007
@@ -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/trunk/t/01searches.t
==============================================================================
--- Jifty-DBI/trunk/t/01searches.t (original)
+++ Jifty-DBI/trunk/t/01searches.t Tue Nov 20 15:22:27 2007
@@ -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