From: Mike Rylander Date: Wed, 11 May 2011 16:30:08 +0000 (-0400) Subject: add a special startwith op for use with transformed values (cannot do it another... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0988a9ad4e0e055bbaba75f416c7177ee984c150;p=working%2FEvergreen.git add a special startwith op for use with transformed values (cannot do it another way currently) --- diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c index 3f8157db34..1705b220cb 100644 --- a/Open-ILS/src/c-apps/oils_sql.c +++ b/Open-ILS/src/c-apps/oils_sql.c @@ -2765,16 +2765,24 @@ static char* searchFieldTransformPredicate( const ClassInfo* class_info, osrfHas right_parens = ")"; } + const char* right_percent = ""; + const char* real_op = op; + + if( !strcasecmp( op, "startwith") ) { + real_op = "like"; + right_percent = "|| '%'"; + growing_buffer* sql_buf = buffer_init( 32 ); buffer_fadd( sql_buf, - "%s%s %s %s %s %s%s", + "%s%s %s %s %s%s %s%s", left_parens, field_transform, - op, + real_op, left_parens, value, + right_percent, right_parens, right_parens );