From 2bd02714d2fb70cb75c78d6f1da43273d6572bf2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Apr 2005 12:28:25 +0300 Subject: Fixed a bug using mysqldump to InnoDB tables causes error (Bug #10200). sql/ha_innodb.cc: Fixed a bug using mysqldump to InnoDB tables causes error (Bug #10200). Lock type must be stored when sql_command = SQLCOM_LOCK_TABLES and lock_type = TL_READ or TL_READ_INSERT even when innobase_locks_unsafe_for_binlog is set. --- sql/ha_innodb.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 83c72594dfb..8f9671c5e67 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5340,15 +5340,14 @@ ha_innobase::store_lock( (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && thd->lex->sql_command != SQLCOM_SELECT && thd->lex->sql_command != SQLCOM_UPDATE_MULTI && - thd->lex->sql_command != SQLCOM_DELETE_MULTI ) { + thd->lex->sql_command != SQLCOM_DELETE_MULTI && + thd->lex->sql_command != SQLCOM_LOCK_TABLES) { /* In case we have innobase_locks_unsafe_for_binlog option set and isolation level of the transaction is not set to serializable and MySQL is doing INSERT INTO...SELECT without FOR UPDATE or IN - SHARE MODE we use consistent read for select. - Similarly, in case of DELETE...SELECT and - UPDATE...SELECT when these are not multi table.*/ + SHARE MODE we use consistent read for select. */ prebuilt->select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE; -- cgit v1.2.1 From 7a8357e8e0047ccf038ac32bec0f56575c9bb60d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 May 2005 12:24:56 +0300 Subject: Initial value for a auto_increment can now be set using ALTER TABLE AUTO_INCREMENT = X; or CREATE TABLE .. AUTO_INCREMENT = X; This change is backported from 5.0 (Bug #7061). sql/ha_innodb.cc: Initial value for a auto_increment can now be set using ALTER TABLE AUTO_INCREMENT = X; or CREATE TABLE .. AUTO_INCREMENT = X; This change is backported from 5.0. --- sql/ha_innodb.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 8f9671c5e67..dea938f126e 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1216,7 +1216,7 @@ innobase_commit( &innodb_dummy_stmt_trx_handle: the latter means that the current SQL statement ended */ { - trx_t* trx; + trx_t* trx; DBUG_ENTER("innobase_commit"); DBUG_PRINT("trans", ("ending transaction")); @@ -3939,6 +3939,20 @@ ha_innobase::create( DBUG_ASSERT(innobase_table != 0); + if ((create_info->used_fields & HA_CREATE_USED_AUTO) && + (create_info->auto_increment_value != 0)) { + + /* Query was ALTER TABLE...AUTO_INCREMENT = x; or + CREATE TABLE ...AUTO_INCREMENT = x; Find out a table + definition from the dictionary and get the current value + of the auto increment field. Set a new value to the + auto increment field if the value is greater than the + maximum value in the column. */ + + auto_inc_value = create_info->auto_increment_value; + dict_table_autoinc_initialize(innobase_table, auto_inc_value); + } + /* Tell the InnoDB server that there might be work for utility threads: */ @@ -5346,8 +5360,9 @@ ha_innobase::store_lock( /* In case we have innobase_locks_unsafe_for_binlog option set and isolation level of the transaction is not set to serializable and MySQL is doing - INSERT INTO...SELECT without FOR UPDATE or IN - SHARE MODE we use consistent read for select. */ + INSERT INTO...SELECT or UPDATE ... = (SELECT ...) + without FOR UPDATE or IN SHARE MODE in select, then + we use consistent read for select. */ prebuilt->select_lock_type = LOCK_NONE; prebuilt->stored_select_lock_type = LOCK_NONE; -- cgit v1.2.1 From 709c4ad12060786d6eb97e5952f7a7390bbfa2ba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 08:08:39 +0300 Subject: Fig compiler error. --- sql/ha_innodb.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql') diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index dea938f126e..0cb0f5564bf 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3766,6 +3766,7 @@ ha_innobase::create( char name2[FN_REFLEN]; char norm_name[FN_REFLEN]; THD *thd= current_thd; + ib_longlong auto_inc_value; DBUG_ENTER("ha_innobase::create"); -- cgit v1.2.1 From f59fef3f972a5ae06523f811c55ef713a9303679 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 09:15:14 +0200 Subject: terminal.c, sql_bitmap.h, my_sys.h, configure.in, config.h: Initial Metrowerks CodeWarrior compiler support cmd-line-utils/libedit/config.h: Initial Metrowerks CodeWarrior compiler support configure.in: Initial Metrowerks CodeWarrior compiler support include/my_sys.h: Initial Metrowerks CodeWarrior compiler support sql/sql_bitmap.h: Initial Metrowerks CodeWarrior compiler support cmd-line-utils/readline/terminal.c: Initial Metrowerks CodeWarrior compiler support --- sql/sql_bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 5c51f3ecb67..2fd603d9381 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -91,7 +91,7 @@ template <> class Bitmap<64> ulonglong map; public: Bitmap<64>() { } -#if defined(__NETWARE__) +#if defined(__NETWARE__) || defined(__MWERKS__) /* Metwork compiler gives error on Bitmap<64> Changed to Bitmap, since in this case also it will proper construct -- cgit v1.2.1 From c758512a9176b40532f8431e7771f8dbeed77111 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 12:55:09 +0400 Subject: A fix and test case for Bug#9777 " Empty set returned by Prepared Statement when it should return a non empty one" (see comments for the changed files for details). mysql-test/r/ps.result: A test case for Bug#9777: tests results fixed. mysql-test/t/ps.test: A test case for Bug#9777 sql/item.cc: A fix for Bug#9777: when creating a constant item from within Item_int_with_ref::new_item, create the item by value, not by name. This should work with prepared statements placeholders. Item_int_with_ref is a special optimization case used when we compare datetime constants with datetime value. Converting the item to integer early is OK as it is in line with the purpose of Item_int_with_ref - to speed up comparison by using integers. Minor cleanups. sql/item.h: Declaration for Item_int_with_ref::new_item --- sql/item.cc | 24 +++++++++++++++++++++++- sql/item.h | 7 ++----- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'sql') diff --git a/sql/item.cc b/sql/item.cc index 7e74bb1fd85..211e165cc6b 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -769,6 +769,13 @@ Item_uint::Item_uint(const char *str_arg, uint length): } +Item_uint::Item_uint(const char *str_arg, longlong i, uint length): + Item_int(str_arg, i, length) +{ + unsigned_flag= 1; +} + + String *Item_uint::val_str(String *str) { // following assert is redundant, because fixed=1 assigned in constructor @@ -1377,7 +1384,9 @@ Item_param::new_item() case NULL_VALUE: return new Item_null(name); case INT_VALUE: - return new Item_int(name, value.integer, max_length); + return (unsigned_flag ? + new Item_uint(name, value.integer, max_length) : + new Item_int(name, value.integer, max_length)); case REAL_VALUE: return new Item_real(name, value.real, decimals, max_length); case STRING_VALUE: @@ -2023,6 +2032,19 @@ bool Item_int::eq(const Item *arg, bool binary_cmp) const } +Item *Item_int_with_ref::new_item() +{ + DBUG_ASSERT(ref->basic_const_item()); + /* + We need to evaluate the constant to make sure it works with + parameter markers. + */ + return (ref->unsigned_flag ? + new Item_uint(ref->name, ref->val_int(), ref->max_length) : + new Item_int(ref->name, ref->val_int(), ref->max_length)); +} + + Item_num *Item_uint::neg() { return new Item_real(name, - ((double) value), 0, max_length); diff --git a/sql/item.h b/sql/item.h index 3f3ff491bb5..6f1f56451ab 100644 --- a/sql/item.h +++ b/sql/item.h @@ -651,6 +651,7 @@ class Item_uint :public Item_int { public: Item_uint(const char *str_arg, uint length); + Item_uint(const char *str_arg, longlong i, uint length); Item_uint(uint32 i) :Item_int((longlong) i, 10) { unsigned_flag= 1; } double val() @@ -1046,11 +1047,7 @@ public: { return ref->save_in_field(field, no_conversions); } - Item *new_item() - { - return (ref->unsigned_flag)? new Item_uint(ref->name, ref->max_length) : - new Item_int(ref->name, ref->max_length); - } + Item *new_item(); }; -- cgit v1.2.1