Changeset: 9d0956084854 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d0956084854
Modified Files:
        sql/server/rel_select.c
Branch: Jul2015
Log Message:

There are two ways of combining NOT and LIKE: deal with both.
This prevents an infinite recursion in the case of NOT x LIKE y.
(The two ways are NOT x LIKE y and x NOT LIKE y.  They can be
combined: NOT x NOT LIKE y.)


diffs (31 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -2915,11 +2915,12 @@ rel_logical_value_exp(mvc *sql, sql_rel 
                return NULL;
        }
        case SQL_LIKE:
+       case SQL_NOT_LIKE:
        {
                symbol *lo = sc->data.lval->h->data.sym;
                symbol *ro = sc->data.lval->h->next->data.sym;
                int insensitive = sc->data.lval->h->next->next->data.i_val;
-               int anti = sc->data.lval->h->next->next->next->data.i_val;
+               int anti = (sc->token == SQL_NOT_LIKE) != 
(sc->data.lval->h->next->next->next->data.i_val != 0);
                sql_subtype *st = sql_bind_localtype("str");
                sql_exp *le = rel_value_exp(sql, rel, lo, f, ek);
                sql_exp *re, *ee = NULL;
@@ -3394,11 +3395,12 @@ rel_logical_exp(mvc *sql, sql_rel *rel, 
                return rel;
        }
        case SQL_LIKE:
+       case SQL_NOT_LIKE:
        {
                symbol *lo = sc->data.lval->h->data.sym;
                symbol *ro = sc->data.lval->h->next->data.sym;
                int insensitive = sc->data.lval->h->next->next->data.i_val;
-               int anti = sc->data.lval->h->next->next->next->data.i_val;
+               int anti = (sc->token == SQL_NOT_LIKE) != 
(sc->data.lval->h->next->next->next->data.i_val != 0);
                sql_subtype *st = sql_bind_localtype("str");
                sql_exp *le = rel_value_exp(sql, &rel, lo, f, ek);
                sql_exp *re, *ee = NULL;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to