Merged 4.1 into 5.0.

client/mysql.cc:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/lex.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/share/czech/errmsg.txt:
  Auto merged
sql/share/romanian/errmsg.txt:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
This commit is contained in:
unknown 2003-04-16 23:23:23 +02:00
commit 36752387c1
97 changed files with 1927 additions and 610 deletions

View file

@ -602,3 +602,6 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
myisam/ftbench/var/*
myisam/ftbench/data
myisam/ftbench/t

View file

@ -1,117 +0,0 @@
LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.0 Client Library'
VERSION 4.0
EXPORTS
mysql_affected_rows
mysql_close
mysql_data_seek
mysql_debug
mysql_dump_debug_info
mysql_eof
mysql_errno
mysql_error
mysql_escape_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
mysql_fetch_lengths
mysql_fetch_row
mysql_field_count
mysql_field_seek
mysql_field_tell
mysql_free_result
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
mysql_get_server_info
mysql_info
mysql_init
mysql_insert_id
mysql_kill
mysql_list_dbs
mysql_list_fields
mysql_list_processes
mysql_list_tables
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_ping
mysql_query
mysql_real_connect
mysql_real_query
mysql_refresh
mysql_row_seek
mysql_row_tell
mysql_select_db
mysql_shutdown
mysql_stat
mysql_store_result
mysql_thread_id
mysql_use_result
bmove_upp
delete_dynamic
_dig_vec
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
max_allowed_packet
my_init
my_end
my_strdup
my_malloc
my_memdup
my_no_flags_free
my_realloc
my_thread_end
my_thread_init
net_buffer_length
set_dynamic
strcend
strdup_root
strfill
strinstr
strmake
strmov
strxmov
myodbc_remove_escape
mysql_thread_safe
mysql_character_set_name
mysql_change_user
mysql_send_query
mysql_read_query_result
mysql_real_escape_string
mysql_ssl_set
mysql_real_connect
mysql_master_query
mysql_master_send_query
mysql_slave_query
mysql_slave_send_query
mysql_enable_rpl_parse
mysql_disable_rpl_parse
mysql_rpl_parse_enabled
mysql_enable_reads_from_master
mysql_disable_reads_from_master
mysql_reads_from_master_enabled
mysql_rpl_query_type
mysql_rpl_probe
mysql_set_master
mysql_add_slave

2
bdb/dist/s_all vendored
View file

@ -20,4 +20,4 @@ sh s_win32_dsp # Win32 build environment.
#sh s_vxworks # VxWorks include files.
#sh s_java # Java support.
sh s_test # Test suite support.
#sh s_tags # Tags files.
sh s_tags # Tags files.

View file

@ -40,6 +40,10 @@
#include <signal.h>
#include <violite.h>
#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
#include <locale.h>
#endif
const char *VER= "13.5";
/* Don't try to make a nice table if the data is too big */
@ -1114,6 +1118,9 @@ static void initialize_readline (char *name)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
#elif defined(USE_LIBEDIT_INTERFACE)
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= (CPFunction*)&no_completion;
#else

View file

@ -184,135 +184,135 @@ private const el_action_t el_map_emacs[] = {
/* 124 */ ED_INSERT, /* | */
/* 125 */ ED_INSERT, /* } */
/* 126 */ ED_INSERT, /* ~ */
/* 127 */ ED_INSERT, /* ^? */
/* 128 */ ED_INSERT, /* M-^@ */
/* 129 */ ED_INSERT, /* M-^A */
/* 130 */ ED_INSERT, /* M-^B */
/* 131 */ ED_INSERT, /* M-^C */
/* 132 */ ED_INSERT, /* M-^D */
/* 133 */ ED_INSERT, /* M-^E */
/* 134 */ ED_INSERT, /* M-^F */
/* 135 */ ED_INSERT, /* M-^G */
/* 136 */ ED_INSERT, /* M-^H */
/* 137 */ ED_INSERT, /* M-^I */
/* 138 */ ED_INSERT, /* M-^J */
/* 139 */ ED_INSERT, /* M-^K */
/* 140 */ ED_INSERT, /* M-^L */
/* 141 */ ED_INSERT, /* M-^M */
/* 142 */ ED_INSERT, /* M-^N */
/* 143 */ ED_INSERT, /* M-^O */
/* 144 */ ED_INSERT, /* M-^P */
/* 145 */ ED_INSERT, /* M-^Q */
/* 146 */ ED_INSERT, /* M-^R */
/* 147 */ ED_INSERT, /* M-^S */
/* 148 */ ED_INSERT, /* M-^T */
/* 149 */ ED_INSERT, /* M-^U */
/* 150 */ ED_INSERT, /* M-^V */
/* 151 */ ED_INSERT, /* M-^W */
/* 152 */ ED_INSERT, /* M-^X */
/* 153 */ ED_INSERT, /* M-^Y */
/* 154 */ ED_INSERT, /* M-^Z */
/* 155 */ ED_INSERT, /* M-^[ */
/* 156 */ ED_INSERT, /* M-^\ */
/* 157 */ ED_INSERT, /* M-^] */
/* 158 */ ED_INSERT, /* M-^^ */
/* 159 */ ED_INSERT, /* M-^_ */
/* 160 */ ED_INSERT, /* M-SPACE */
/* 161 */ ED_INSERT, /* M-! */
/* 162 */ ED_INSERT, /* M-" */
/* 163 */ ED_INSERT, /* M-# */
/* 164 */ ED_INSERT, /* M-$ */
/* 165 */ ED_INSERT, /* M-% */
/* 166 */ ED_INSERT, /* M-& */
/* 167 */ ED_INSERT, /* M-' */
/* 168 */ ED_INSERT, /* M-( */
/* 169 */ ED_INSERT, /* M-) */
/* 170 */ ED_INSERT, /* M-* */
/* 171 */ ED_INSERT, /* M-+ */
/* 172 */ ED_INSERT, /* M-, */
/* 173 */ ED_INSERT, /* M-- */
/* 174 */ ED_INSERT, /* M-. */
/* 175 */ ED_INSERT, /* M-/ */
/* 176 */ ED_INSERT, /* M-0 */
/* 177 */ ED_INSERT, /* M-1 */
/* 178 */ ED_INSERT, /* M-2 */
/* 179 */ ED_INSERT, /* M-3 */
/* 180 */ ED_INSERT, /* M-4 */
/* 181 */ ED_INSERT, /* M-5 */
/* 182 */ ED_INSERT, /* M-6 */
/* 183 */ ED_INSERT, /* M-7 */
/* 184 */ ED_INSERT, /* M-8 */
/* 185 */ ED_INSERT, /* M-9 */
/* 186 */ ED_INSERT, /* M-: */
/* 187 */ ED_INSERT, /* M-; */
/* 188 */ ED_INSERT, /* M-< */
/* 189 */ ED_INSERT, /* M-= */
/* 190 */ ED_INSERT, /* M-> */
/* 191 */ ED_INSERT, /* M-? */
/* 192 */ ED_INSERT, /* M-@ */
/* 193 */ ED_INSERT, /* M-A */
/* 194 */ ED_INSERT, /* M-B */
/* 195 */ ED_INSERT, /* M-C */
/* 196 */ ED_INSERT, /* M-D */
/* 197 */ ED_INSERT, /* M-E */
/* 198 */ ED_INSERT, /* M-F */
/* 199 */ ED_INSERT, /* M-G */
/* 200 */ ED_INSERT, /* M-H */
/* 201 */ ED_INSERT, /* M-I */
/* 202 */ ED_INSERT, /* M-J */
/* 203 */ ED_INSERT, /* M-K */
/* 204 */ ED_INSERT, /* M-L */
/* 205 */ ED_INSERT, /* M-M */
/* 206 */ ED_INSERT, /* M-N */
/* 207 */ ED_INSERT, /* M-O */
/* 208 */ ED_INSERT, /* M-P */
/* 209 */ ED_INSERT, /* M-Q */
/* 210 */ ED_INSERT, /* M-R */
/* 211 */ ED_INSERT, /* M-S */
/* 212 */ ED_INSERT, /* M-T */
/* 213 */ ED_INSERT, /* M-U */
/* 214 */ ED_INSERT, /* M-V */
/* 215 */ ED_INSERT, /* M-W */
/* 216 */ ED_INSERT, /* M-X */
/* 217 */ ED_INSERT, /* M-Y */
/* 218 */ ED_INSERT, /* M-Z */
/* 219 */ ED_INSERT, /* M-[ */
/* 220 */ ED_INSERT, /* M-\ */
/* 221 */ ED_INSERT, /* M-] */
/* 222 */ ED_INSERT, /* M-^ */
/* 223 */ ED_INSERT, /* M-_ */
/* 223 */ ED_INSERT, /* M-` */
/* 224 */ ED_INSERT, /* M-a */
/* 225 */ ED_INSERT, /* M-b */
/* 226 */ ED_INSERT, /* M-c */
/* 227 */ ED_INSERT, /* M-d */
/* 228 */ ED_INSERT, /* M-e */
/* 229 */ ED_INSERT, /* M-f */
/* 230 */ ED_INSERT, /* M-g */
/* 231 */ ED_INSERT, /* M-h */
/* 232 */ ED_INSERT, /* M-i */
/* 233 */ ED_INSERT, /* M-j */
/* 234 */ ED_INSERT, /* M-k */
/* 235 */ ED_INSERT, /* M-l */
/* 236 */ ED_INSERT, /* M-m */
/* 237 */ ED_INSERT, /* M-n */
/* 238 */ ED_INSERT, /* M-o */
/* 239 */ ED_INSERT, /* M-p */
/* 240 */ ED_INSERT, /* M-q */
/* 241 */ ED_INSERT, /* M-r */
/* 242 */ ED_INSERT, /* M-s */
/* 243 */ ED_INSERT, /* M-t */
/* 244 */ ED_INSERT, /* M-u */
/* 245 */ ED_INSERT, /* M-v */
/* 246 */ ED_INSERT, /* M-w */
/* 247 */ ED_INSERT, /* M-x */
/* 248 */ ED_INSERT, /* M-y */
/* 249 */ ED_INSERT, /* M-z */
/* 250 */ ED_INSERT, /* M-{ */
/* 251 */ ED_INSERT, /* M-| */
/* 252 */ ED_INSERT, /* M-} */
/* 253 */ ED_INSERT, /* M-~ */
/* 254 */ ED_INSERT /* M-^? */
/* 127 */ ED_DELETE_PREV_CHAR, /* ^? */
/* 128 */ ED_UNASSIGNED, /* M-^@ */
/* 129 */ ED_UNASSIGNED, /* M-^A */
/* 130 */ ED_UNASSIGNED, /* M-^B */
/* 131 */ ED_UNASSIGNED, /* M-^C */
/* 132 */ ED_UNASSIGNED, /* M-^D */
/* 133 */ ED_UNASSIGNED, /* M-^E */
/* 134 */ ED_UNASSIGNED, /* M-^F */
/* 135 */ ED_UNASSIGNED, /* M-^G */
/* 136 */ ED_DELETE_PREV_WORD, /* M-^H */
/* 137 */ ED_UNASSIGNED, /* M-^I */
/* 138 */ ED_UNASSIGNED, /* M-^J */
/* 139 */ ED_UNASSIGNED, /* M-^K */
/* 140 */ ED_CLEAR_SCREEN, /* M-^L */
/* 141 */ ED_UNASSIGNED, /* M-^M */
/* 142 */ ED_UNASSIGNED, /* M-^N */
/* 143 */ ED_UNASSIGNED, /* M-^O */
/* 144 */ ED_UNASSIGNED, /* M-^P */
/* 145 */ ED_UNASSIGNED, /* M-^Q */
/* 146 */ ED_UNASSIGNED, /* M-^R */
/* 147 */ ED_UNASSIGNED, /* M-^S */
/* 148 */ ED_UNASSIGNED, /* M-^T */
/* 149 */ ED_UNASSIGNED, /* M-^U */
/* 150 */ ED_UNASSIGNED, /* M-^V */
/* 151 */ ED_UNASSIGNED, /* M-^W */
/* 152 */ ED_UNASSIGNED, /* M-^X */
/* 153 */ ED_UNASSIGNED, /* M-^Y */
/* 154 */ ED_UNASSIGNED, /* M-^Z */
/* 155 */ ED_UNASSIGNED, /* M-^[ */
/* 156 */ ED_UNASSIGNED, /* M-^\ */
/* 157 */ ED_UNASSIGNED, /* M-^] */
/* 158 */ ED_UNASSIGNED, /* M-^^ */
/* 159 */ EM_COPY_PREV_WORD, /* M-^_ */
/* 160 */ ED_UNASSIGNED, /* M-SPACE */
/* 161 */ ED_UNASSIGNED, /* M-! */
/* 162 */ ED_UNASSIGNED, /* M-" */
/* 163 */ ED_UNASSIGNED, /* M-# */
/* 164 */ ED_UNASSIGNED, /* M-$ */
/* 165 */ ED_UNASSIGNED, /* M-% */
/* 166 */ ED_UNASSIGNED, /* M-& */
/* 167 */ ED_UNASSIGNED, /* M-' */
/* 168 */ ED_UNASSIGNED, /* M-( */
/* 169 */ ED_UNASSIGNED, /* M-) */
/* 170 */ ED_UNASSIGNED, /* M-* */
/* 171 */ ED_UNASSIGNED, /* M-+ */
/* 172 */ ED_UNASSIGNED, /* M-, */
/* 173 */ ED_UNASSIGNED, /* M-- */
/* 174 */ ED_UNASSIGNED, /* M-. */
/* 175 */ ED_UNASSIGNED, /* M-/ */
/* 176 */ ED_ARGUMENT_DIGIT, /* M-0 */
/* 177 */ ED_ARGUMENT_DIGIT, /* M-1 */
/* 178 */ ED_ARGUMENT_DIGIT, /* M-2 */
/* 179 */ ED_ARGUMENT_DIGIT, /* M-3 */
/* 180 */ ED_ARGUMENT_DIGIT, /* M-4 */
/* 181 */ ED_ARGUMENT_DIGIT, /* M-5 */
/* 182 */ ED_ARGUMENT_DIGIT, /* M-6 */
/* 183 */ ED_ARGUMENT_DIGIT, /* M-7 */
/* 184 */ ED_ARGUMENT_DIGIT, /* M-8 */
/* 185 */ ED_ARGUMENT_DIGIT, /* M-9 */
/* 186 */ ED_UNASSIGNED, /* M-: */
/* 187 */ ED_UNASSIGNED, /* M-; */
/* 188 */ ED_UNASSIGNED, /* M-< */
/* 189 */ ED_UNASSIGNED, /* M-= */
/* 190 */ ED_UNASSIGNED, /* M-> */
/* 191 */ ED_UNASSIGNED, /* M-? */
/* 192 */ ED_UNASSIGNED, /* M-@ */
/* 193 */ ED_UNASSIGNED, /* M-A */
/* 194 */ ED_PREV_WORD, /* M-B */
/* 195 */ EM_CAPITOL_CASE, /* M-C */
/* 196 */ EM_DELETE_NEXT_WORD, /* M-D */
/* 197 */ ED_UNASSIGNED, /* M-E */
/* 198 */ EM_NEXT_WORD, /* M-F */
/* 199 */ ED_UNASSIGNED, /* M-G */
/* 200 */ ED_UNASSIGNED, /* M-H */
/* 201 */ ED_UNASSIGNED, /* M-I */
/* 202 */ ED_UNASSIGNED, /* M-J */
/* 203 */ ED_UNASSIGNED, /* M-K */
/* 204 */ EM_LOWER_CASE, /* M-L */
/* 205 */ ED_UNASSIGNED, /* M-M */
/* 206 */ ED_SEARCH_NEXT_HISTORY, /* M-N */
/* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */
/* 208 */ ED_SEARCH_PREV_HISTORY, /* M-P */
/* 209 */ ED_UNASSIGNED, /* M-Q */
/* 210 */ ED_UNASSIGNED, /* M-R */
/* 211 */ ED_UNASSIGNED, /* M-S */
/* 212 */ ED_UNASSIGNED, /* M-T */
/* 213 */ EM_UPPER_CASE, /* M-U */
/* 214 */ ED_UNASSIGNED, /* M-V */
/* 215 */ EM_COPY_REGION, /* M-W */
/* 216 */ ED_COMMAND, /* M-X */
/* 217 */ ED_UNASSIGNED, /* M-Y */
/* 218 */ ED_UNASSIGNED, /* M-Z */
/* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */
/* 220 */ ED_UNASSIGNED, /* M-\ */
/* 221 */ ED_UNASSIGNED, /* M-] */
/* 222 */ ED_UNASSIGNED, /* M-^ */
/* 223 */ ED_UNASSIGNED, /* M-_ */
/* 223 */ ED_UNASSIGNED, /* M-` */
/* 224 */ ED_UNASSIGNED, /* M-a */
/* 225 */ ED_PREV_WORD, /* M-b */
/* 226 */ EM_CAPITOL_CASE, /* M-c */
/* 227 */ EM_DELETE_NEXT_WORD, /* M-d */
/* 228 */ ED_UNASSIGNED, /* M-e */
/* 229 */ EM_NEXT_WORD, /* M-f */
/* 230 */ ED_UNASSIGNED, /* M-g */
/* 231 */ ED_UNASSIGNED, /* M-h */
/* 232 */ ED_UNASSIGNED, /* M-i */
/* 233 */ ED_UNASSIGNED, /* M-j */
/* 234 */ ED_UNASSIGNED, /* M-k */
/* 235 */ EM_LOWER_CASE, /* M-l */
/* 236 */ ED_UNASSIGNED, /* M-m */
/* 237 */ ED_SEARCH_NEXT_HISTORY, /* M-n */
/* 238 */ ED_UNASSIGNED, /* M-o */
/* 239 */ ED_SEARCH_PREV_HISTORY, /* M-p */
/* 240 */ ED_UNASSIGNED, /* M-q */
/* 241 */ ED_UNASSIGNED, /* M-r */
/* 242 */ ED_UNASSIGNED, /* M-s */
/* 243 */ ED_UNASSIGNED, /* M-t */
/* 244 */ EM_UPPER_CASE, /* M-u */
/* 245 */ ED_UNASSIGNED, /* M-v */
/* 246 */ EM_COPY_REGION, /* M-w */
/* 247 */ ED_COMMAND, /* M-x */
/* 248 */ ED_UNASSIGNED, /* M-y */
/* 249 */ ED_UNASSIGNED, /* M-z */
/* 250 */ ED_UNASSIGNED, /* M-{ */
/* 251 */ ED_UNASSIGNED, /* M-| */
/* 252 */ ED_UNASSIGNED, /* M-} */
/* 253 */ ED_UNASSIGNED, /* M-~ */
/* 254 */ ED_DELETE_PREV_WORD /* M-^? */
/* 255 */
};

View file

@ -93,7 +93,7 @@ private void
re_addc(EditLine *el, int c)
{
if (isprint(c) || ((unsigned char)c)>127) {
if (isprint(c)) {
re_putc(el, c, 1);
return;
}
@ -954,7 +954,7 @@ re_refresh_cursor(EditLine *el)
h = 1;
v++;
}
} else if (!isprint((unsigned char) c) || ((unsigned char)c)>127) {
} else if (!isprint((unsigned char) c)) {
h += 3;
if (h > th) { /* if overflow, compensate */
h = h - th;
@ -1047,7 +1047,7 @@ re_fastaddc(EditLine *el)
char mc = (c == '\177') ? '?' : (c | 0100);
re_fastputc(el, '^');
re_fastputc(el, mc);
} else if (isprint((unsigned char) c) || ((unsigned char)c)>127) { /* normal char */
} else if (isprint((unsigned char) c)) { /* normal char */
re_fastputc(el, c);
} else {
re_fastputc(el, '\\');

View file

@ -2211,7 +2211,7 @@ then
else
MYSQL_CHECK_LIBEDIT_INTERFACE
MYSQL_CHECK_NEW_RL_INTERFACE
if ["$mysql_cv_new_rl_interface"="yes"] || [test "$mysql_cv_libedit_interface"="no"]
if [test "$mysql_cv_new_rl_interface" = "yes"] || [test "$mysql_cv_libedit_interface" = "no"]
then
readline_link="-lreadline"
else

View file

@ -118,8 +118,11 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_KEEP_PREALLOC 1
#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */
/* defines when allocating data */
/* Internal error numbers (for assembler functions) */
#define MY_ERRNO_EDOM 33
#define MY_ERRNO_ERANGE 34
/* defines when allocating data */
#ifdef SAFEMALLOC
#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )

View file

@ -270,19 +270,23 @@
#define ER_COLLATION_CHARSET_MISMATCH 1251
#define ER_SLAVE_WAS_RUNNING 1252
#define ER_SLAVE_WAS_NOT_RUNNING 1253
#define ER_CUT_VALUE_GROUP_CONCAT 1254
#define ER_SP_NO_RECURSIVE_CREATE 1255
#define ER_SP_ALREADY_EXISTS 1256
#define ER_SP_DOES_NOT_EXIST 1257
#define ER_SP_DROP_FAILED 1258
#define ER_SP_STORE_FAILED 1259
#define ER_SP_LILABEL_MISMATCH 1260
#define ER_SP_LABEL_REDEFINE 1261
#define ER_SP_LABEL_MISMATCH 1262
#define ER_SP_UNINIT_VAR 1263
#define ER_SP_BADSELECT 1264
#define ER_SP_BADRETURN 1265
#define ER_SP_BADQUERY 1266
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1267
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1268
#define ER_ERROR_MESSAGES 269
#define ER_TOO_BIG_FOR_UNCOMPRESS 1254
#define ER_ZLIB_Z_MEM_ERROR 1255
#define ER_ZLIB_Z_BUF_ERROR 1256
#define ER_ZLIB_Z_DATA_ERROR 1257
#define ER_CUT_VALUE_GROUP_CONCAT 1258
#define ER_SP_NO_RECURSIVE_CREATE 1259
#define ER_SP_ALREADY_EXISTS 1260
#define ER_SP_DOES_NOT_EXIST 1261
#define ER_SP_DROP_FAILED 1262
#define ER_SP_STORE_FAILED 1263
#define ER_SP_LILABEL_MISMATCH 1264
#define ER_SP_LABEL_REDEFINE 1265
#define ER_SP_LABEL_MISMATCH 1266
#define ER_SP_UNINIT_VAR 1267
#define ER_SP_BADSELECT 1268
#define ER_SP_BADRETURN 1269
#define ER_SP_BADQUERY 1270
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1271
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1272
#define ER_ERROR_MESSAGES 273

View file

@ -122,6 +122,8 @@ EXPORTS
mysql_commit
mysql_rollback
mysql_autocommit
load_defaults
free_defaults

96
myisam/ftbench/Ecompare.pl Executable file
View file

@ -0,0 +1,96 @@
#!/usr/bin/perl
# compares out-files (as created by Ereport.pl) from dir1/*.out and dir2/*.out
# for each effectiveness column computes the probability of the hypothesis
# "Both files have the same effectiveness"
# sign test is used to verify that test results are statistically
# significant to support the hypothesis. Function is computed on the fly.
# basic formula is \sum_{r=0}^R C_N^r 2^{-N}
# As N can be big, we'll work with logarithms
$log2=log(2);
sub probab {
my $N=shift, $R=shift;
my $r, $sum=0;
for $r (0..$R) {
$sum+=exp(logfac($N)-logfac($r)-logfac($N-$r)-$N*$log2);
}
return $sum;
}
# log(N!)
# for N<20 exact value from the table (below) is taken
# otherwise, Stirling approximation for N! is used
sub logfac {
my $n=shift; die "n=$n<0" if $n<0;
return $logfactab[$n] if $n<=$#logfactab;
return $n*log($n)-$n+log(2*3.14159265358*$n)/2;
}
@logfactab=(
0, 0, 0.693147180559945, 1.79175946922805, 3.17805383034795,
4.78749174278205, 6.57925121201010, 8.52516136106541, 10.6046029027453,
12.8018274800815, 15.1044125730755, 17.5023078458739, 19.9872144956619,
22.5521638531234, 25.1912211827387, 27.8992713838409, 30.6718601060807,
33.5050734501369, 36.3954452080331, 39.3398841871995, 42.3356164607535,
);
############################# main () ###############################
#$p=shift; $m=shift; $p-=$m;
#if($p>$m) {
# print "1 > 2 [+$p-$m]: ", probab($p+$m, $m), "\n";
#} elsif($p<$m) {
# print "1 < 2 [+$p-$m]: ", probab($p+$m, $p), "\n";
#} else {
# print "1 = 2 [+$p-$m]: ", probab($p+$m, $m), "\n";
#}
#exit;
die "Use: $0 dir1 dir2\n" unless @ARGV==2 &&
-d ($dir1=shift) && -d ($dir2=shift);
$_=`cd $dir1; echo *.out`;
s/\.out\b//g;
$total="";
for $file (split) {
open(OUT1,$out1="$dir1/$file.out") || die "Cannot open $out1: $!";
open(OUT2,$out2="$dir2/$file.out") || die "Cannot open $out2: $!";
@p=@m=();
while(!eof(OUT1) || !eof(OUT2)) {
$_=<OUT1>; @l1=split; shift @l1;
$_=<OUT2>; @l2=split; shift @l2;
die "Number of columns differ in line $.\n" unless $#l1 == $#l2;
for (0..$#l1) {
$p[$_]+= $l1[$_] > $l2[$_];
$m[$_]+= $l1[$_] < $l2[$_];
}
}
for (0..$#l1) {
$pp[$_]+=$p[$_]; $mm[$_]+=$m[$_];
$total.=rep($file, ($#l1 ? $_ : undef), $p[$_], $m[$_]);
}
close OUT1;
close OUT2;
}
for (0..$#l1) {
rep($total, ($#l1 ? $_ : undef), $pp[$_], $mm[$_]);
}
sub rep {
my ($test, $n, $p, $m, $c, $r)=@_;
if ($p>$m) { $c=">"; $r="+"; }
elsif($p<$m) { $c="<"; $r="-"; }
else { $c="="; $r="="; }
$n=" $n: " if defined $n;
printf "%-8s $n $dir1 $c $dir2 [+%03d-%03d]: %16.15f\n",
$test, $p, $m, probab($p+$m, ($p>=$m ? $m : $p));
$r;
}

53
myisam/ftbench/Ereport.pl Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/perl
die "Use: $0 eval_output qrels_file\n" unless @ARGV==2;
open(EOUT,$eout=shift) || die "Cannot open $eout: $!";
open(RELJ,$relj=shift) || die "Cannot open $relj: $!";
$_=<EOUT>;
die "$eout must start with a number!\n "unless /^[1-9][0-9]*\n/;
$ndocs=$_+0;
$qid=0;
$relj_str=<RELJ>;
$eout_str=<EOUT>;
while(!eof(RELJ) || !eof(EOUT)) {
++$qid;
%dq=();
$A=$B=$AB=0;
$Ravg=$Pavg=0;
while($relj_str =~ /^0*$qid\s+(\d+)/) {
++$A;
$dq{$1+0}=1;
last unless $relj_str=<RELJ>;
}
# Favg measure = 1/(a/Pavg+(1-a)/Ravg)
sub Favg { my $a=shift; $Pavg*$Ravg ? 1/($a/$Pavg+(1-$a)/$Ravg) : 0; }
# F0 : a=0 -- ignore precision
# F5 : a=0.5
# F1 : a=1 -- ignore recall
while($eout_str =~ /^$qid\s+(\d+)\s+(\d+\.\d+)/) {
$B++;
$AB++ if $dq{$1+0};
$Ravg+=$AB;
$Pavg+=$AB/$B;
last unless $eout_str=<EOUT>;
}
next unless $A;
$Ravg/=$B*$A if $B;
$Pavg/=$B if $B;
write;
format=
@##### @#.#######
$qid, Favg(0.5)
.
}
exit 0;

81
myisam/ftbench/ft-test-run.sh Executable file
View file

@ -0,0 +1,81 @@
#!/bin/sh -x
if [ ! -x ./ft-test-run.sh ] ; then
echo "Usage: ./ft-test-run.sh"
exit 1
fi
BASE=`pwd`
DATA=$BASE/var
ROOT=`cd ../..; pwd`
MYSQLD=$ROOT/sql/mysqld
MYSQL=$ROOT/client/mysql
MYSQLADMIN=$ROOT/client/mysqladmin
SOCK=$DATA/mysql.sock
PID=$DATA/mysql.pid
H=../ftdefs.h
OPTS="--no-defaults --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
# --ft_min_word_len=#
# --ft_max_word_len=#
# --ft_max_word_len_for_sort=#
# --ft_stopword_file=name
# --key_buffer_size=#
stop_myslqd()
{
[ -S $SOCK ] && $MYSQLADMIN $OPTS shutdown
[ -f $PID ] && kill `cat $PID` && sleep 15 && [ -f $PID ] && kill -9 `cat $PID`
}
if [ ! -d t/BEST ] ; then
echo "No ./t/BEST directory! Aborting..."
exit 1
fi
rm -f t/BEST/report.txt
if [ -w $H ] ; then
echo "$H is writeable! Aborting..."
exit 1
fi
for batch in t/BEST t/* ; do
A=`ls $batch/*.out`
[ ! -d $batch -o -n "$A" ] && continue
rm -f $H
ln -s $BASE/$batch/ftdefs.h $H
touch $H
OPTS="--defaults-file=$BASE/$batch/my.cnf --socket=$SOCK --character-sets-dir=$ROOT/sql/share/charsets"
stop_myslqd
rm $MYSQLD
(cd $ROOT; gmake)
for prog in $MYSQLD $MYSQL $MYSQLADMIN ; do
if [ ! -x $prog ] ; then
echo "No $prog"
exit 1
fi
done
rm -rf var 2>&1 >/dev/null
mkdir var
mkdir var/test
$MYSQLD $OPTS --basedir=$BASE --skip-bdb --pid-file=$PID \
--language=$ROOT/sql/share/english \
--skip-grant-tables --skip-innodb \
--skip-networking --tmpdir=$DATA &
$MYSQLADMIN $OPTS --connect_timeout=60 ping
if [ $? != 0 ] ; then
echo "$MYSQLD refused to start"
exit 1
fi
for test in `cd data; echo *.test|sed "s/\.test\>//g"` ; do
$MYSQL $OPTS --skip-column-names test <data/$test.test >var/$test.eval
./Ereport.pl var/$test.eval data/$test.relj > $batch/$test.out || exit
done
stop_myslqd
rm -f $H
[ $batch -ef t/BEST ] || ./Ecompare.pl t/BEST $batch >> t/BEST/report.txt
done

View file

@ -0,0 +1,4 @@
-- require r/have_compress.require
disable_query_log;
show variables like "have_compress";
enable_query_log;

View file

@ -105,3 +105,41 @@ Table Op Msg_type Msg_text
test.t1 check warning Found row where the auto_increment column has the value 0
test.t1 check status OK
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment primary key);
insert into t1 set i = 254;
insert into t1 set i = null;
select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
Duplicate entry '255' for key 1
select last_insert_id();
last_insert_id()
255
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment, key (i));
insert into t1 set i = 254;
insert into t1 set i = null;
select last_insert_id();
last_insert_id()
255
insert into t1 set i = null;
select last_insert_id();
last_insert_id()
255
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
insert into t1 values (NULL, 10);
select last_insert_id();
last_insert_id()
1
insert into t1 values (NULL, 15);
select last_insert_id();
last_insert_id()
2
insert into t1 values (NULL, 10);
Duplicate entry '10' for key 2
select last_insert_id();
last_insert_id()
3
drop table t1;

View file

@ -510,11 +510,11 @@ t1 CREATE TABLE `t1` (
SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL
SET NAMES 'latin1';
SET CHARACTER SET 'latin1';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_swedish_ci
SET NAMES latin1;
SET CHARACTER SET latin1;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_swedish_ci
@ -524,51 +524,51 @@ client_collation latin1_swedish_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET NAMES latin1 COLLATE latin1_bin;
SET CHARACTER SET latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SET NAMES LATIN1 COLLATE Latin1_Bin;
SET CHARACTER SET LATIN1 COLLATE Latin1_Bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SET NAMES 'latin1' COLLATE 'latin1_bin';
SET CHARACTER SET 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_bin 3 0
SET NAMES koi8r;
latin1 latin1_swedish_ci 3 1
SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_general_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET COLLATION koi8r_bin;
SET CHARACTER SET koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_bin
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET COLLATION DEFAULT;
SET CHARACTER SET koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation koi8r_general_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET NAMES DEFAULT;
SET CHARACTER SET DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
Variable_name Value
client_collation latin1_swedish_ci
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
charset('a') collation('a') coercibility('a') 'a'='A'
latin1 latin1_swedish_ci 3 1
SET NAMES latin1 COLLATE koi8r;
SET CHARACTER SET latin1 COLLATE koi8r;
COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
SET NAMES 'DEFAULT';
SET CHARACTER SET 'DEFAULT';
Unknown character set: 'DEFAULT'
DROP TABLE t1;

View file

@ -1,5 +1,5 @@
DROP TABLE IF EXISTS t1;
SET NAMES latin1;
SET CHARACTER SET latin1;
CREATE TABLE t1 (
comment CHAR(32) ASCII NOT NULL,
koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL
@ -158,7 +158,7 @@ INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ü','CYR CAPIT E');
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'à','CYR CAPIT YU');
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ñ','CYR CAPIT YA');
SET NAMES utf8;
SET CHARACTER SET utf8;
SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
koi8_ru_f MIN(comment) COUNT(*)
a LAT CAPIT A 2
@ -221,7 +221,7 @@ z LAT CAPIT Z 2
Ñ<EFBFBD> CYR CAPIT YA 2
ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET NAMES koi8r;
SET CHARACTER SET koi8r;
SELECT * FROM t1;
comment koi8_ru_f utf8_f
LAT SMALL A a a
@ -1300,7 +1300,7 @@ CYR CAPIT YA CYR CAPIT YA
CYR CAPIT YA CYR SMALL YA
CYR SMALL YA CYR CAPIT YA
CYR SMALL YA CYR SMALL YA
SET NAMES utf8;
SET CHARACTER SET utf8;
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
@ -1471,7 +1471,7 @@ ARMENIAN SMALL GIM գ գ գ
ARMENIAN SMALL DA Õ¤ Õ¤ Õ¤
ARMENIAN SMALL ECH Õ¥ Õ¥ Õ¥
ARMENIAN SMALL ZA Õ¦ Õ¦ Õ¦
SET NAMES 'binary';
SET CHARACTER SET 'binary';
SELECT * FROM t1;
comment koi8_ru_f utf8_f bin_f ucs2_f armscii8_f greek_f
LAT SMALL A a a a a

View file

@ -1,4 +1,4 @@
SET NAMES koi8r;
SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ;
CREATE TABLE ÔÁÂÌÉÃÁ
(
@ -15,7 +15,7 @@ Table Create Table
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
Field Type Collation Null Key Default Extra
ÐÏÌÅ char(32) character set koi8r koi8r_general_ci
SET NAMES cp1251;
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
òàáëèöà
@ -27,7 +27,7 @@ Table Create Table
SHOW FIELDS FROM òàáëèöà;
Field Type Collation Null Key Default Extra
ïîëå char(32) character set koi8r koi8r_general_ci
SET NAMES utf8;
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
таблица
@ -39,5 +39,5 @@ Table Create Table
SHOW FIELDS FROM таблица;
Field Type Collation Null Key Default Extra
поле char(32) character set koi8r koi8r_general_ci
SET NAMES koi8r;
SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂÌÉÃÁ;

View file

@ -0,0 +1,35 @@
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select length(@test_compress_string);
length(@test_compress_string)
117
select uncompress(compress(@test_compress_string));
uncompress(compress(@test_compress_string))
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select uncompress(@test_compress_string);
uncompress(@test_compress_string)
NULL
Warnings:
Error 1254 Too big size of uncompressed data. The maximum size is 8192. (probably, length of uncompressed data was corrupted)
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
select length(compress(@test_compress_string))<length(@test_compress_string);
length(compress(@test_compress_string))<length(@test_compress_string)
1
create table t1 (a text, b char(255), c char(4)) type=myisam;
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
select uncompress(a) from t1;
uncompress(a)
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select uncompress(b) from t1;
uncompress(b)
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
select concat('|',c,'|') from t1;
concat('|',c,'|')
|d|
drop table t1;

View file

@ -14,18 +14,18 @@ insert into t1 values (3,9,"D","c");
select grp,group_concat(c) from t1 group by grp;
grp group_concat(c)
1 a
2 b c
3 E C D d d D
2 b,c
3 E,C,D,d,d,D
select grp,group_concat(a,c) from t1 group by grp;
grp group_concat(a,c)
1 1a
2 2b 3c
3 4E 5C 6D 7d 8d 9D
2 2b,3c
3 4E,5C,6D,7d,8d,9D
select grp,group_concat("(",a,":",c,")") from t1 group by grp;
grp group_concat("(",a,":",c,")")
1 (1:a)
2 (2:b) (3:c)
3 (4:E) (5:C) (6:D) (7:d) (8:d) (9:D)
2 (2:b),(3:c)
3 (4:E),(5:C),(6:D),(7:d),(8:d),(9:D)
select grp,group_concat(c separator ",") from t1 group by grp;
grp group_concat(c separator ",")
1 a
@ -39,48 +39,48 @@ grp group_concat(c separator "---->")
select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c)
1 a
2 b c
3 C D d d D E
2 b,c
3 C,D,d,d,D,E
select grp,group_concat(c order by c desc) from t1 group by grp;
grp group_concat(c order by c desc)
1 a
2 c b
3 E D d d D C
2 c,b
3 E,D,d,d,D,C
select grp,group_concat(d order by a) from t1 group by grp;
grp group_concat(d order by a)
1 a
2 a b
3 a b b d d c
2 a,b
3 a,b,b,d,d,c
select grp,group_concat(d order by a desc) from t1 group by grp;
grp group_concat(d order by a desc)
1 a
2 b a
3 c d d b b a
2 b,a
3 c,d,d,b,b,a
select grp,group_concat(a order by a,d+c) from t1 group by grp;
grp group_concat(a order by a,d+c)
1 1
2 2 3
3 4 5 6 7 8 9
2 2,3
3 4,5,6,7,8,9
select grp,group_concat(c order by 1) from t1 group by grp;
grp group_concat(c order by 1)
1 a
2 b c
3 C D d d D E
2 b,c
3 C,D,d,d,D,E
select grp,group_concat(c order by "c") from t1 group by grp;
grp group_concat(c order by "c")
1 a
2 b c
3 C D d d D E
2 b,c
3 C,D,d,d,D,E
select grp,group_concat(distinct c order by c) from t1 group by grp;
grp group_concat(distinct c order by c)
1 a
2 b c
3 C D E
2 b,c
3 C,D,E
select grp,group_concat(distinct c order by c desc) from t1 group by grp;
grp group_concat(distinct c order by c desc)
1 a
2 c b
3 E D C
2 c,b
3 E,D,C
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp group_concat(c order by c separator ",")
1 a
@ -104,8 +104,8 @@ grp group_concat(distinct c order by c desc separator ",")
select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
grp group_concat(c order by grp desc)
1 a
2 c b
3 D d d D C E
2 c,b
3 D,d,d,D,C,E
select grp, group_concat(a separator "")+0 from t1 group by grp;
grp group_concat(a separator "")+0
1 1
@ -138,7 +138,7 @@ select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c)
1 NULL
2 b
3 D D E
3 D,D,E
4
5 NULL
set group_concat_max_len = 5;
@ -146,14 +146,14 @@ select grp,group_concat(c) from t1 group by grp;
grp group_concat(c)
1 NULL
2 b
3 E D D
3 E,D,D
4
5 NULL
Warnings:
Warning 1254 1 line(s) was(were) cut by group_concat()
Warning 1258 1 line(s) was(were) cut by group_concat()
show warnings;
Level Code Message
Warning 1254 1 line(s) was(were) cut by group_concat()
Warning 1258 1 line(s) was(were) cut by group_concat()
select group_concat(sum(a)) from t1 group by grp;
Invalid use of group function
select grp,group_concat(c order by 2) from t1 group by grp;

View file

@ -0,0 +1,2 @@
Variable_name Value
have_compress YES

View file

@ -1083,3 +1083,20 @@ Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
Invalid use of group function
drop table t1;
CREATE TABLE t1 (
id int(11) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
CREATE TABLE t2 (
id int(11) default NULL,
name varchar(15) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
select * from t2;
id name
4 vita
1 lenka
2 lenka
1 lenka
drop table t1,t2;

View file

@ -155,18 +155,10 @@ set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1048576
set GLOBAL character set cp1251_koi8;
show global variables like "client_collation";
Variable_name Value
client_collation cp1251_bulgarian_ci
set character set cp1251_koi8;
show variables like "client_collation";
Variable_name Value
client_collation cp1251_bulgarian_ci
set global character set default, session character set default;
show variables like "client_collation";
Variable_name Value
client_collation latin1_swedish_ci
select @@timestamp>0;
@@timestamp>0
1
@ -195,10 +187,6 @@ set GLOBAL table_type=DEFAULT;
Variable 'table_type' doesn't have a default value
set client_collation=UNKNOWN_CHARACTER_SET;
Unknown character set: 'UNKNOWN_CHARACTER_SET'
set character set unknown;
Unknown character set: 'unknown'
set character set 0;
Wrong argument type to variable 'client_collation'
set global autocommit=1;
Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL
select @@global.timestamp;

View file

@ -72,3 +72,33 @@ select * from t1;
check table t1;
drop table t1;
#
# last_insert_id() madness
#
create table t1 (i tinyint unsigned not null auto_increment primary key);
insert into t1 set i = 254;
insert into t1 set i = null;
select last_insert_id();
--error 1062
insert into t1 set i = null;
select last_insert_id();
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment, key (i));
insert into t1 set i = 254;
insert into t1 set i = null;
select last_insert_id();
insert into t1 set i = null;
select last_insert_id();
drop table t1;
create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
insert into t1 values (NULL, 10);
select last_insert_id();
insert into t1 values (NULL, 15);
select last_insert_id();
--error 1062
insert into t1 values (NULL, 10);
select last_insert_id();
drop table t1;

View file

@ -127,35 +127,35 @@ ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1;
SHOW FIELDS FROM t1;
SET NAMES 'latin1';
SET CHARACTER SET 'latin1';
SHOW VARIABLES LIKE 'client_collation';
SET NAMES latin1;
SET CHARACTER SET latin1;
SHOW VARIABLES LIKE 'client_collation';
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES latin1 COLLATE latin1_bin;
SET CHARACTER SET latin1 COLLATE latin1_bin;
SHOW VARIABLES LIKE 'client_collation';
SET NAMES LATIN1 COLLATE Latin1_Bin;
SET CHARACTER SET LATIN1 COLLATE Latin1_Bin;
SHOW VARIABLES LIKE 'client_collation';
SET NAMES 'latin1' COLLATE 'latin1_bin';
SET CHARACTER SET 'latin1' COLLATE 'latin1_bin';
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES koi8r;
SET CHARACTER SET koi8r;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION koi8r_bin;
SET CHARACTER SET koi8r COLLATE koi8r_bin;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET COLLATION DEFAULT;
SET CHARACTER SET koi8r COLLATE DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET NAMES DEFAULT;
SET CHARACTER SET DEFAULT;
SHOW VARIABLES LIKE 'client_collation';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
--error 1251
SET NAMES latin1 COLLATE koi8r;
SET CHARACTER SET latin1 COLLATE koi8r;
--error 1115
SET NAMES 'DEFAULT';
SET CHARACTER SET 'DEFAULT';
DROP TABLE t1;

View file

@ -2,7 +2,7 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
SET NAMES latin1;
SET CHARACTER SET latin1;
CREATE TABLE t1 (
comment CHAR(32) ASCII NOT NULL,
@ -137,12 +137,12 @@ INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'à','CYR CAPIT YU');
INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'ñ','CYR CAPIT YA');
SET NAMES utf8;
SET CHARACTER SET utf8;
SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL;
UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
SET NAMES koi8r;
SET CHARACTER SET koi8r;
SELECT * FROM t1;
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
@ -165,7 +165,7 @@ FROM t1 t11,t1 t12
WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
ORDER BY t12.utf8_f,t11.comment,t12.comment;
SET NAMES utf8;
SET CHARACTER SET utf8;
ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
@ -199,7 +199,7 @@ UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _lati
UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
SELECT * FROM t1;
SET NAMES 'binary';
SET CHARACTER SET 'binary';
SELECT * FROM t1;
SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
DROP TABLE t1;

View file

@ -1,4 +1,4 @@
SET NAMES koi8r;
SET CHARACTER SET koi8r;
--disable_warnings
DROP TABLE IF EXISTS ÔÁÂĚÉĂÁ;
@ -13,16 +13,16 @@ SHOW TABLES;
SHOW CREATE TABLE ÔÁÂĚÉĂÁ;
SHOW FIELDS FROM ÔÁÂĚÉĂÁ;
SET NAMES cp1251;
SET CHARACTER SET cp1251;
SHOW TABLES;
SHOW CREATE TABLE ňŕáëčöŕ;
SHOW FIELDS FROM ňŕáëčöŕ;
SET NAMES utf8;
SET CHARACTER SET utf8;
SHOW TABLES;
SHOW CREATE TABLE таблица;
SHOW FIELDS FROM таблица;
SET NAMES koi8r;
SET CHARACTER SET koi8r;
DROP TABLE ÔÁÂĚÉĂÁ;

View file

@ -0,0 +1,20 @@
-- source include/have_compress.inc
#
# Test for compress and uncompress functions:
#
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
select length(@test_compress_string);
select uncompress(compress(@test_compress_string));
select uncompress(@test_compress_string);
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
select uncompressed_length(compress(@test_compress_string));
select length(compress(@test_compress_string))<length(@test_compress_string);
create table t1 (a text, b char(255), c char(4)) type=myisam;
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
select uncompress(a) from t1;
select uncompress(b) from t1;
select concat('|',c,'|') from t1;
drop table t1;

View file

@ -672,3 +672,20 @@ UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-- error 1111
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
drop table t1;
#
# Multi update test
#
CREATE TABLE t1 (
id int(11) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
CREATE TABLE t2 (
id int(11) default NULL,
name varchar(15) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
select * from t2;
drop table t1,t2;

View file

@ -91,12 +91,8 @@ show variables like 'net_buffer_length';
set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
set GLOBAL character set cp1251_koi8;
show global variables like "client_collation";
set character set cp1251_koi8;
show variables like "client_collation";
set global character set default, session character set default;
show variables like "client_collation";
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
@ -124,10 +120,6 @@ set SESSION query_cache_size=10000;
set GLOBAL table_type=DEFAULT;
--error 1115
set client_collation=UNKNOWN_CHARACTER_SET;
--error 1115
set character set unknown;
--error 1232
set character set 0;
--error 1228
set global autocommit=1;
--error 1228

View file

@ -174,7 +174,8 @@ void load_defaults(const char *conf_file, const char **groups,
res= (char**) (ptr+sizeof(alloc));
/* copy name + found arguments + command line arguments to new array */
res[0]=argv[0][0];
res[0]=*argc ? argv[0][0] : "";
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
/* Skipp --defaults-file and --defaults-extra-file */
(*argc)-= args_used;
@ -187,8 +188,9 @@ void load_defaults(const char *conf_file, const char **groups,
--*argc; ++*argv; /* skipp argument */
}
memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
(*argc-1)*sizeof(char*));
if (*argc)
memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
(*argc-1)*sizeof(char*));
res[args.elements+ *argc]=0; /* last null */
(*argc)+=args.elements;

View file

@ -660,8 +660,8 @@ void handler::update_auto_increment()
thd->next_insert_id=0; // Clear after use
else
nr=get_auto_increment();
thd->insert_id((ulonglong) nr);
table->next_number_field->store(nr);
if (!table->next_number_field->store(nr))
thd->insert_id((ulonglong) nr);
auto_increment_column_changed=1;
DBUG_VOID_RETURN;
}

View file

@ -645,3 +645,23 @@ Item *create_func_point(Item *a, Item *b)
{
return new Item_func_point(a, b);
}
#ifdef HAVE_COMPRESS
Item *create_func_compress(Item* a)
{
return new Item_func_compress(a);
}
Item *create_func_uncompress(Item* a)
{
return new Item_func_uncompress(a);
}
Item *create_func_uncompressed_length(Item* a)
{
return new Item_func_uncompressed_length(a);
}
#endif

View file

@ -141,3 +141,10 @@ Item *create_func_numinteriorring(Item *a);
Item *create_func_numgeometries(Item *a);
Item *create_func_point(Item *a, Item *b);
#ifdef HAVE_COMPRESS
Item *create_func_compress(Item *a);
Item *create_func_uncompress(Item *a);
Item *create_func_uncompressed_length(Item *a);
#endif

View file

@ -986,8 +986,20 @@ longlong Item_func_crc32::val_int()
null_value=0;
return (longlong) crc32(0L, (Bytef*)res->ptr(), res->length());
}
#endif /* HAVE_COMPRESS */
longlong Item_func_uncompressed_length::val_int()
{
String *res= args[0]->val_str(&value);
if (!res)
{
null_value=1;
return 0; /* purecov: inspected */
}
null_value=0;
return uint4korr(res->c_ptr());
}
#endif /* HAVE_COMPRESS */
longlong Item_func_length::val_int()
{

View file

@ -559,6 +559,15 @@ public:
const char *func_name() const { return "crc32"; }
void fix_length_and_dec() { max_length=10; }
};
class Item_func_uncompressed_length : public Item_int_func
{
String value;
public:
Item_func_uncompressed_length(Item *a):Item_int_func(a){}
longlong val_int();
const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; }
};
#endif
class Item_func_length :public Item_int_func

View file

@ -2917,3 +2917,91 @@ String *Item_func_spatial_collection::val_str(String *str)
ret:
return null_value ? 0 : str;
}
#ifdef HAVE_COMPRESS
#include <zlib.h>
String *Item_func_compress::val_str(String *str)
{
String *res= args[0]->val_str(str);
int err= Z_OK;
int code;
/*
citation from zlib.h (comment for compress function):
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least 0.1% larger than
sourceLen plus 12 bytes.
Proportion 120/100 founded by Sinica with help of procedure
compress(compress(compress(...)))
I.e. zlib give number 'at least'..
*/
uLongf new_size= (uLongf)((res->length()*120)/100)+12;
buffer.realloc((uint32)new_size+sizeof(int32)+sizeof(char));
Byte *body= ((Byte*)buffer.c_ptr())+sizeof(int32);
err= compress(body, &new_size,(const Bytef*)res->c_ptr(), res->length());
if (err != Z_OK)
{
code= err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_BUF_ERROR;
push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
null_value= 1;
return 0;
}
int4store(buffer.c_ptr(),res->length());
buffer.length((uint32)new_size+sizeof(int32));
/* This is for the stupid char fields which trimm ' ': */
char *last_char= ((char*)body)+new_size-1;
if (*last_char == ' ')
{
*++last_char= '.';
new_size++;
}
buffer.length((uint32)new_size+sizeof(int32));
return &buffer;
}
String *Item_func_uncompress::val_str(String *str)
{
String *res= args[0]->val_str(str);
uLongf new_size= uint4korr(res->c_ptr());
int err= Z_OK;
uint code;
if (new_size > MAX_BLOB_WIDTH)
{
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_TOO_BIG_FOR_UNCOMPRESS,
ER(ER_TOO_BIG_FOR_UNCOMPRESS),MAX_BLOB_WIDTH);
null_value= 1;
return 0;
}
buffer.realloc((uint32)new_size);
err= uncompress((Byte*)buffer.c_ptr(), &new_size,
((const Bytef*)res->c_ptr())+sizeof(int32),res->length());
if (err == Z_OK)
{
buffer.length((uint32)new_size);
return &buffer;
}
code= err==Z_BUF_ERROR ? ER_ZLIB_Z_BUF_ERROR :
err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR;
push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
null_value= 1;
return 0;
}
#endif

View file

@ -781,6 +781,29 @@ public:
const char *func_name() const { return "multipoint"; }
};
#ifdef HAVE_COMPRESS
class Item_func_compress : public Item_str_func
{
String buffer;
public:
Item_func_compress(Item *a):Item_str_func(a){}
String *val_str(String *);
void fix_length_and_dec(){max_length= (args[0]->max_length*120)/100+12;}
const char *func_name() const{return "compress";}
};
class Item_func_uncompress : public Item_str_func
{
String buffer;
public:
Item_func_uncompress(Item *a):Item_str_func(a){}
String *val_str(String *);
void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
const char *func_name() const{return "uncompress";}
};
#endif
/*
class Item_func_multipoint :public Item_str_func

View file

@ -697,6 +697,7 @@ class Item_func_group_concat : public Item_sum
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
const char *func_name() const { return "group_concat"; }
enum Type type() const { return SUM_FUNC_ITEM; }
void fix_length_and_dec() { max_length=group_concat_max_len; }
virtual Item_result result_type () const { return STRING_RESULT; }
void reset();
bool add();
@ -715,4 +716,5 @@ class Item_func_group_concat : public Item_sum
return res ? strtoll(res->c_ptr(),(char**) 0,10) : (longlong) 0;
}
String* val_str(String* str);
Item *copy_or_same(THD* thd) { return new Item_func_group_concat(thd, *this); }
};

View file

@ -216,7 +216,7 @@ static SYMBOL symbols[] = {
{ "INT4", SYM(INT_SYM),0,0},
{ "INT8", SYM(BIGINT),0,0},
{ "INTO", SYM(INTO),0,0},
{ "IO_THREAD", SYM(IO_THREAD),0,0},
{ "IO_THREAD", SYM(RELAY_THREAD),0,0},
{ "IF", SYM(IF),0,0},
{ "IS", SYM(IS),0,0},
{ "ISOLATION", SYM(ISOLATION),0,0},
@ -324,6 +324,7 @@ static SYMBOL symbols[] = {
{ "REFERENCES", SYM(REFERENCES),0,0},
{ "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM),0,0},
{ "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM),0,0},
{ "RELAY_THREAD", SYM(RELAY_THREAD),0,0},
{ "RELOAD", SYM(RELOAD),0,0},
{ "REGEXP", SYM(REGEXP),0,0},
{ "RENAME", SYM(RENAME),0,0},
@ -464,6 +465,9 @@ static SYMBOL sql_functions[] = {
{ "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
{ "COALESCE", SYM(COALESCE),0,0},
{ "COERCIBILITY", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_coercibility)},
#ifdef HAVE_COMPRESS
{ "COMPRESS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_compress)},
#endif
{ "CONCAT", SYM(CONCAT),0,0},
{ "CONCAT_WS", SYM(CONCAT_WS),0,0},
{ "CONNECTION_ID", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_connection_id)},
@ -639,6 +643,10 @@ static SYMBOL sql_functions[] = {
{ "TOUCHES", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_touches)},
{ "TRIM", SYM(TRIM),0,0},
{ "UCASE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},
#ifdef HAVE_COMPRESS
{ "UNCOMPRESS", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_uncompress)},
{ "UNCOMPRESSED_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_uncompressed_length)},
#endif
{ "UNIQUE_USERS", SYM(UNIQUE_USERS),0,0},
{ "UNIX_TIMESTAMP", SYM(UNIX_TIMESTAMP),0,0},
{ "UPPER", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ucase)},

View file

@ -772,6 +772,7 @@ extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db;
extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink;
extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb;
extern SHOW_COMP_OPTION have_crypt;
extern SHOW_COMP_OPTION have_compress;
#ifndef __WIN__
extern pthread_t signal_thread;

View file

@ -258,6 +258,11 @@ SHOW_COMP_OPTION have_crypt=SHOW_OPTION_YES;
#else
SHOW_COMP_OPTION have_crypt=SHOW_OPTION_NO;
#endif
#ifdef HAVE_COMPRESS
SHOW_COMP_OPTION have_compress= SHOW_OPTION_YES;
#else
SHOW_COMP_OPTION have_compress= SHOW_OPTION_NO;
#endif
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
@ -2087,6 +2092,10 @@ static int init_common_variables(const char *conf_file_name, int argc,
#endif
if (!(default_charset_info= get_charset_by_name(sys_charset.value, MYF(MY_WME))))
return 1;
global_system_variables.result_collation= default_charset_info;
global_system_variables.client_collation= default_charset_info;
global_system_variables.literal_collation= default_charset_info;
charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
@ -4613,7 +4622,9 @@ static void set_options(void)
sizeof(mysql_real_data_home)-1);
/* Set default values for some variables */
global_system_variables.convert_result_charset= TRUE;
global_system_variables.result_collation= default_charset_info;
global_system_variables.client_collation= default_charset_info;
global_system_variables.literal_collation= default_charset_info;
global_system_variables.table_type= DB_TYPE_MYISAM;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;

View file

@ -526,13 +526,16 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
if (prot.store(field.db_name, (uint) strlen(field.db_name), cs) ||
prot.store(field.table_name, (uint) strlen(field.table_name), cs) ||
prot.store(field.org_table_name,
(uint) strlen(field.org_table_name), cs) ||
prot.store(field.col_name, (uint) strlen(field.col_name), cs) ||
prot.store(field.org_col_name,
(uint) strlen(field.org_col_name), cs) ||
if (prot.store(field.db_name, (uint) strlen(field.db_name),
cs, thd->charset()) ||
prot.store(field.table_name, (uint) strlen(field.table_name),
cs, thd->charset()) ||
prot.store(field.org_table_name, (uint) strlen(field.org_table_name),
cs, thd->charset()) ||
prot.store(field.col_name, (uint) strlen(field.col_name),
cs, thd->charset()) ||
prot.store(field.org_col_name, (uint) strlen(field.org_col_name),
cs, thd->charset()) ||
packet->realloc(packet->length()+12))
goto err;
/* Store fixed length fields */
@ -549,8 +552,10 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
}
else
{
if (prot.store(field.table_name, (uint) strlen(field.table_name), cs) ||
prot.store(field.col_name, (uint) strlen(field.col_name), cs) ||
if (prot.store(field.table_name, (uint) strlen(field.table_name),
cs, thd->charset()) ||
prot.store(field.col_name, (uint) strlen(field.col_name),
cs, thd->charset()) ||
packet->realloc(packet->length()+10))
goto err;
pos= (char*) packet->ptr()+packet->length();
@ -694,7 +699,8 @@ bool Protocol_simple::store_null()
#endif
bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
bool Protocol_simple::store(const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
#ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 ||
@ -703,12 +709,34 @@ bool Protocol_simple::store(const char *from, uint length, CHARSET_INFO *cs)
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
field_pos++;
#endif
if (!my_charset_same(cs, this->thd->charset()) &&
(cs != &my_charset_bin) &&
(this->thd->charset() != &my_charset_bin) &&
(this->thd->variables.convert_result_charset))
if (!my_charset_same(fromcs, tocs) &&
(fromcs != &my_charset_bin) &&
(tocs != &my_charset_bin))
{
convert.copy(from, length, cs, this->thd->charset());
convert.copy(from, length, fromcs, tocs);
return net_store_data(convert.ptr(), convert.length());
}
else
return net_store_data(from, length);
}
bool Protocol_simple::store(const char *from, uint length,
CHARSET_INFO *fromcs)
{
CHARSET_INFO *tocs= this->thd->variables.result_collation;
#ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 ||
field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
(field_types[field_pos] >= MYSQL_TYPE_ENUM &&
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
field_pos++;
#endif
if (!my_charset_same(fromcs, tocs) &&
(fromcs != &my_charset_bin) &&
(tocs != &my_charset_bin))
{
convert.copy(from, length, fromcs, tocs);
return net_store_data(convert.ptr(), convert.length());
}
else
@ -777,7 +805,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
field_types[field_pos] == MYSQL_TYPE_FLOAT);
field_pos++;
#endif
buffer->set((double) from, decimals, thd->variables.thd_charset);
buffer->set((double) from, decimals, thd->charset());
return net_store_data((char*) buffer->ptr(), buffer->length());
}
@ -789,7 +817,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
field_types[field_pos] == MYSQL_TYPE_DOUBLE);
field_pos++;
#endif
buffer->set(from, decimals, thd->variables.thd_charset);
buffer->set(from, decimals, thd->charset());
return net_store_data((char*) buffer->ptr(), buffer->length());
}
@ -806,8 +834,7 @@ bool Protocol_simple::store(Field *field)
field->val_str(&str,&str);
if (!my_charset_same(field->charset(), this->thd->charset()) &&
(field->charset() != &my_charset_bin) &&
(this->thd->charset() != &my_charset_bin) &&
(this->thd->variables.convert_result_charset))
(this->thd->charset() != &my_charset_bin))
{
convert.copy(str.ptr(), str.length(), str.charset(), this->thd->charset());
return net_store_data(convert.ptr(), convert.length());
@ -923,6 +950,19 @@ bool Protocol_prep::store(const char *from,uint length, CHARSET_INFO *cs)
return net_store_data(from, length);
}
bool Protocol_prep::store(const char *from,uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
{
#ifndef DEBUG_OFF
DBUG_ASSERT(field_types == 0 ||
field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
(field_types[field_pos] >= MYSQL_TYPE_ENUM &&
field_types[field_pos] <= MYSQL_TYPE_GEOMETRY));
#endif
field_pos++;
return net_store_data(from, length);
}
bool Protocol_prep::store_null()
{
uint offset= (field_pos+2)/8+1, bit= (1 << ((field_pos+2) & 7));

View file

@ -74,6 +74,8 @@ public:
virtual bool store_long(longlong from)=0;
virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
virtual bool store(const char *from, uint length, CHARSET_INFO *cs)=0;
virtual bool store(const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
virtual bool store(float from, uint32 decimals, String *buffer)=0;
virtual bool store(double from, uint32 decimals, String *buffer)=0;
virtual bool store(TIME *time)=0;
@ -97,6 +99,8 @@ public:
virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store(const char *from, uint length, CHARSET_INFO *cs);
virtual bool store(const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
virtual bool store(TIME *time);
virtual bool store_date(TIME *time);
virtual bool store_time(TIME *time);
@ -121,6 +125,8 @@ public:
virtual bool store_long(longlong from);
virtual bool store_longlong(longlong from, bool unsigned_flag);
virtual bool store(const char *from,uint length, CHARSET_INFO *cs);
virtual bool store(const char *from, uint length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
virtual bool store(TIME *time);
virtual bool store_date(TIME *time);
virtual bool store_time(TIME *time);

View file

@ -111,8 +111,6 @@ sys_var_bool_ptr sys_concurrent_insert("concurrent_insert",
&myisam_concurrent_insert);
sys_var_long_ptr sys_connect_timeout("connect_timeout",
&connect_timeout);
sys_var_thd_bool sys_convert_result_charset("convert_result_charset",
&SV::convert_result_charset);
sys_var_enum sys_delay_key_write("delay_key_write",
&delay_key_write_options,
&delay_key_write_typelib,
@ -134,6 +132,7 @@ sys_var_thd_ulong sys_join_buffer_size("join_buffer_size",
sys_var_ulonglong_ptr sys_key_buffer_size("key_buffer_size",
&keybuff_size,
fix_key_buffer_size);
sys_var_literal_collation sys_literal_collation("literal_collation");
sys_var_bool_ptr sys_local_infile("local_infile",
&opt_local_infile);
sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings);
@ -202,6 +201,7 @@ sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
&SV::read_buff_size);
sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size",
&SV::read_rnd_buff_size);
sys_var_result_collation sys_result_collation("result_collation");
sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
&rpl_recovery_rank);
sys_var_long_ptr sys_query_cache_size("query_cache_size",
@ -347,7 +347,6 @@ sys_var *sys_variables[]=
&sys_client_collation,
&sys_concurrent_insert,
&sys_connect_timeout,
&sys_convert_result_charset,
&sys_default_week_format,
&sys_delay_key_write,
&sys_delayed_insert_limit,
@ -364,6 +363,7 @@ sys_var *sys_variables[]=
&sys_interactive_timeout,
&sys_join_buffer_size,
&sys_key_buffer_size,
&sys_literal_collation,
&sys_last_insert_id,
&sys_local_infile,
&sys_log_binlog,
@ -407,6 +407,7 @@ sys_var *sys_variables[]=
&sys_rand_seed2,
&sys_read_buff_size,
&sys_read_rnd_buff_size,
&sys_result_collation,
&sys_rpl_recovery_rank,
&sys_safe_updates,
&sys_select_limit,
@ -458,7 +459,6 @@ struct show_var_st init_vars[]= {
{sys_client_collation.name, (char*) &sys_client_collation, SHOW_SYS},
{sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{sys_convert_result_charset.name, (char*) &sys_convert_result_charset, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR},
{"default_week_format", (char*) &sys_default_week_format, SHOW_SYS},
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
@ -475,6 +475,7 @@ struct show_var_st init_vars[]= {
{"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR},
{"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE},
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
{"have_compress", (char*) &have_compress, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE},
@ -508,6 +509,7 @@ struct show_var_st init_vars[]= {
{sys_key_buffer_size.name, (char*) &sys_key_buffer_size, SHOW_SYS},
{"language", language, SHOW_CHAR},
{"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
{sys_literal_collation.name,(char*) &sys_literal_collation, SHOW_SYS},
{sys_local_infile.name, (char*) &sys_local_infile, SHOW_SYS},
#ifdef HAVE_MLOCKALL
{"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL},
@ -561,6 +563,7 @@ struct show_var_st init_vars[]= {
{sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS},
{sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
{sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
{sys_result_collation.name, (char*) &sys_result_collation, SHOW_SYS},
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
#ifdef HAVE_QUERY_CACHE
{sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
@ -1156,7 +1159,8 @@ byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type)
}
typedef struct old_names_map_st {
typedef struct old_names_map_st
{
const char *old_name;
const char *new_name;
} my_old_conv;
@ -1176,7 +1180,7 @@ static my_old_conv old_conv[]=
{ NULL , NULL }
};
static CHARSET_INFO *get_old_charset_by_name(const char *name)
CHARSET_INFO *get_old_charset_by_name(const char *name)
{
my_old_conv *c;
@ -1188,20 +1192,12 @@ static CHARSET_INFO *get_old_charset_by_name(const char *name)
return NULL;
}
bool sys_var_client_collation::check(THD *thd, set_var *var)
bool sys_var_collation::check(THD *thd, set_var *var)
{
CHARSET_INFO *tmp;
char buff[80];
String str(buff,sizeof(buff), system_charset_info), *res;
if (!var->value) // Default value
{
var->save_result.charset= (var->type != OPT_GLOBAL ?
global_system_variables.thd_charset
: thd->db_charset);
return 0;
}
if (!(res=var->value->val_str(&str)))
res= &empty_string;
@ -1218,27 +1214,107 @@ bool sys_var_client_collation::check(THD *thd, set_var *var)
bool sys_var_client_collation::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.thd_charset= var->save_result.charset;
global_system_variables.client_collation= var->save_result.charset;
else
{
thd->variables.thd_charset= var->save_result.charset;
thd->variables.client_collation= var->save_result.charset;
thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd);
}
return 0;
}
byte *sys_var_client_collation::value_ptr(THD *thd, enum_var_type type)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.thd_charset :
thd->variables.thd_charset);
global_system_variables.client_collation :
thd->variables.client_collation);
return cs ? (byte*) cs->name : (byte*) "";
}
void sys_var_client_collation::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.client_collation= default_charset_info;
else
{
thd->variables.client_collation= global_system_variables.client_collation;
}
}
bool sys_var_literal_collation::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.literal_collation= var->save_result.charset;
else
thd->variables.literal_collation= var->save_result.charset;
return 0;
}
byte *sys_var_literal_collation::value_ptr(THD *thd, enum_var_type type)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.literal_collation :
thd->variables.literal_collation);
return cs ? (byte*) cs->name : (byte*) "";
}
void sys_var_literal_collation::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.literal_collation= default_charset_info;
else
thd->variables.literal_collation= global_system_variables.literal_collation;
}
bool sys_var_result_collation::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.result_collation= var->save_result.charset;
else
thd->variables.result_collation= var->save_result.charset;
return 0;
}
byte *sys_var_result_collation::value_ptr(THD *thd, enum_var_type type)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.result_collation :
thd->variables.result_collation);
return cs ? (byte*) cs->name : (byte*) "";
}
void sys_var_result_collation::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.result_collation= default_charset_info;
else
thd->variables.result_collation= global_system_variables.result_collation;
}
/*****************************************************************************
Functions to handle SET NAMES and SET CHARACTER SET
*****************************************************************************/
int set_var_client_collation::check(THD *thd)
{
return 0;
}
int set_var_client_collation::update(THD *thd)
{
thd->variables.client_collation= client_collation;
thd->variables.literal_collation= literal_collation;
thd->variables.result_collation= result_collation;
thd->protocol_simple.init(thd);
thd->protocol_prep.init(thd);
return 0;
}
/****************************************************************************/
bool sys_var_timestamp::update(THD *thd, set_var *var)
{
thd->set_time((time_t) var->value->val_int());
@ -1681,6 +1757,10 @@ int set_var_password::update(THD *thd)
1 : 0);
}
/****************************************************************************
Used templates
****************************************************************************/

View file

@ -406,20 +406,45 @@ public:
};
class sys_var_client_collation :public sys_var_thd
class sys_var_collation :public sys_var_thd
{
public:
sys_var_client_collation(const char *name_arg) :sys_var_thd(name_arg)
{}
sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) {}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; }
byte *value_ptr(THD *thd, enum_var_type type);
SHOW_TYPE type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
}
bool check_default(enum_var_type type) { return 0; }
virtual void set_default(THD *thd, enum_var_type type)= 0;
};
class sys_var_client_collation :public sys_var_collation
{
public:
sys_var_client_collation(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type);
};
class sys_var_literal_collation :public sys_var_collation
{
public:
sys_var_literal_collation(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type);
};
class sys_var_result_collation :public sys_var_collation
{
public:
sys_var_result_collation(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type);
};
@ -526,6 +551,26 @@ public:
};
/* For SET NAMES and SET CHARACTER SET */
class set_var_client_collation: public set_var_base
{
CHARSET_INFO *client_collation;
CHARSET_INFO *literal_collation;
CHARSET_INFO *result_collation;
public:
set_var_client_collation(CHARSET_INFO *client_coll_arg,
CHARSET_INFO *literal_coll_arg,
CHARSET_INFO *result_coll_arg)
:client_collation(client_coll_arg),
literal_collation(literal_coll_arg),
result_collation(result_coll_arg)
{}
int check(THD *thd);
int update(THD *thd);
};
/*
Prototypes for helper functions
*/
@ -537,3 +582,4 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
extern sys_var_str sys_charset;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);

View file

@ -17,7 +17,7 @@ To make maintaining easier please:
<alias>big-five</alias>
<alias>cn-big5</alias>
<alias>csbig5</alias>
<collation name="big5" id="1" order="Chinese">
<collation name="big5_chinese_ci" id="1" order="Chinese">
<flag>primary</flag>
<flag>compiled"</flag>
</collation>
@ -169,7 +169,7 @@ To make maintaining easier please:
<family>Japanese</family>
<description>EUC-JP Japanese</description>
<alias>euc-jp</alias>
<collation name="ujis" id="12" order="Japanese" flag="primary"/>
<collation name="ujis_japanese_ci" id="12" order="Japanese" flag="primary"/>
</charset>
<charset name="sjis">
@ -178,7 +178,7 @@ To make maintaining easier please:
<alias>s-jis</alias>
<alias>shift-jis</alias>
<alias>x-sjis</alias>
<collation name="sjis" id="13" order="Japanese" flag="primary"/>
<collation name="sjis_japanese_ci" id="13" order="Japanese" flag="primary"/>
</charset>
<charset name="cp1251">
@ -224,15 +224,15 @@ To make maintaining easier please:
<alias>csisolatinhebrew</alias>
<alias>iso-8859-8</alias>
<alias>iso-ir-138</alias>
<collation name="hebrew" id="16" order="Hebrew" flag="primary"/>
<collation name="hebrew_bin" id="71" order="Binary" flag="binary"/>
<collation name="hebrew_general_ci" id="16" order="Hebrew" flag="primary"/>
<collation name="hebrew_bin" id="71" order="Binary" flag="binary"/>
</charset>
<charset name="tis620">
<family>Thai</family>
<description>TIS620 Thai</description>
<alias>tis-620</alias>
<collation name="tis620" id="18" order="Thai">
<collation name="tis620_thai_ci" id="18" order="Thai">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
@ -243,7 +243,7 @@ To make maintaining easier please:
<description>EUC-KR Korean</description>
<alias>euc_kr</alias>
<alias>euc-kr</alias>
<collation name="euckr" id="19" order="Korean">
<collation name="euckr_korean_ci" id="19" order="Korean">
<flag>primary</flag>
<flag>compiled"</flag>
</collation>
@ -283,7 +283,7 @@ To make maintaining easier please:
<description>GB2312 Simplified Chinese</description>
<alias>chinese</alias>
<alias>iso-ir-58</alias>
<collation name="gb2312" id="24" order="Chinese">
<collation name="gb2312_chinese_ci" id="24" order="Chinese">
<flag>primary</flag>
<flag>compiled"</flag>
</collation>
@ -297,8 +297,8 @@ To make maintaining easier please:
<alias>greek8</alias>
<alias>iso-8859-7</alias>
<alias>iso-ir-126</alias>
<collation name="greek" id="25" order="Greek" flag="primary"/>
<collation name="greek_bin" id="70" order="Binary" flag="binary"/>
<collation name="greek_general_ci" id="25" order="Greek" flag="primary"/>
<collation name="greek_bin" id="70" order="Binary" flag="binary"/>
</charset>
<charset name="cp1250">
@ -323,7 +323,7 @@ To make maintaining easier please:
<family>East Asian</family>
<description>GBK Simplified Chinese</description>
<alias>cp936</alias>
<collation name="gbk" id="28" order="Chinese">
<collation name="gbk_chinese_ci" id="28" order="Chinese">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
@ -336,18 +336,12 @@ To make maintaining easier please:
<alias>windows-1257</alias>
<collation name="cp1257_lithuanian_ci" id="29" order="Lithuanian"/>
<collation name="cp1257_bin" id="58" order="Binary" flag="binary"/>
<collation name="cp1257_ci_ai" id="59" flag="primary">
<order>Latvian</order>
<order>Lithuanian</order>
</collation>
<collation name="cp1257_ci" id="60">
<order>Latvian</order>
<order>Lithuanian</order>
</collation>
<collation name="cp1257_cs" id="61">
<collation name="cp1257_general_ci" id="59" flag="primary">
<order>Latvian</order>
<order>Lithuanian</order>
</collation>
<!--collation name="cp1257_ci" id="60"/-->
<!--collation name="cp1257_cs" id="61"/-->
</charset>
<charset name="latin5">
@ -375,14 +369,14 @@ To make maintaining easier please:
<family>Unicode</family>
<description>UTF-8 Unicode</description>
<alias>utf-8</alias>
<collation name="utf8" id="33" flag="primary"/>
<collation name="utf8_bin" id="83" flag="binary"/>
<collation name="utf8_general_ci" id="33" flag="primary"/>
<collation name="utf8_bin" id="83" flag="binary"/>
</charset>
<charset name="ucs2">
<family>Unicode</family>
<description>UCS-2 Unicode</description>
<collation name="ucs2" id="35" flag="primary"/>
<collation name="ucs2_general_ci" id="35" flag="primary"/>
</charset>
<charset name="cp866">
@ -399,15 +393,15 @@ To make maintaining easier please:
<charset name="keybcs2">
<family>Central European</family>
<description>DOS Kamenicky Czech-Slovak</description>
<collation name="keybcs2" id="37" order="Czech" flag="primary"/>
<collation name="keybcs2_bin" id="73" order="Binary" flag="binary"/>
<collation name="keybcs2_general_ci" id="37" order="Czech" flag="primary"/>
<collation name="keybcs2_bin" id="73" order="Binary" flag="binary"/>
</charset>
<charset name="macce">
<family>Central European</family>
<description>Mac Central European</description>
<alias>MacCentralEurope</alias>
<collation name="macce" id="38" flag="primary">
<collation name="macce_general_ci" id="38" flag="primary">
<order>Hungarian</order>
<order>Polish</order>
<order>Romanian</order>
@ -418,24 +412,8 @@ To make maintaining easier please:
</collation>
<collation name="macce_bin" id="43" order="Binary" flag="binary"/>
<!--collation name="macce_ci_ai" id="44"/-->
<collation name="macce_ci" id="45">
<order>Hungarian</order>
<order>Polish</order>
<order>Romanian</order>
<order>Croatian</order>
<order>Slovak</order>
<order>Slovenian</order>
<order>Sorbian</order>
</collation>
<collation name="macce_cs" id="46">
<order>Hungarian</order>
<order>Polish</order>
<order>Romanian</order>
<order>Croatian</order>
<order>Slovak</order>
<order>Slovenian</order>
<order>Sorbian</order>
</collation>
<!--collation name="macce_ci" id="45"/-->
<!--collation name="macce_cs" id="46"/-->
</charset>
<charset name="macroman">
@ -444,7 +422,7 @@ To make maintaining easier please:
<alias>Mac</alias>
<alias>Macintosh</alias>
<alias>csmacintosh</alias>
<collation name="macroman" id="39" flag="primary">
<collation name="macroman_general_ci" id="39" flag="primary">
<order>Dutch</order>
<order>English</order>
<order>French</order>
@ -455,27 +433,9 @@ To make maintaining easier please:
<order>Spanish</order>
</collation>
<collation name="macroman_bin" id="53" order="Binary" flag="binary"/>
<collation name="macroman_ci" id="54">
<order>Dutch</order>
<order>English</order>
<order>French</order>
<order>German Duden</order>
<order>Italian</order>
<order>Latin</order>
<order>Portuguese</order>
<order>Spanish</order>
</collation>
<!--collation name="macroman_ci" id="54"/-->
<!--collation name="macroman_ci_ai" id="55"/-->
<collation name="macroman_cs" id="56">
<order>Dutch</order>
<order>English</order>
<order>French</order>
<order>German Duden</order>
<order>Italian</order>
<order>Latin</order>
<order>Portuguese</order>
<order>Spanish</order>
</collation>
<!--collation name="macroman_cs" id="56"/-->
</charset>
<charset name="cp852">

View file

@ -118,7 +118,7 @@
<collation name="cp1257_bin" flag="binary"/>
<collation name="cp1257_ci_ai">
<collation name="cp1257_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -97,7 +97,7 @@
</unicode>
<collation name="greek">
<collation name="greek_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -93,7 +93,7 @@
</unicode>
<collation name="hebrew">
<collation name="hebrew_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -93,7 +93,7 @@
</unicode>
<collation name="keybcs2">
<collation name="keybcs2_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -93,7 +93,7 @@
</unicode>
<collation name="macce">
<collation name="macce_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -90,7 +90,7 @@
</map>
</unicode>
<collation name="macroman">
<collation name="macroman_general_ci">
<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

View file

@ -264,6 +264,10 @@ v/*
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -258,6 +258,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -266,6 +266,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -260,6 +260,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -264,6 +264,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -257,6 +257,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -257,6 +257,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -257,6 +257,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -257,6 +257,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -259,6 +259,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -259,6 +259,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -257,6 +257,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -251,6 +251,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -263,6 +263,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -256,6 +256,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -255,6 +255,10 @@
"COLLATION '%s' är inte tillåtet för CHARACTER SET '%s'"
"Slaven har redan startat"
"Slaven har redan stoppat"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d rad(er) kapades av group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -260,6 +260,10 @@
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"The slave was already running"
"The slave was already stopped"
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)"
"Z_BUF_ERROR: Not enough memory available for zlib"
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
"Z_DATA_ERROR: Input data was corrupted for zlib"
"%d line(s) was(were) cut by group_concat()"
"Can't create a %s from within another stored routine"
"%s %s already exists"

View file

@ -901,14 +901,14 @@ int collect_real(double *element, element_count count __attribute__((unused)),
TREE_INFO *info)
{
char buff[MAX_FIELD_WIDTH];
String s(buff, sizeof(buff),current_thd->variables.thd_charset);
String s(buff, sizeof(buff),current_thd->charset());
if (info->found)
info->str->append(',');
else
info->found = 1;
info->str->append('\'');
s.set(*element, info->item->decimals, current_thd->variables.thd_charset);
s.set(*element, info->item->decimals, current_thd->charset());
info->str->append(s);
info->str->append('\'');
return 0;
@ -927,7 +927,7 @@ int collect_longlong(longlong *element,
else
info->found = 1;
info->str->append('\'');
s.set(*element, current_thd->variables.thd_charset);
s.set(*element, current_thd->charset());
info->str->append(s);
info->str->append('\'');
return 0;
@ -946,7 +946,7 @@ int collect_ulonglong(ulonglong *element,
else
info->found = 1;
info->str->append('\'');
s.set(*element, current_thd->variables.thd_charset);
s.set(*element, current_thd->charset());
info->str->append(s);
info->str->append('\'');
return 0;

View file

@ -2476,8 +2476,8 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
tables_used->table->tmp_table != NO_TMP_TABLE ||
(tables_used->db_length == 5 &&
#ifdef FN_NO_CASE_SENCE
my_strnncoll(system_charset_info, tables_used->db, 6,
"mysql",6) == 0
my_strnncoll(system_charset_info, (uchar*)tables_used->db, 6,
(uchar*)"mysql",6) == 0
#else
tables_used->db[0]=='m' &&
tables_used->db[1]=='y' &&

View file

@ -212,7 +212,7 @@ void THD::init(void)
{
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
variables.thd_charset=default_charset_info;
variables.client_collation= default_charset_info;
pthread_mutex_unlock(&LOCK_global_system_variables);
server_status= SERVER_STATUS_AUTOCOMMIT;
options= thd_startup_options;

View file

@ -379,9 +379,10 @@ struct system_variables
my_bool log_warnings;
my_bool low_priority_updates;
my_bool new_mode;
my_bool convert_result_charset;
CHARSET_INFO *thd_charset;
CHARSET_INFO *client_collation;
CHARSET_INFO *literal_collation;
CHARSET_INFO *result_collation;
};
void free_tmp_table(THD *thd, TABLE *entry);
@ -664,7 +665,7 @@ public:
net.report_error= 1;
DBUG_PRINT("error",("Fatal error set"));
}
inline CHARSET_INFO *charset() { return variables.thd_charset; }
inline CHARSET_INFO *charset() { return variables.client_collation; }
};
/*

View file

@ -599,7 +599,6 @@ bool mysql_change_db(THD *thd, const char *name)
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(path, &create);
thd->db_charset= create.table_charset ? create.table_charset : default_charset_info;
thd->variables.thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
DBUG_RETURN(0);
}

View file

@ -121,7 +121,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->select_lex.ftfunc_list_alloc.empty();
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
lex->current_select= &lex->select_lex;
lex->thd_charset= lex->thd->variables.thd_charset;
lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
lex->sql_command=SQLCOM_END;
@ -226,7 +225,7 @@ static char *get_text(LEX *lex)
{
reg1 uchar c,sep;
uint found_escape=0;
CHARSET_INFO *cs= lex->thd->variables.thd_charset;
CHARSET_INFO *cs= lex->thd->charset();
sep= yyGetLast(); // String should end with this
//lex->tok_start=lex->ptr-1; // Remember '
@ -439,7 +438,7 @@ int yylex(void *arg, void *yythd)
enum my_lex_states state,prev_state;
LEX *lex= &(((THD *)yythd)->lex);
YYSTYPE *yylval=(YYSTYPE*) arg;
CHARSET_INFO *cs= ((THD *) yythd)->variables.thd_charset;
CHARSET_INFO *cs= ((THD *) yythd)->charset();
uchar *state_map= cs->state_map;
uchar *ident_map= cs->ident_map;

View file

@ -454,7 +454,6 @@ typedef struct st_lex
TYPELIB *interval;
create_field *last_field;
Item *default_value, *comment;
CHARSET_INFO *thd_charset;
uint uint_geom_type;
LEX_USER *grant_user;
gptr yacc_yyss,yacc_yyvs;

View file

@ -201,6 +201,8 @@ public:
*new_list.last=current->next;
current->info=new_list.first->info;
current->next=new_list.first->next;
if ((list->last == &current->next) && (new_list.elements > 1))
list->last= new_list.last;
list->elements+=new_list.elements-1;
}
return ret_value; // return old element

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -68,6 +68,7 @@ int select_union::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
return 0;
}
bool select_union::send_data(List<Item> &values)
{
if (unit->offset_limit_cnt)
@ -91,11 +92,13 @@ bool select_union::send_data(List<Item> &values)
return 0;
}
bool select_union::send_eof()
{
return 0;
}
bool select_union::flush()
{
int error;
@ -108,9 +111,13 @@ bool select_union::flush()
return 0;
}
int st_select_lex_unit::prepare(THD *thd, select_result *result,
int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
bool tables_and_fields_initied)
{
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor;
TMP_TABLE_PARAM tmp_table_param;
DBUG_ENTER("st_select_lex_unit::prepare");
if (prepared)
@ -118,11 +125,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
prepared= 1;
res= 0;
found_rows_for_union= 0;
TMP_TABLE_PARAM tmp_table_param;
this->result= result;
result= sel_result;
t_and_f= tables_and_fields_initied;
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor;
thd->lex.current_select= select_cursor= first_select_in_union();
/* Global option */
@ -144,7 +148,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
TABLE_LIST *first_table= (TABLE_LIST*) select_cursor->table_list.first;
if (setup_tables(first_table) ||
setup_wild(thd, first_table, select_cursor->item_list, 0, select_cursor->with_wild))
setup_wild(thd, first_table, select_cursor->item_list, 0,
select_cursor->with_wild))
goto err;
List_iterator<Item> it(select_cursor->item_list);
Item *item;
@ -156,8 +161,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
(item_list.elements + select_cursor->with_sum_func +
select_cursor->order_list.elements +
select_cursor->group_list.elements)) ||
setup_fields(thd, select_cursor->ref_pointer_array, first_table, item_list,
0, 0, 1))
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
item_list, 0, 0, 1))
goto err;
t_and_f= 1;
}
@ -183,11 +188,11 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
union_result->not_describe=1;
union_result->tmp_table_param=&tmp_table_param;
/*
the following piece of code is placed here solely for the purpose of
getting correct results with EXPLAIN when UNION is withing a sub-select
or derived table ...
*/
/*
The following piece of code is placed here solely for the purpose of
getting correct results with EXPLAIN when UNION is withing a sub-select
or derived table ...
*/
if (thd->lex.describe)
{
@ -216,7 +221,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
(ORDER*) NULL,
sl, this, t_and_f);
t_and_f= 0;
if (res | thd->is_fatal_error)
if (res || thd->is_fatal_error)
goto err;
}
}
@ -235,7 +240,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *result,
}
}
DBUG_RETURN(res | thd->is_fatal_error);
DBUG_RETURN(res || thd->is_fatal_error ? 1 : 0);
err:
thd->lex.current_select= lex_select_save;
DBUG_RETURN(-1);
@ -244,17 +249,18 @@ err:
int st_select_lex_unit::exec()
{
DBUG_ENTER("st_select_lex_unit::exec");
int do_print_slow= 0;
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *select_cursor=first_select_in_union(), *last_select;
DBUG_ENTER("st_select_lex_unit::exec");
LINT_INIT(last_select);
bool do_print_slow=0;
if (executed && !(dependent || uncacheable))
DBUG_RETURN(0);
executed= 1;
if ((dependent||uncacheable) || !item || !item->assigned())
if ((dependent || uncacheable) || !item || !item->assigned())
{
if (optimized && item && item->assigned())
{
@ -314,7 +320,7 @@ int st_select_lex_unit::exec()
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
do_print_slow = do_print_slow || (select_cursor->options & (QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED));
do_print_slow|= select_cursor->options;
}
}
optimized= 1;
@ -322,8 +328,8 @@ int st_select_lex_unit::exec()
/* Send result to 'result' */
// to correct ORDER BY reference resolving
thd->lex.current_select = select_cursor;
res =-1;
thd->lex.current_select= select_cursor;
res= -1;
{
List<Item_func_match> empty_list;
empty_list.empty();
@ -332,9 +338,11 @@ int st_select_lex_unit::exec()
{
SELECT_LEX *fake_select = new SELECT_LEX();
fake_select->make_empty_select(last_select);
offset_limit_cnt= (select_cursor->braces) ? global_parameters->offset_limit : 0;
select_limit_cnt= (select_cursor->braces) ? global_parameters->select_limit+
global_parameters->offset_limit : HA_POS_ERROR;
offset_limit_cnt= (select_cursor->braces ?
global_parameters->offset_limit : 0);
select_limit_cnt= (select_cursor->braces ?
global_parameters->select_limit+
global_parameters->offset_limit : HA_POS_ERROR);
if (select_limit_cnt < global_parameters->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
if (select_limit_cnt == HA_POS_ERROR)
@ -351,14 +359,23 @@ int st_select_lex_unit::exec()
thd->limit_found_rows = (ulonglong)table->file->records;
fake_select->exclude();
delete fake_select;
if (select_cursor == &thd->lex.select_lex && !do_print_slow)
select_cursor->options &= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
/*
Mark for slow query log if any of the union parts didn't use
indexes efficiently
*/
select_cursor->options= ((select_cursor->options &
~(QUERY_NO_INDEX_USED |
QUERY_NO_GOOD_INDEX_USED)) |
do_print_slow &
(QUERY_NO_INDEX_USED |
QUERY_NO_GOOD_INDEX_USED));
}
}
thd->lex.current_select= lex_select_save;
DBUG_RETURN(res);
}
int st_select_lex_unit::cleanup()
{
int error= 0;

View file

@ -399,6 +399,7 @@ int mysql_multi_update(THD *thd,
table_list->grant.want_privilege=(SELECT_ACL & ~table_list->grant.privilege);
if ((res=open_and_lock_tables(thd,table_list)))
DBUG_RETURN(res);
fix_tables_pointers(thd->lex.all_selects_list);
thd->select_limit=HA_POS_ERROR;
if (setup_fields(thd, 0, table_list, *fields, 1, 0, 0))
@ -407,7 +408,7 @@ int mysql_multi_update(THD *thd,
/*
Count tables and setup timestamp handling
*/
for (tl= (TABLE_LIST*) table_list ; tl ; tl=tl->next)
for (tl= select_lex->get_table_list() ; tl ; tl=tl->next)
{
TABLE *table= tl->table;
if (table->timestamp_field)
@ -425,7 +426,8 @@ int mysql_multi_update(THD *thd,
List<Item> total_list;
res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild, total_list,
select_lex->get_table_list(), select_lex->with_wild,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,

View file

@ -142,7 +142,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token FLUSH_SYM
%token HELP_SYM
%token INSERT
%token IO_THREAD
%token RELAY_THREAD
%token KILL_SYM
%token LOAD
%token LOCKS_SYM
@ -586,7 +586,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <lex_str>
IDENT TEXT_STRING REAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM LEX_HOSTNAME
ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_db
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING
SP_FUNC ident_or_spfunc
@ -670,6 +670,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
opt_collate
charset_name
charset_name_or_default
old_or_new_charset_name
old_or_new_charset_name_or_default
collation_name
collation_name_or_default
@ -1893,6 +1895,24 @@ charset_name_or_default:
charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
old_or_new_charset_name:
ident_or_text
{
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str)))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT;
}
}
| BINARY { $$= &my_charset_bin; }
;
old_or_new_charset_name_or_default:
old_or_new_charset_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
collation_name:
ident_or_text
{
@ -1905,7 +1925,7 @@ collation_name:
opt_collate:
/* empty */ { $$=NULL; }
| COLLATE_SYM collation_name { $$=$2; }
| COLLATE_SYM collation_name_or_default { $$=$2; }
;
collation_name_or_default:
@ -2229,7 +2249,7 @@ slave_thread_opt_list:
slave_thread_opt:
/*empty*/ {}
| SQL_THREAD { Lex->slave_thd_opt|=SLAVE_SQL; }
| IO_THREAD { Lex->slave_thd_opt|=SLAVE_IO; }
| RELAY_THREAD { Lex->slave_thd_opt|=SLAVE_IO; }
;
restore:
@ -2708,7 +2728,7 @@ simple_expr:
| simple_expr COLLATE_SYM ident_or_text %prec NEG
{
$$= new Item_func_set_collation($1,new Item_string($3.str,$3.length,
YYTHD->variables.thd_charset));
YYTHD->charset()));
}
| literal
| param_marker
@ -2822,9 +2842,9 @@ simple_expr:
Lex->uncacheable();;
}
| ENCRYPT '(' expr ',' expr ')' { $$= new Item_func_encrypt($3,$5); }
| DECODE_SYM '(' expr ',' TEXT_STRING_db ')'
| DECODE_SYM '(' expr ',' TEXT_STRING_literal ')'
{ $$= new Item_func_decode($3,$5.str); }
| ENCODE_SYM '(' expr ',' TEXT_STRING_db ')'
| ENCODE_SYM '(' expr ',' TEXT_STRING_literal ')'
{ $$= new Item_func_encode($3,$5.str); }
| DES_DECRYPT_SYM '(' expr ')'
{ $$= new Item_func_des_decrypt($3); }
@ -3139,7 +3159,7 @@ opt_distinct:
|DISTINCT { $$ = 1; };
opt_gconcat_separator:
/* empty */ { $$ = new String(" ",1,default_charset_info); }
/* empty */ { $$ = new String(",",1,default_charset_info); }
|SEPARATOR_SYM text_string { $$ = $2; };
@ -3461,7 +3481,7 @@ having_clause:
;
opt_escape:
ESCAPE_SYM TEXT_STRING_db { $$= $2.str; }
ESCAPE_SYM TEXT_STRING_literal { $$= $2.str; }
| /* empty */ { $$= (char*) "\\"; };
@ -3999,8 +4019,8 @@ update:
UPDATE_SYM
{
LEX *lex= Lex;
mysql_init_select(lex);
lex->sql_command= SQLCOM_UPDATE;
lex->select_lex.init_order();
}
opt_low_priority opt_ignore join_table_list
SET update_list where_clause opt_order_clause delete_limit_clause
@ -4008,7 +4028,7 @@ update:
LEX *lex= Lex;
Select->set_lock_for_tables($3);
if (lex->select_lex.table_list.elements > 1)
lex->sql_command=SQLCOM_UPDATE_MULTI;
lex->sql_command= SQLCOM_UPDATE_MULTI;
}
;
@ -4501,24 +4521,22 @@ opt_ignore_lines:
/* Common definitions */
text_literal:
TEXT_STRING_db
TEXT_STRING_literal
{
THD *thd= YYTHD;
CHARSET_INFO *cs= my_charset_same(thd->charset(),thd->db_charset) ?
thd->charset() : thd->db_charset;
$$ = new Item_string($1.str,$1.length,cs);
$$ = new Item_string($1.str,$1.length,thd->variables.literal_collation);
}
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset); }
| text_literal TEXT_STRING_db
| text_literal TEXT_STRING_literal
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
text_string:
TEXT_STRING_db
{ $$= new String($1.str,$1.length,YYTHD->db_charset); }
TEXT_STRING_literal
{ $$= new String($1.str,$1.length,YYTHD->variables.literal_collation); }
| HEX_NUM
{
Item *tmp = new Item_varbinary($1.str,$1.length);
@ -4701,18 +4719,18 @@ TEXT_STRING_sys:
}
;
TEXT_STRING_db:
TEXT_STRING_literal:
TEXT_STRING
{
THD *thd= YYTHD;
if (my_charset_same(thd->charset(),thd->db_charset))
if (my_charset_same(thd->charset(),thd->variables.literal_collation))
{
$$=$1;
}
else
{
String ident;
ident.copy($1.str,$1.length,thd->charset(),thd->db_charset);
ident.copy($1.str,$1.length,thd->charset(),thd->variables.literal_collation);
$$.str= thd->strmake(ident.ptr(),ident.length());
$$.length= ident.length();
}
@ -4829,7 +4847,7 @@ keyword:
| ISSUER_SYM {}
| INNOBASE_SYM {}
| INSERT_METHOD {}
| IO_THREAD {}
| RELAY_THREAD {}
| LAST_SYM {}
| LEVEL_SYM {}
| LINESTRING {}
@ -4997,67 +5015,32 @@ option_value:
find_sys_var("tx_isolation"),
new Item_int((int32) $4)));
}
| charset set_expr_or_default
| charset old_or_new_charset_name_or_default opt_collate
{
THD *thd= YYTHD;
LEX *lex= &thd->lex;
if (!$2)
LEX *lex= Lex;
$2= $2 ? $2: global_system_variables.client_collation;
$3= $3 ? $3 : $2;
if (!my_charset_same($2,$3))
{
CHARSET_INFO *cl= thd->db_charset;
$2= new Item_string(cl->name, strlen(cl->name), &my_charset_latin1);
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
$3->name,$2->csname);
YYABORT;
}
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
$2));
lex->var_list.push_back(new set_var_client_collation($3,thd->db_charset,$3));
}
| NAMES_SYM charset_name_or_default opt_collate
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
CHARSET_INFO *cs= $2 ? $2 : thd->db_charset;
CHARSET_INFO *cl= $3 ? $3 : cs;
if (!my_charset_same(cs,cl))
LEX *lex= Lex;
$2= $2 ? $2 : global_system_variables.client_collation;
$3= $3 ? $3 : $2;
if (!my_charset_same($2,$3))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
$3->name,$2->csname);
YYABORT;
}
Item_string *csname= new Item_string(cl->name,
strlen(cl->name),
&my_charset_latin1);
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
csname));
}
| COLLATION_SYM collation_name_or_default
{
THD* thd= YYTHD;
LEX *lex= &thd->lex;
system_variables *vars= &thd->variables;
CHARSET_INFO *cs= vars->thd_charset;
CHARSET_INFO *cl= $2;
if (!cl)
{
if (!(cl=get_charset_by_csname(cs->csname,MY_CS_PRIMARY,MYF(0))))
{
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"DEFAULT");
YYABORT;
}
}
else if (!my_charset_same(cs,cl))
{
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH,
cl->name,cs->csname);
YYABORT;
}
Item_string *csname= new Item_string(cl->name,
strlen(cl->name),
&my_charset_latin1);
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("client_collation"),
csname));
lex->var_list.push_back(new set_var_client_collation($3,$3,$3));
}
| PASSWORD equal text_or_password
{

View file

@ -6231,7 +6231,7 @@ CHARSET_INFO my_charset_big5 =
1,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"big5", /* cs name */
"big5", /* name */
"big5_chinese_ci", /* name */
"", /* comment */
ctype_big5,
to_lower_big5,

View file

@ -8639,7 +8639,7 @@ CHARSET_INFO my_charset_euc_kr =
19,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"euckr", /* cs name */
"euckr", /* name */
"euckr_korean_ci", /* name */
"", /* comment */
ctype_euc_kr,
to_lower_euc_kr,

View file

@ -5689,7 +5689,7 @@ CHARSET_INFO my_charset_gb2312 =
24,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"gb2312", /* cs name */
"gb2312", /* name */
"gb2312_chinese_ci",/* name */
"", /* comment */
ctype_gb2312,
to_lower_gb2312,

View file

@ -9886,7 +9886,7 @@ CHARSET_INFO my_charset_gbk =
28,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"gbk", /* cs name */
"gbk", /* name */
"gbk_chinese_ci", /* name */
"", /* comment */
ctype_gbk,
to_lower_gbk,

View file

@ -4473,7 +4473,7 @@ CHARSET_INFO my_charset_sjis =
13,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"sjis", /* cs name */
"sjis", /* name */
"sjis_japanese_ci", /* name */
"", /* comment */
ctype_sjis,
to_lower_sjis,

View file

@ -701,7 +701,7 @@ CHARSET_INFO my_charset_tis620 =
18,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"tis620", /* cs name */
"tis620", /* name */
"tis620_thai_ci", /* name */
"", /* comment */
ctype_tis620,
to_lower_tis620,

View file

@ -8430,7 +8430,7 @@ CHARSET_INFO my_charset_ujis =
12,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"ujis", /* cs name */
"ujis", /* name */
"ujis_japanese_ci", /* name */
"", /* comment */
ctype_ujis,
to_lower_ujis,

View file

@ -1955,7 +1955,7 @@ CHARSET_INFO my_charset_utf8 =
33,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"utf8", /* cs name */
"utf8", /* name */
"utf8_general_ci", /* name */
"", /* comment */
ctype_utf8, /* ctype */
to_lower_utf8, /* to_lower */
@ -3030,7 +3030,7 @@ CHARSET_INFO my_charset_ucs2 =
35,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"ucs2", /* cs name */
"ucs2", /* name */
"ucs2_general_ci", /* name */
"", /* comment */
ctype_ucs2, /* ctype */
to_lower_ucs2, /* to_lower */

396
strings/my_strtoll10-x86.s Normal file
View file

@ -0,0 +1,396 @@
# Copyright (C) 2003 MySQL AB
# This program is free software; you can resistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Implemention of my_strtoll(): Converting a string to a 64 bit integer.
.file "my_strtoll10-x86.s"
.version "01.01"
.data
.align 32
.type lfactor,@object
.size lfactor,36
lfactor:
.long 1
.long 10
.long 100
.long 1000
.long 10000
.long 100000
.long 1000000
.long 10000000
.long 100000000
.text
.align 4
.globl my_strtoll10
.type my_strtoll10,@function
# Used stack variables
# ebp-4 dummy for storing endptr if endptr = 0
# ebp-8 First 9 digits of return values
# ebp-12 Pointer to first digit of second part
# ebp-16 Store lowest 2 digits
# ebp-20 != 0 if value was negative
# ebp-24 High max value
# ebp-28 Middle max value
# ebp-32 Low max value
# ebp-36 Temp value
# esi Pointer to input string
# ebx End of string
my_strtoll10:
pushl %ebp
movl %esp,%ebp
subl $48,%esp
pushl %esi
pushl %edi
pushl %ebx
movl 8(%ebp),%esi # esi= nptr
movl 16(%ebp),%ecx # ecx= error (Will be overwritten later)
movl 12(%ebp),%eax # eax= endptr
cld # Move forward in esi
cmpl $0,%eax # if (endptr)
je .L110
# Fixed length string
movl (%eax),%ebx # bx= end-of-string
.p2align 4,,7
.L100:
cmpl %ebx,%esi
je .Lno_conv
lodsb # al= next byte
cmpb $32,%al # Skip space
je .L100
cmpb $9,%al # Skip tab
je .L100
jmp .L130
# String that ends with \0
.L110:
leal -4(%ebp),%edi
movl %edi,12(%ebp) # endptr= &dummy, for easier end check
.p2align 4,,7
.L120:
lodsb # al= next byte
cmpb $32,%al
je .L120
cmpb $9,%al
je .L120
testb %al,%al # Test if we found end \0
je .Lno_conv
leal 65535(%esi),%ebx # ebx = end-of-string
.L130:
cmpb $45,%al # Test if '-'
jne .Lpositive
# negative number
movl $-1,(%ecx) # error = -1 (mark that number is negative)
movl $1,-20(%ebp) # negative= 1
movl $92233720,-24(%ebp)
movl $368547758,-28(%ebp)
movl $8,-32(%ebp)
jmp .L460
.p2align 4,,7
.Lpositive:
movl $0,(%ecx) # error=0
movl $0,-20(%ebp) # negative= 0
movl $184467440,-24(%ebp)
movl $737095516,-28(%ebp)
movl $15,-32(%ebp)
cmpb $43,%al # Check if '+'
jne .L462
.L460:
cmpl %ebx,%esi # Check if overflow
je .Lno_conv
lodsb # al= next byte after sign
# Remove pre zero to be able to handle a lot of pre-zero
.L462:
cmpb $48,%al
jne .L475 # Number doesn't start with 0
movl %esi, %edi
.p2align 4,,7
.L481: # Skip pre zeros
cmpl %ebx,%esi
je .Lms_return_zero
scasb
je .L481
movl %edi, %esi
decl %esi # Point to last non '0' digit
leal 9(%esi),%ecx # ecx = end-of-current-part
xorl %edi,%edi # Store first 9 digits in edi
jmp .L482
.p2align 4,,7
# Check if first char is a valid number
.L475:
addb $-48,%al
cmpb $9,%al
ja .Lno_conv
.L477:
movzbl %al,%edi # edi = first digit
leal 8(%esi),%ecx # ecx = end-of-current-part
# Handle first 8/9 digits and store them in edi
.L482:
cmpl %ebx,%ecx
jbe .L522
movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
jmp .L522
.p2align 4,,7
.L488:
lodsb # al= next byte
addb $-48,%al
cmpb $9,%al
ja .Lend_i_dec_esi
# Calculate edi= edi*10 + al
leal (%edi,%edi,4),%edx
movzbl %al,%eax
leal (%eax,%edx,2),%edi
.L522:
cmpl %ecx,%esi # If more digits at this level
jne .L488
cmpl %ebx,%esi # If end of string
je .Lend_i
movl %edi,-8(%ebp) # Store first 9 digits
movl %esi,-12(%ebp) # store pos to first digit of second part
# Calculate next 9 digits and store them in edi
xorl %edi,%edi
leal 9(%esi),%ecx # ecx= end-of-current-part
movl %ecx,-36(%ebp) # Store max length
cmpl %ebx,%ecx
jbe .L498
movl %ebx,%ecx # ecx = min(end-of-current-part, end-of-string)
.p2align 4,,7
.L498:
lodsb # al= next byte
addb $-48,%al
cmpb $9,%al
ja .Lend_i_and_j_decl_esi
# Calculate edi= edi*10 + al
leal (%edi,%edi,4),%edx
movzbl %al,%eax
leal (%eax,%edx,2),%edi
cmpl %ecx,%esi # If end of current part
jne .L498
cmpl %ebx,%esi # If end of string
jne .L500
cmpl -36(%ebp),%esi # Test if string is less than 18 digits
jne .Lend_i_and_j
jmp .Lend3 # 18 digit string
# Handle the possible next to last digit and store in ecx
.L500:
movb (%esi),%al
addb $-48,%al
cmpb $9,%al
ja .Lend3
incl %esi
movzbl %al,%ecx
cmpl %ebx,%esi # If end of string
je .Lend4
movb (%esi),%al # Read last digit
addb $-48,%al
cmpb $9,%al
ja .Lend4
# ecx= ecx*10 + al
leal (%ecx,%ecx,4),%edx
movzbl %al,%eax
leal (%eax,%edx,2),%ecx
movl 12(%ebp),%eax # eax = endptr
incl %esi
movl %esi,(%eax) # *endptr = end-of-string
cmpl %ebx,%esi
je .L505 # At end of string
movb (%esi),%al # check if extra digits
addb $-48,%al
cmpb $9,%al
jbe .Loverflow
# At this point we have:
# -8(%ebp) First 9 digits
# edi Next 9 digits
# ecx Last 2 digits
# *endpos end-of-string
.L505: # Check that we are not going to get overflow for unsigned long long
movl -8(%ebp),%eax # First 9 digits
cmpl -24(%ebp),%eax
ja .Loverflow
jne .L507
cmpl -28(%ebp),%edi
ja .Loverflow
jne .L507
cmpl -32(%ebp),%ecx
ja .Loverflow
.L507:
movl %edi,-4(%ebp) # Save middle bytes
movl %ecx,%esi # esi = 2 last digits
movl $1215752192,%ecx # %ecx= lower_32_bits(100000000000)
mull %ecx
imull $23,-8(%ebp),%ecx
movl $0,-36(%ebp)
movl %eax,%ebx
imull $1215752192,-36(%ebp),%eax
movl %edx,%edi
addl %ecx,%edi
addl %eax,%edi # Temp in edi:ebx
movl $100,%eax # j= j*100
mull -4(%ebp)
addl %ebx,%eax # edx:eax+= edi:ebx
adcl %edi,%edx
addl %esi,%eax
adcl $0,%edx
jmp .Lms_return
.Loverflow:
# When we come here, *endptr is already updated
movl 16(%ebp),%edx # edx= error
movl $34,(%edx) # *error = 34
movl $-1,%eax
movl %eax,%edx
cmpl $0,-20(%ebp) # If negative
je .Lms_return
xor %eax,%eax # edx:eax = LONGLONG_LMIN
movl $-2147483648,%edx
jmp .Lms_return
# Return value that is in %edi as long long
.p2align 4,,7
.Lend_i_dec_esi:
decl %esi # Fix so that it points at last digit
.Lend_i:
xorl %edx,%edx
movl %edi,%eax
cmpl $0,-20(%ebp)
je .Lreturn_save_endptr # Positive number
negl %eax
cltd # Negetive result in edx:eax
jmp .Lreturn_save_endptr
# Return value (%ebp-8) * lfactor[(uint) (edx-start)] + edi
.p2align 4,,7
.Lend_i_and_j_decl_esi:
decl %esi # Fix so that it points at last digit
.Lend_i_and_j:
movl %esi,%ecx
subl -12(%ebp),%ecx # ecx= number of digits in second part
movl lfactor(,%ecx,4),%eax
jmp .L523
# Return -8(%ebp) * $1000000000 + edi
.p2align 4,,7
.Lend3:
movl $1000000000,%eax
.L523:
mull -8(%ebp)
addl %edi,%eax
adcl $0,%edx
cmpl $0,-20(%ebp) # if negative
je .Lreturn_save_endptr
negl %eax # Neg edx:%eax
adcl $0,%edx
negl %edx
jmp .Lreturn_save_endptr
# Return -8(%ebp) * $10000000000 + edi*10 + ecx
.p2align 4,,7
.Lend4:
movl %ecx,-16(%ebp) # store lowest digits
movl 12(%ebp),%ebx
movl %esi,(%ebx) # *endpos = end-of-string
movl -8(%ebp),%eax # First 9 digits
movl $1410065408,%ecx # ecx= lower_32_bits(10000000000)
mull %ecx
movl $0,-36(%ebp)
movl %eax,%ebx # Store lowest 32 byte from multiplication
imull $1410065408,-36(%ebp),%eax
movl -8(%ebp),%ecx # First 9 digits
movl %edx,%esi
addl %ecx,%ecx
addl %ecx,%esi
addl %eax,%esi # %esi:%ebx now has -8(%ebp) * $10000000000
movl $10,%eax # Calc edi*10
mull %edi
addl %ebx,%eax # And add to result
adcl %esi,%edx
addl -16(%ebp),%eax # Add lowest digit
adcl $0,%edx
cmpl $0,-20(%ebp) # if negative
je .Lms_return
cmpl $-2147483648,%edx # Test if too big signed integer
ja .Loverflow
jne .L516
testl %eax,%eax
ja .Loverflow
.L516:
negl %eax
adcl $0,%edx
negl %edx
jmp .Lms_return
.p2align 4,,7
.Lno_conv: # Not a legal number
movl 16(%ebp),%eax
movl $33,(%eax) # error= edom
.Lms_return_zero:
xorl %eax,%eax # Return zero
xorl %edx,%edx
.p2align 4,,7
.Lreturn_save_endptr:
movl 12(%ebp),%ecx # endptr= end-of-string
movl %esi,(%ecx) # *endptr= end-of-string
.Lms_return:
popl %ebx
popl %edi
popl %esi
movl %ebp,%esp
popl %ebp
ret
my_strtoll10_end:
.size my_strtoll10,.my_strtoll10_end-my_strtoll10
.comm res,240,32
.comm end_ptr,120,32
.comm error,120,32
.ident "Monty"

237
strings/my_strtoll10.c Normal file
View file

@ -0,0 +1,237 @@
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <m_string.h>
#define ULONGLONG_MAX (~(ulonglong) 0)
#define MAX_NEGATIVE_NUMBER ((ulonglong) 0x8000000000000000LL)
#define INIT_CNT 9
#define LFACTOR LL(1000000000)
#define LFACTOR1 LL(10000000000)
#define LFACTOR2 LL(100000000000)
static unsigned long lfactor[9]=
{
1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, 100000000L
};
/*
Convert a string to an to unsigned long long integer value
SYNOPSYS
str2ull10(char *nptr, char **enptr, *long error)
nptr in pointer to the string to be converted
endptr in/out pointer to the end of the string/
pointer to the stop character
error out returned error code
DESCRIPTION
This function takes the decimal representation of integer number
from string nptr and converts it to an signed or unsigned
long long integer value.
Space characters and tab are ignored.
A sign character might precede the the digit characters. The number
may have any number of pre-zero digits.
The function stops reading the string nptr at the first character
that is not a decimal digit. If endptr is not NULL then the function
will not read characters after *endptr.
RETURN VALUES
Value of string as a signed/unsigned longlong integer
if no error and endptr != NULL, it will be set to point at the character
after the number
The error parameter contains information how things went:
-1 Number was an ok negative number
0 ok
ERANGE If the the value of the converted number exceeded the
maximum negative/unsigned long long integer.
In this case the return value is ~0 if value was
positive and LONGLONG_MIN if value was negative.
EDOM If the string didn't contain any digits. In this case
the return value is 0.
If endptr is not NULL the function will store the end pointer to
the stop character here.
*/
longlong my_strtoll10(const char *nptr, char **endptr, int *error)
{
const char *s, *end, *start, *n_end, *true_end;
char *dummy;
unsigned char c;
unsigned long i, j, k;
ulonglong li;
int negative;
long cutoff, cutoff2, cutoff3;
s= nptr;
/* If fixed length string */
if (endptr)
{
end= *endptr;
while (s != end && (*s == ' ' || *s == '\t'))
s++;
if (s == end)
goto no_conv;
}
else
{
endptr= &dummy; /* Easier end test */
while (*s == ' ' || *s == '\t')
s++;
if (!*s)
goto no_conv;
/* This number must be big to guard against a lot of pre-zeros */
end= s+65535; /* Can't be longer than this */
}
/* Check for a sign. */
negative= 0;
if (*s == '-')
{
*error= -1; /* Mark as negative number */
negative= 1;
if (++s == end)
goto no_conv;
cutoff= MAX_NEGATIVE_NUMBER / LL(100000000000);
cutoff2= (MAX_NEGATIVE_NUMBER % LL(100000000000)) / 100;
cutoff3= MAX_NEGATIVE_NUMBER % 100;
}
else
{
*error= 0;
if (*s == '+')
{
if (++s == end)
goto no_conv;
}
cutoff= ULONGLONG_MAX / LL(100000000000);
cutoff2= ULONGLONG_MAX % LL(100000000000) / 100;
cutoff3= ULONGLONG_MAX % 100;
}
/* Handle case where we have a lot of pre-zero */
if (*s == '0')
{
i= 0;
do
{
if (++s == end)
goto end_i; /* Return 0 */
}
while (*s == '0');
n_end= s+ INIT_CNT;
}
else
{
/* Read first digit to check that it's a valid number */
if ((c= (*s-'0')) > 9)
goto no_conv;
i= c;
n_end= ++s+ INIT_CNT-1;
}
/* Handle first 9 digits and store them in i */
if (n_end > end)
n_end= end;
for (; s != n_end ; s++)
{
if ((c= (*s-'0')) > 9)
goto end_i;
i= i*10+c;
}
if (s == end)
goto end_i;
/* Handle next 9 digits and store them in j */
j= 0;
start= s; /* Used to know how much to shift i */
n_end= true_end= s + INIT_CNT;
if (n_end > end)
n_end= end;
do
{
if ((c= (*s-'0')) > 9)
goto end_i_and_j;
j= j*10+c;
} while (++s != n_end);
if (s == end)
{
if (s != true_end)
goto end_i_and_j;
goto end3;
}
if ((c= (*s-'0')) > 9)
goto end3;
/* Handle the next 1 or 2 digits and store them in k */
k=c;
if (++s == end || (c= (*s-'0')) > 9)
goto end4;
k= k*10+c;
*endptr= (char*) ++s;
/* number string should have ended here */
if (s != end && (c= (*s-'0')) <= 9)
goto overflow;
/* Check that we didn't get an overflow with the last digit */
if (i > cutoff || i == cutoff && (j > cutoff2 || j == cutoff2 &&
k > cutoff3))
goto overflow;
li=i*LFACTOR2+ (ulonglong) j*100 + k;
return (longlong) li;
overflow: /* *endptr is set here */
*error= MY_ERRNO_ERANGE;
return negative ? LONGLONG_MIN : ULONGLONG_MAX;
end_i:
*endptr= (char*) s;
return (negative ? ((longlong) -(long) i) : (longlong) i);
end_i_and_j:
li= (ulonglong) i * lfactor[(uint) (s-start)] + j;
*endptr= (char*) s;
return (negative ? -((longlong) li) : (longlong) li);
end3:
li=(ulonglong) i*LFACTOR+ (ulonglong) j;
*endptr= (char*) s;
return (negative ? -((longlong) li) : (longlong) li);
end4:
li=(ulonglong) i*LFACTOR1+ (ulonglong) j * 10 + k;
*endptr= (char*) s;
if (negative)
{
if (li > MAX_NEGATIVE_NUMBER)
goto overflow;
return -((longlong) li);
}
return (longlong) li;
no_conv:
/* There was no number to convert. */
*error= MY_ERRNO_EDOM;
*endptr= (char *) nptr;
return 0;
}