Below is the list of changes that have just been committed into a local
5.0 repository of mskold. When mskold does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-03-19 15:25:56+01:00, mskold@stripped +4 -0
ha_ndbcluster_cond.h, ha_ndbcluster_cond.cc:
bug#35185 SELECT LIKE gives wrong results when ndbcluster engine is used: Post-review fixes
item.h, mysql_com.h:
Adding max values for enums to support allocating bitmasks of correct size
include/mysql_com.h@stripped, 2008-03-19 15:23:49+01:00, mskold@stripped +21 -19
Adding max values for enums to support allocating bitmasks of correct size
sql/ha_ndbcluster_cond.cc@stripped, 2008-03-19 15:25:44+01:00, mskold@stripped +2 -1
bug#35185 SELECT LIKE gives wrong results when ndbcluster engine is used: Post-review fixes
sql/ha_ndbcluster_cond.h@stripped, 2008-03-19 15:25:44+01:00, mskold@stripped +24 -7
bug#35185 SELECT LIKE gives wrong results when ndbcluster engine is used: Post-review fixes
sql/item.h@stripped, 2008-03-19 15:23:49+01:00, mskold@stripped +4 -1
Adding max values for enums to support allocating bitmasks of correct size
diff -Nrup a/include/mysql_com.h b/include/mysql_com.h
--- a/include/mysql_com.h 2007-12-13 11:53:21 +01:00
+++ b/include/mysql_com.h 2008-03-19 15:23:49 +01:00
@@ -224,25 +224,25 @@ typedef struct st_net {
#define packet_error (~(unsigned long) 0)
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
- MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
- MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
- MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
- MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
- MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
- MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
- MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
- MYSQL_TYPE_BIT,
+ MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
+ MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
+ MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
+ MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
+ MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
+ MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
+ MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
+ MYSQL_TYPE_BIT,
MYSQL_TYPE_NEWDECIMAL=246,
- MYSQL_TYPE_ENUM=247,
- MYSQL_TYPE_SET=248,
- MYSQL_TYPE_TINY_BLOB=249,
- MYSQL_TYPE_MEDIUM_BLOB=250,
- MYSQL_TYPE_LONG_BLOB=251,
- MYSQL_TYPE_BLOB=252,
- MYSQL_TYPE_VAR_STRING=253,
- MYSQL_TYPE_STRING=254,
- MYSQL_TYPE_GEOMETRY=255
-
+ MYSQL_TYPE_ENUM=247,
+ MYSQL_TYPE_SET=248,
+ MYSQL_TYPE_TINY_BLOB=249,
+ MYSQL_TYPE_MEDIUM_BLOB=250,
+ MYSQL_TYPE_LONG_BLOB=251,
+ MYSQL_TYPE_BLOB=252,
+ MYSQL_TYPE_VAR_STRING=253,
+ MYSQL_TYPE_STRING=254,
+ MYSQL_TYPE_GEOMETRY=255,
+ MAX_NO_FIELD_TYPES // Should always be last
};
/* For backward compatibility */
@@ -370,7 +370,9 @@ struct rand_struct {
/* The following is for user defined functions */
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
- DECIMAL_RESULT};
+ DECIMAL_RESULT,
+ MAX_NO_ITEM_RESULTS // Should always be last
+};
typedef struct st_udf_args
{
diff -Nrup a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc
--- a/sql/ha_ndbcluster_cond.cc 2008-03-18 13:24:56 +01:00
+++ b/sql/ha_ndbcluster_cond.cc 2008-03-19 15:25:44 +01:00
@@ -896,7 +896,8 @@ void ndb_serialize_cond(const Item *item
context->supported= FALSE;
}
}
- if (pop) context->expect_stack.pop();
+ if (pop)
+ context->expect_stack.pop();
}
if (context->supported && context->rewrite_stack)
{
diff -Nrup a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h
--- a/sql/ha_ndbcluster_cond.h 2008-03-18 13:24:56 +01:00
+++ b/sql/ha_ndbcluster_cond.h 2008-03-19 15:25:44 +01:00
@@ -22,6 +22,8 @@
#pragma interface /* gcc class implementation */
#endif
+#define round_up_byte(size) ((size + 7) >> 3) << 3
+
typedef enum ndb_item_type {
NDB_VALUE = 0, // Qualified more with Item::Type
NDB_FIELD = 1, // Qualified from table definition
@@ -302,22 +304,36 @@ class Ndb_cond_stack : public Sql_alloc
Ndb_cond_stack *next;
};
+/*
+ This class implements look-ahead during the parsing
+ of the item tree. It contains bit masks for expected
+ items, field types and field results. It also contains
+ expected collation. The parse context (Ndb_cond_traverse_context)
+ always contains one expect_stack instance (top of the stack).
+ More expects (deeper look-ahead) can be pushed to the expect_stack
+ to check specific order (currently used for detecting support for
+ <field> LIKE <string>|<func>, but not <string>|<func> LIKE <field>).
+ */
class Ndb_expect_stack : public Sql_alloc
{
public:
Ndb_expect_stack(): collation(NULL), next(NULL)
{
// Allocate type checking bitmaps
- bitmap_init(&expect_mask, 0, 512, FALSE);
- bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
- bitmap_init(&expect_field_result_mask, 0, 512, FALSE);
+ bitmap_init(&expect_mask,
+ 0, round_up_byte(Item::MAX_NO_ITEMS), FALSE);
+ bitmap_init(&expect_field_type_mask,
+ 0, round_up_byte(MAX_NO_FIELD_TYPES), FALSE);
+ bitmap_init(&expect_field_result_mask,
+ 0, round_up_byte(MAX_NO_ITEM_RESULTS), FALSE);
};
~Ndb_expect_stack()
{
bitmap_free(&expect_mask);
bitmap_free(&expect_field_type_mask);
bitmap_free(&expect_field_result_mask);
- if (next) delete next;
+ if (next)
+ delete next;
next= NULL;
}
void push(Ndb_expect_stack* expect_next)
@@ -343,7 +359,8 @@ class Ndb_expect_stack : public Sql_allo
void expect(Item::Type type)
{
bitmap_set_bit(&expect_mask, (uint) type);
- if (type == Item::FIELD_ITEM) expect_all_field_types();
+ if (type == Item::FIELD_ITEM)
+ expect_all_field_types();
};
void dont_expect(Item::Type type)
{
@@ -467,8 +484,8 @@ class Ndb_cond_traverse_context : public
: table(tab), ndb_table(ndb_tab),
supported(TRUE), cond_stack(stack), cond_ptr(NULL),
skip(0), rewrite_stack(NULL)
- {
- if (stack)
+ {
+ if (stack)
cond_ptr= stack->ndb_cond;
};
~Ndb_cond_traverse_context()
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h 2007-12-13 11:49:11 +01:00
+++ b/sql/item.h 2008-03-19 15:23:49 +01:00
@@ -453,7 +453,10 @@ public:
FIELD_VARIANCE_ITEM, INSERT_VALUE_ITEM,
SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM, TYPE_HOLDER,
PARAM_ITEM, TRIGGER_FIELD_ITEM, DECIMAL_ITEM,
- VIEW_FIXER_ITEM};
+ VIEW_FIXER_ITEM,
+ // Add new item types here
+ MAX_NO_ITEMS // Should always be last
+ };
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
Thread |
---|
• bk commit into 5.0 tree (mskold:1.2573) BUG#35185 | Martin Skold | 19 Mar |