diff options
author | unknown <sanja@askmonty.org> | 2011-07-21 13:15:09 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2011-07-21 13:15:09 +0300 |
commit | f675536aa48fd314ade0ee1ed56a44d4558642b4 (patch) | |
tree | 3fd031f88ec93de785a134844a5d1233713fd8e0 /sql/sql_parse.cc | |
parent | 30370ee2f040d76fd4122fdb34de807a5b82f2c8 (diff) | |
parent | ee06e4d65e42d303389605f3d30cbf0892be96af (diff) | |
download | mariadb-git-f675536aa48fd314ade0ee1ed56a44d4558642b4.tar.gz |
Merge 5.1->5.2
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e4169b1da62..c930eb0824a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6856,6 +6856,28 @@ push_new_name_resolution_context(THD *thd, /** + Fix condition which contains only field (f turns to f <> 0 ) + + @param cond The condition to fix + + @return fixed condition +*/ + +Item *normalize_cond(Item *cond) +{ + if (cond) + { + Item::Type type= cond->type(); + if (type == Item::FIELD_ITEM || type == Item::REF_ITEM) + { + cond= new Item_func_ne(cond, new Item_int(0)); + } + } + return cond; +} + + +/** Add an ON condition to the second operand of a JOIN ... ON. Add an ON condition to the right operand of a JOIN ... ON clause. @@ -6873,6 +6895,7 @@ void add_join_on(TABLE_LIST *b, Item *expr) { if (expr) { + expr= normalize_cond(expr); if (!b->on_expr) b->on_expr= expr; else |