summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mskold/marty@linux.site>2006-09-06 11:21:49 +0200
committerunknown <mskold/marty@linux.site>2006-09-06 11:21:49 +0200
commit431a67376ea1fe1b180ff39b467803b51945e34c (patch)
tree68c2739e2f358e9fe7ad60a50dfe9b2e031fd37b /sql
parenteb9d5675d49ee2582d80d8b6b29a669c65df5574 (diff)
parent545c9b8fdecad04d6b5acaaa1400ca8be7a7066c (diff)
downloadmariadb-git-431a67376ea1fe1b180ff39b467803b51945e34c.tar.gz
Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1 mysql-test/r/ndb_condition_pushdown.result: Auto merged mysql-test/t/ndb_condition_pushdown.test: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_ndbcluster.h: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc5
-rw-r--r--sql/ha_ndbcluster.h28
2 files changed, 31 insertions, 2 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 038d2a05e7e..518b15e8cf8 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -8590,11 +8590,13 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("FIELD_ITEM"));
DBUG_PRINT("info", ("table %s", tab->getName()));
DBUG_PRINT("info", ("column %s", field->field_name));
+ DBUG_PRINT("info", ("type %d", field->type()));
DBUG_PRINT("info", ("result type %d", field->result_type()));
// Check that we are expecting a field and with the correct
// result type
if (context->expecting(Item::FIELD_ITEM) &&
+ context->expecting_field_type(field->type()) &&
(context->expecting_field_result(field->result_type()) ||
// Date and year can be written as string or int
((type == MYSQL_TYPE_TIME ||
@@ -8814,6 +8816,9 @@ void ndb_serialize_cond(const Item *item, void *arg)
func_item);
context->expect(Item::STRING_ITEM);
context->expect(Item::FIELD_ITEM);
+ context->expect_only_field_type(MYSQL_TYPE_STRING);
+ context->expect_field_type(MYSQL_TYPE_VAR_STRING);
+ context->expect_field_type(MYSQL_TYPE_VARCHAR);
context->expect_field_result(STRING_RESULT);
context->expect(Item::FUNC_ITEM);
break;
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 787e9befeb3..4301eaad79c 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -461,8 +461,8 @@ class Ndb_cond_traverse_context
Ndb_cond_traverse_context(TABLE *tab, void* ndb_tab, Ndb_cond_stack* stack)
: table(tab), ndb_table(ndb_tab),
supported(TRUE), stack_ptr(stack), cond_ptr(NULL),
- expect_mask(0), expect_field_result_mask(0), skip(0), collation(NULL),
- rewrite_stack(NULL)
+ expect_mask(0), expect_field_type_mask(0), expect_field_result_mask(0),
+ skip(0), collation(NULL), rewrite_stack(NULL)
{
if (stack)
cond_ptr= stack->ndb_cond;
@@ -474,6 +474,7 @@ class Ndb_cond_traverse_context
void expect(Item::Type type)
{
expect_mask|= (1 << type);
+ if (type == Item::FIELD_ITEM) expect_all_field_types();
};
void dont_expect(Item::Type type)
{
@@ -493,6 +494,28 @@ class Ndb_cond_traverse_context
expect(type);
};
+ void expect_field_type(enum_field_types result)
+ {
+ expect_field_type_mask|= (1 << result);
+ };
+ void expect_all_field_types()
+ {
+ expect_field_type_mask= ~0;
+ };
+ bool expecting_field_type(enum_field_types result)
+ {
+ return (expect_field_type_mask & (1 << result));
+ };
+ void expect_no_field_type()
+ {
+ expect_field_type_mask= 0;
+ };
+ void expect_only_field_type(enum_field_types result)
+ {
+ expect_field_type_mask= 0;
+ expect_field_type(result);
+ };
+
void expect_field_result(Item_result result)
{
expect_field_result_mask|= (1 << result);
@@ -528,6 +551,7 @@ class Ndb_cond_traverse_context
Ndb_cond_stack* stack_ptr;
Ndb_cond* cond_ptr;
uint expect_mask;
+ uint expect_field_type_mask;
uint expect_field_result_mask;
uint skip;
CHARSET_INFO* collation;