diff options
author | unknown <monty@mysql.com> | 2005-02-22 15:47:00 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-02-22 15:47:00 +0200 |
commit | ce99d4430f71a0e83298e67f2e33b660630c715d (patch) | |
tree | 775f6aaae95a3574b8d285d2433c3797b653e482 /sql | |
parent | 6965e72bd07874efee8ff6f94ab664533fc422e0 (diff) | |
parent | 2ae6eb094bb02a3e41ab611c9e9f27982a2ef9c3 (diff) | |
download | mariadb-git-ce99d4430f71a0e83298e67f2e33b660630c715d.tar.gz |
Merge with 4.1
BitKeeper/etc/logging_ok:
auto-union
client/mysql.cc:
Auto merged
extra/my_print_defaults.c:
Auto merged
include/m_string.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/user_var.result:
Auto merged
mysql-test/t/user_var.test:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
strings/ctype-simple.c:
Auto merged
strings/ctype-ucs2.c:
Auto merged
strings/ctype-utf8.c:
Auto merged
libmysql/libmysql.c:
ul
mysql-test/r/ps_1general.result:
Merge
mysql-test/t/derived.test:
Merge
mysql-test/t/ps_1general.test:
Merge
mysql-test/t/type_float.test:
Merge
sql/field.cc:
ul
sql/item.cc:
ul
sql/item.h:
ul
sql/item_func.h:
ul
sql/item_strfunc.cc:
ul
sql/item_sum.cc:
ul
sql/item_sum.h:
ul
sql/procedure.h:
ul
sql/sql_derived.cc:
Trivial merge
sql/sql_parse.cc:
ul
sql/sql_update.cc:
Trivial merge
strings/strtod.c:
Use updated code from 4.1
This is bascily same code as we had before or 5.0, execpt that we now have higher accuracy for floating points value that are integers (like 123.45E+02)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 11 | ||||
-rw-r--r-- | sql/item_func.cc | 10 | ||||
-rw-r--r-- | sql/item_sum.h | 4 | ||||
-rw-r--r-- | sql/procedure.h | 2 | ||||
-rw-r--r-- | sql/sql_derived.cc | 8 | ||||
-rw-r--r-- | sql/sql_update.cc | 7 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
7 files changed, 34 insertions, 10 deletions
diff --git a/sql/field.cc b/sql/field.cc index a32b402cbdb..194f4522851 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2432,12 +2432,23 @@ void Field_medium::sql_type(String &res) const ** long int ****************************************************************************/ +/* + A helper function to check whether the next character + in the string "s" is MINUS SIGN. +*/ +#ifdef HAVE_CHARSET_ucs2 static bool test_if_minus(CHARSET_INFO *cs, const char *s, const char *e) { my_wc_t wc; return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-'; } +#else +/* + If not UCS2 support is compiled then it is easier +*/ +#define test_if_minus(cs, s, e) (*s == '-') +#endif int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) diff --git a/sql/item_func.cc b/sql/item_func.cc index 40abd130d02..3742a13e0bc 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3169,7 +3169,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->value=0; entry->length=0; entry->update_query_id=0; - entry->collation.set(NULL, DERIVATION_NONE); + entry->collation.set(NULL, DERIVATION_IMPLICIT); /* If we are here, we were called from a SET or a query which sets a variable. Imagine it is this: @@ -3227,8 +3227,8 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, and the variable has previously been initialized. */ if (!entry->collation.collation || !args[0]->null_value) - entry->collation.set(args[0]->collation); - collation.set(entry->collation); + entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT); + collation.set(entry->collation.collation, DERIVATION_IMPLICIT); cached_result_type= args[0]->result_type(); return FALSE; } @@ -3240,7 +3240,7 @@ Item_func_set_user_var::fix_length_and_dec() maybe_null=args[0]->maybe_null; max_length=args[0]->max_length; decimals=args[0]->decimals; - collation.set(args[0]->collation); + collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT); } @@ -3516,7 +3516,7 @@ Item_func_set_user_var::update() res= update_hash((void*) save_result.vstr->ptr(), save_result.vstr->length(), STRING_RESULT, save_result.vstr->charset(), - args[0]->collation.derivation); + DERIVATION_IMPLICIT); break; } case DECIMAL_RESULT: diff --git a/sql/item_sum.h b/sql/item_sum.h index e284416f0f5..c3eae176b1f 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -691,7 +691,9 @@ public: { int err_not_used; char *end_not_used; - String *res; res=val_str(&str_value); + char *end_not_used; + String *res; + res=val_str(&str_value); return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(), &end_not_used, &err_not_used) : 0.0; } diff --git a/sql/procedure.h b/sql/procedure.h index 4e5bf8a2f4b..5d0dccbcd5e 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -110,7 +110,7 @@ public: { int err_not_used; char *end_not_used; - CHARSET_INFO *cs=str_value.charset(); + CHARSET_INFO *cs= str_value.charset(); return my_strntod(cs, (char*) str_value.ptr(), str_value.length(), &end_not_used, &err_not_used); } diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index c01728e68d5..eb7b3e8a319 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -124,10 +124,16 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list) /* Temp table is created so that it hounours if UNION without ALL is to be processed + + As 'distinct' parameter we always pass FALSE (0), because underlying + query will control distinct condition by itself. Correct test of + distinct underlying query will be is_union && + !unit->union_distinct->next_select() (i.e. it is union and last distinct + SELECT is last SELECT of UNION). */ if (!(table= create_tmp_table(thd, &derived_result->tmp_table_param, unit->types, (ORDER*) 0, - is_union && unit->union_distinct, 1, + FALSE, 1, (first_select->options | thd->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR, diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b7a088ff37c..80ad13195c8 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -707,7 +707,12 @@ bool mysql_multi_update_prepare(THD *thd) else { DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias)); - tl->lock_type= TL_READ; + /* + If we are using the binary log, we need TL_READ_NO_INSERT to get + correct order of statements. Otherwise, we use a TL_READ lock to + improve performance. + */ + tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ; tl->updating= 0; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c75068f0047..ba1b999b240 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2451,7 +2451,7 @@ create_select: SELECT_SYM { LEX *lex=Lex; - lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; + lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ; if (lex->sql_command == SQLCOM_INSERT) lex->sql_command= SQLCOM_INSERT_SELECT; else if (lex->sql_command == SQLCOM_REPLACE) |