mariadb/strings/ctype-bin.c

389 lines
10 KiB
C
Raw Normal View History

/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* This file is for binary pseudo charset, created by bar@mysql.com */
#include <my_global.h>
#include "m_string.h"
#include "m_ctype.h"
Fixed a lot of wrong memory references as reported by valgrind Portability fixes Added new client function: mysql_get_server_version() New server help code (From Victor Vagin) Fixed wrong usage of binary() Disabled RTREE usage for now. BitKeeper/etc/ignore: added scripts/fill_help_tables.sql client/mysql.cc: Some fixes when using 'help' cmd-line-utils/libedit/compat.h: Portability fix cmd-line-utils/libedit/fgetln.c: Portability fix include/mysql.h: Added new client function: mysql_get_server_version() libmysql/libmysql.c: Added new client function: mysql_get_server_version() libmysqld/libmysqld.c: Fixed prototype mysql-test/install_test_db.sh: Added creation of help tables mysql-test/r/connect.result: Added help tables mysql-test/r/myisam.result: Test of RTREE index mysql-test/r/type_ranges.result: updated results mysql-test/t/myisam.test: Test of RTREE index mysql-test/t/type_ranges.test: Updated test mysys/charset.c: Indentation change mysys/my_symlink.c: Removed compiler warning scripts/fill_help_tables.sh: Update for new help tables sql/field.cc: Indentation changes sql/filesort.cc: Optimized character set usage sql/item_cmpfunc.cc: Fix wrong usage of binary() sql/item_cmpfunc.h: Fix wrong usage of binary() sql/item_func.cc: Fix wrong usage of binary() sql/item_func.h: Fix wrong usage of binary() sql/item_strfunc.cc: Fix wrong usage of binary() sql/item_sum.cc: Fix wrong usage of binary() sql/item_sum.h: Fix wrong usage of binary() sql/key.cc: Indentation change sql/lex.h: HELP -> HELP_SYM sql/mysql_priv.h: Make get_field() more general sql/password.c: Indentation change + variable initialisation moved sql/sql_acl.cc: Make get_field() more general sql/sql_base.cc: Added comments + assertion for double call to mysql_lock_tables sql/sql_cache.cc: Indentation changes sql/sql_class.h: Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort sql/sql_derived.cc: Renamed variables sql/sql_help.cc: New help functions (from Victor Vagin) sql/sql_lex.cc: Removed variables that doesn't have to be initialized for each query sql/sql_lex.h: Removed not used variable (olap) sql/sql_parse.cc: Fixed (not fatal) access of unitialized memory Indentation / code cleanup sql/sql_prepare.cc: Indentaion cleanup sql/sql_table.cc: Disabled RTREE until 5.0 sql/sql_udf.cc: Make get_field() more general sql/sql_yacc.yy: Removed access to uninitialized memory Always set offset_limit and select_limit when using LIMIT (removed warnings) Allow usage of 'help week' sql/table.cc: Make get_field() more general More comments sql/table.h: Fixded type of TABLE_LIST->derived sql/time.cc: Stricter date / datetime handling (to be able to handle timestamps with days and microseconds) strings/ctype-bin.c: Added cha
2003-02-12 20:55:37 +01:00
static uchar ctype_bin[]=
{
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16,
Fixed a lot of wrong memory references as reported by valgrind Portability fixes Added new client function: mysql_get_server_version() New server help code (From Victor Vagin) Fixed wrong usage of binary() Disabled RTREE usage for now. BitKeeper/etc/ignore: added scripts/fill_help_tables.sql client/mysql.cc: Some fixes when using 'help' cmd-line-utils/libedit/compat.h: Portability fix cmd-line-utils/libedit/fgetln.c: Portability fix include/mysql.h: Added new client function: mysql_get_server_version() libmysql/libmysql.c: Added new client function: mysql_get_server_version() libmysqld/libmysqld.c: Fixed prototype mysql-test/install_test_db.sh: Added creation of help tables mysql-test/r/connect.result: Added help tables mysql-test/r/myisam.result: Test of RTREE index mysql-test/r/type_ranges.result: updated results mysql-test/t/myisam.test: Test of RTREE index mysql-test/t/type_ranges.test: Updated test mysys/charset.c: Indentation change mysys/my_symlink.c: Removed compiler warning scripts/fill_help_tables.sh: Update for new help tables sql/field.cc: Indentation changes sql/filesort.cc: Optimized character set usage sql/item_cmpfunc.cc: Fix wrong usage of binary() sql/item_cmpfunc.h: Fix wrong usage of binary() sql/item_func.cc: Fix wrong usage of binary() sql/item_func.h: Fix wrong usage of binary() sql/item_strfunc.cc: Fix wrong usage of binary() sql/item_sum.cc: Fix wrong usage of binary() sql/item_sum.h: Fix wrong usage of binary() sql/key.cc: Indentation change sql/lex.h: HELP -> HELP_SYM sql/mysql_priv.h: Make get_field() more general sql/password.c: Indentation change + variable initialisation moved sql/sql_acl.cc: Make get_field() more general sql/sql_base.cc: Added comments + assertion for double call to mysql_lock_tables sql/sql_cache.cc: Indentation changes sql/sql_class.h: Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort sql/sql_derived.cc: Renamed variables sql/sql_help.cc: New help functions (from Victor Vagin) sql/sql_lex.cc: Removed variables that doesn't have to be initialized for each query sql/sql_lex.h: Removed not used variable (olap) sql/sql_parse.cc: Fixed (not fatal) access of unitialized memory Indentation / code cleanup sql/sql_prepare.cc: Indentaion cleanup sql/sql_table.cc: Disabled RTREE until 5.0 sql/sql_udf.cc: Make get_field() more general sql/sql_yacc.yy: Removed access to uninitialized memory Always set offset_limit and select_limit when using LIMIT (removed warnings) Allow usage of 'help week' sql/table.cc: Make get_field() more general More comments sql/table.h: Fixded type of TABLE_LIST->derived sql/time.cc: Stricter date / datetime handling (to be able to handle timestamps with days and microseconds) strings/ctype-bin.c: Added cha
2003-02-12 20:55:37 +01:00
16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Simplified 'wrong xxx name' error messages by introducing 'general' ER_WRONG_NAME error Cleaned up (and disabled part of) date/time/datetime format patch. One can't anymore change default read/write date/time/formats. This is becasue the non standard datetime formats can't be compared as strings and MySQL does still a lot of datetime comparisons as strings Changed flag argument to str_to_TIME() and get_date() from bool to uint Removed THD from str_to_xxxx functions and Item class. Fixed core dump when doing --print-defaults Move some common string functions to strfunc.cc Dates as strings are now of type my_charset_bin instead of default_charset() Introduce IDENT_QUOTED to not have to create an extra copy of simple identifiers (all chars < 128) Removed xxx_FORMAT_TYPE enums and replaced them with the old TIMESTAMP_xxx enums Renamed some TIMESTAMP_xxx enums to more appropriate names Use defines instead of integers for date/time/datetime string lengths Added to build system and use the new my_strtoll10() function. BUILD/compile-pentium-valgrind-max: Remove double printing of warning VC++Files/libmysqld/libmysqld.dsp: Added strfunc.cc VC++Files/sql/mysqld.dsp: Added strfunc.cc VC++Files/sql/mysqldmax.dsp: Added strfunc.cc VC++Files/strings/strings.dsp: added my_strtoll10.c include/m_ctype.h: Removed MY_LEX_FOUND_IDENT (not used) include/m_string.h: Added my_strtoll10() include/mysqld_error.h: simplified 'wrong xxx name' error messages include/sql_state.h: simplified 'wrong xxx name' error messages libmysqld/Makefile.am: Added strfunc.cc mysql-test/mysql-test-run.sh: Simplified some options changed $@ to "$@" in an attempt to handle options with space (Didn't succeed; Problem will disappear when mysql-test-run is rewritten in C) mysql-test/r/ctype_latin1_de.result: Added new tests mysql-test/r/ctype_recoding.result: Extended tests mysql-test/r/date_formats.result: Cleaned up tests Disabled some tests that can't yet be run mysql-test/r/func_compress.result: New error message mysql-test/r/rpl_temporary.result: Added new test mysql-test/t/create.test: Changed error numbers mysql-test/t/ctype_latin1_de.test: New tests mysql-test/t/ctype_recoding.test: Extended tests mysql-test/t/date_formats-master.opt: Removed datetime_format as we can't handle options with space in mysql-test-run mysql-test/t/date_formats.test: Cleaned up tests Disabled some tests that can't yet be run mysql-test/t/rpl_temporary.test: Added testing of open temporary table on slave shutdown mysql-test/t/symlink.test: Fixed error numbers mysys/default.c: Fixed core dump when doing --print-defaults sql/Makefile.am: Added strfunc.cc sql/derror.cc: Fixed compiler warning sql/field.cc: Changed argument to str_to_TIME() from bool to uint Removed THD argument from str_to_TIME() Moved find_enum() and find_set() to strfunc.cc sql/field.h: Changed type of last argument to get_date() to be able to handle more options sql/init.cc: Remove not used variable dayord sql/item.cc: Changed type of last argument to get_date() to be able to handle more options Removed THD* element from item. Don't use make_date_time() to generate date/time/datetimes sql/item.h: Changed type of last argument to get_date() to be able to handle more options Removed THD* from Item sql/item_create.cc: Indentation cleanup sql/item_func.cc: Use new find_type() sql/item_func.h: Changed type of last argument to get_date() to be able to handle more options sql/item_strfunc.h: space change sql/item_timefunc.cc: Changed month_names[] to be easier to use Moved check_names[] to strfunc.cc Added back old make_datetime() function Optimized extract_date_time() Use my_strtoll10() insetad of my_strntoll() Optimized make_date_time() Replaced short variable names with long ones. Use new functions make_time(), make_date() and make_datetime() Dates as strings are now of type my_charset_bin instead of default_charset() Changed Item_func_str_to_date() to by default return a date. sql/item_timefunc.h: Changed charset for date string from default_charset() to my_charset_bin Changed type of last argument to get_date() to be able to handle more options Use defines instead of integers for date/time/datetime string lengths sql/mysql_priv.h: Fixed/added new prototypes sql/mysqld.cc: Removed opt_datetime_format_names Cleaned up handling of date_time format handling. (Fixed core dump when mysqld had error on startup) Removed some unnecessary double init of collation variables sql/protocol.cc: Changed back protocol functions to always return dates in ISO format sql/set_var.cc: Added variables time_format, date_format and datetime_format This had to be recoded becasue checking was done in 'update' method and not in 'check' method. sql/set_var.h: Removed class sys_var_datetime_format() as this defined a variable (which doesn't work) instead of updating a variable sql/share/czech/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/danish/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/dutch/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/english/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/estonian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/french/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/german/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/greek/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/hungarian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/italian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/japanese/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/korean/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/norwegian-ny/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/norwegian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/polish/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/portuguese/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/romanian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/russian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/serbian/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/slovak/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/spanish/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/swedish/errmsg.txt: simplified 'wrong xxx name' error messages sql/share/ukrainian/errmsg.txt: simplified 'wrong xxx name' error messages sql/sql_base.cc: Use new find_type() sql/sql_class.cc: Allocate/free date_time format variables sql/sql_class.h: Define datetime_format variables sql/sql_db.cc: Use new ER_WRONG_NAME error sql/sql_lex.cc: Change lex to generate IDENT_QUOTED for quoted identifiers or identifers that are using characters > 128. This enabled us to not have to copy and convert the identifier to utf8 for simpe identifiers sql/sql_parse.cc: Use new ER_WRONG_NAME error Use new find_type() function sql/sql_prepare.cc: Use new defines sql/sql_table.cc: Use new ER_WRONG_NAME error sql/sql_yacc.yy: Don't copy and convert simple identifiers to utf8. Replace __FORMAT_TYPE defines with TIMESTAMP... defines sql/structs.h: Renamed DATETIME_FORMAT to DATE_TIME format to indicate that it's for date/time/datetime formats Renamed WRONT_TIMESTAMP_FULL to TIMESTAMP_DATETIME_ERROR and TIMESTAMP_FULL to TIMESTAMP_DATETIME Added KNOWN_DATE_TIME_FORMAT struct for Item_func_get_format sql/time.cc: Prepare str_to_TIME and str_to_time() for general date/time handling Removed THD from str_to... functions Renamed date/time/datetime functions to use 'date_time' instead of 'datetime' Added functions to make and copy DATE_TIME_FORMAT's Added trivial functions 'make_time()', 'make_date()' and 'make_datetime()' strings/Makefile.am: Added my_strtoll10() strings/ctype-bin.c: Cleared upper part of binary state map to be able to easily identify simple identifiers strings/my_vsnprintf.c: F
2003-11-03 13:01:59 +01:00
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Fixed a lot of wrong memory references as reported by valgrind Portability fixes Added new client function: mysql_get_server_version() New server help code (From Victor Vagin) Fixed wrong usage of binary() Disabled RTREE usage for now. BitKeeper/etc/ignore: added scripts/fill_help_tables.sql client/mysql.cc: Some fixes when using 'help' cmd-line-utils/libedit/compat.h: Portability fix cmd-line-utils/libedit/fgetln.c: Portability fix include/mysql.h: Added new client function: mysql_get_server_version() libmysql/libmysql.c: Added new client function: mysql_get_server_version() libmysqld/libmysqld.c: Fixed prototype mysql-test/install_test_db.sh: Added creation of help tables mysql-test/r/connect.result: Added help tables mysql-test/r/myisam.result: Test of RTREE index mysql-test/r/type_ranges.result: updated results mysql-test/t/myisam.test: Test of RTREE index mysql-test/t/type_ranges.test: Updated test mysys/charset.c: Indentation change mysys/my_symlink.c: Removed compiler warning scripts/fill_help_tables.sh: Update for new help tables sql/field.cc: Indentation changes sql/filesort.cc: Optimized character set usage sql/item_cmpfunc.cc: Fix wrong usage of binary() sql/item_cmpfunc.h: Fix wrong usage of binary() sql/item_func.cc: Fix wrong usage of binary() sql/item_func.h: Fix wrong usage of binary() sql/item_strfunc.cc: Fix wrong usage of binary() sql/item_sum.cc: Fix wrong usage of binary() sql/item_sum.h: Fix wrong usage of binary() sql/key.cc: Indentation change sql/lex.h: HELP -> HELP_SYM sql/mysql_priv.h: Make get_field() more general sql/password.c: Indentation change + variable initialisation moved sql/sql_acl.cc: Make get_field() more general sql/sql_base.cc: Added comments + assertion for double call to mysql_lock_tables sql/sql_cache.cc: Indentation changes sql/sql_class.h: Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort sql/sql_derived.cc: Renamed variables sql/sql_help.cc: New help functions (from Victor Vagin) sql/sql_lex.cc: Removed variables that doesn't have to be initialized for each query sql/sql_lex.h: Removed not used variable (olap) sql/sql_parse.cc: Fixed (not fatal) access of unitialized memory Indentation / code cleanup sql/sql_prepare.cc: Indentaion cleanup sql/sql_table.cc: Disabled RTREE until 5.0 sql/sql_udf.cc: Make get_field() more general sql/sql_yacc.yy: Removed access to uninitialized memory Always set offset_limit and select_limit when using LIMIT (removed warnings) Allow usage of 'help week' sql/table.cc: Make get_field() more general More comments sql/table.h: Fixded type of TABLE_LIST->derived sql/time.cc: Stricter date / datetime handling (to be able to handle timestamps with days and microseconds) strings/ctype-bin.c: Added cha
2003-02-12 20:55:37 +01:00
};
/* Dummy array for toupper / tolower / sortorder */
static uchar bin_char_array[] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
int cmp= memcmp(s,t,min(slen,tlen));
return cmp ? cmp : (int) (slen - tlen);
}
static int my_strnncollsp_binary(CHARSET_INFO * cs,
const uchar *s, uint slen,
const uchar *t, uint tlen)
{
int len, cmp;
for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--);
for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--);
len = ( slen > tlen ) ? tlen : slen;
cmp= memcmp(s,t,len);
return cmp ? cmp : (int) (slen - tlen);
}
static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)),
char *str __attribute__((unused)))
{
}
static void my_casedn_str_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)))
{
}
static void my_caseup_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
{
}
static void my_casedn_bin(CHARSET_INFO * cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
{
}
static int my_strcasecmp_bin(CHARSET_INFO * cs __attribute__((unused)),
const char *s, const char *t)
{
return strcmp(s,t);
}
int my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)),
uint c __attribute__((unused)))
{
return 1;
}
static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *wc,
const unsigned char *str,
const unsigned char *end __attribute__((unused)))
{
if (str >= end)
return MY_CS_TOOFEW(0);
*wc=str[0];
return 1;
}
static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc,
unsigned char *s,
unsigned char *e __attribute__((unused)))
{
if (s >= e)
return MY_CS_TOOSMALL;
Portability fixes (for windows) Some changes to the prepared statement protocol to make it easier to use and faster. Makefile.am: Fix to make dist to work with cmd-line-utils client/mysql.cc: Portability fixes client/mysqlbinlog.cc: Portabiliy fixes and remove usafe of FILE configure.in: Fix to make dist to work with cmd-line-utils heap/_check.c: Portability fixes include/config-win.h: Portability fixes include/m_ctype.h: Indentation cleanup include/my_list.h: Portability fixes include/mysql.h: Cleanup of BIND structure include/violite.h: Portability fixes innobase/dict/dict0dict.c: Portability fixes innobase/dict/dict0load.c: Portability fixes innobase/include/os0proc.h: Portability fixes (Heikki, please check) innobase/os/os0proc.c: Portability fixes (Heikki, please check) innobase/ut/ut0ut.c: Portability fixes isam/pack_isam.c: Portability fixes libmysql/libmysql.c: Portability fixes Remove obscure usage of the length parameter for prepared statements. libmysql/libmysql.def: Remove not existing functions libmysqld/lib_sql.cc: Remove compiler warning mysql-test/r/explain.result: Fix after merge mysql-test/r/join.result: Fix after merge mysys/my_once.c: Portability fix mysys/tree.c: Portability fixes sql/field.cc: Portability fixes sql/filesort.cc: move assert.h to mysql_priv.h sql/ha_berkeley.cc: move assert.h to mysql_priv.h sql/ha_innodb.cc: move assert.h to mysql_priv.h sql/item.cc: move assert.h to mysql_priv.h Fixed syntax error sql/item_cmpfunc.cc: move assert.h to mysql_priv.h sql/item_func.cc: move assert.h to mysql_priv.h sql/item_row.cc: move assert.h to mysql_priv.h sql/item_strfunc.cc: Portability fix sql/item_subselect.cc: Portability fix sql/item_sum.cc: move assert.h to mysql_priv.h sql/lex.h: Portability fix sql/lock.cc: move assert.h to mysql_priv.h sql/log.cc: move assert.h to mysql_priv.h sql/log_event.cc: Portability fix sql/mf_iocache.cc: move assert.h to mysql_priv.h sql/mysql_priv.h: move assert.h to mysql_priv.h sql/mysqld.cc: move assert.h to mysql_priv.h sql/opt_range.cc: move assert.h to mysql_priv.h sql/password.c: Portability fix sql/protocol.cc: move assert.h to mysql_priv.h sql/set_var.cc: Portability fix sql/slave.cc: move assert.h to mysql_priv.h sql/spatial.cc: Portability fix sql/sql_acl.cc: move assert.h to mysql_priv.h sql/sql_base.cc: move assert.h to mysql_priv.h sql/sql_cache.cc: move assert.h to mysql_priv.h sql/sql_class.cc: move assert.h to mysql_priv.h sql/sql_handler.cc: move assert.h to mysql_priv.h sql/sql_help.cc: Removed compiler warning sql/sql_lex.cc: Portability fix sql/sql_lex.h: Portability fix sql/sql_parse.cc: move assert.h to mysql_priv.h sql/sql_prepare.cc: move assert.h to mysql_priv.h sql/sql_repl.cc: move assert.h to mysql_priv.h sql/sql_select.cc: move assert.h to mysql_priv.h sql/sql_string.cc: Portability fix sql/sql_string.h: Portability fix sql/sql_table.cc: move assert.h to mysql_priv.h sql/sql_yacc.yy: Portability fix Remove not accessed code strings/ctype-bin.c: Portability fix strings/ctype-mb.c: Portability fix strings/ctype.c: Portability fix tests/client_test.c: A
2003-01-21 20:07:59 +01:00
if (wc < 256)
{
Portability fixes (for windows) Some changes to the prepared statement protocol to make it easier to use and faster. Makefile.am: Fix to make dist to work with cmd-line-utils client/mysql.cc: Portability fixes client/mysqlbinlog.cc: Portabiliy fixes and remove usafe of FILE configure.in: Fix to make dist to work with cmd-line-utils heap/_check.c: Portability fixes include/config-win.h: Portability fixes include/m_ctype.h: Indentation cleanup include/my_list.h: Portability fixes include/mysql.h: Cleanup of BIND structure include/violite.h: Portability fixes innobase/dict/dict0dict.c: Portability fixes innobase/dict/dict0load.c: Portability fixes innobase/include/os0proc.h: Portability fixes (Heikki, please check) innobase/os/os0proc.c: Portability fixes (Heikki, please check) innobase/ut/ut0ut.c: Portability fixes isam/pack_isam.c: Portability fixes libmysql/libmysql.c: Portability fixes Remove obscure usage of the length parameter for prepared statements. libmysql/libmysql.def: Remove not existing functions libmysqld/lib_sql.cc: Remove compiler warning mysql-test/r/explain.result: Fix after merge mysql-test/r/join.result: Fix after merge mysys/my_once.c: Portability fix mysys/tree.c: Portability fixes sql/field.cc: Portability fixes sql/filesort.cc: move assert.h to mysql_priv.h sql/ha_berkeley.cc: move assert.h to mysql_priv.h sql/ha_innodb.cc: move assert.h to mysql_priv.h sql/item.cc: move assert.h to mysql_priv.h Fixed syntax error sql/item_cmpfunc.cc: move assert.h to mysql_priv.h sql/item_func.cc: move assert.h to mysql_priv.h sql/item_row.cc: move assert.h to mysql_priv.h sql/item_strfunc.cc: Portability fix sql/item_subselect.cc: Portability fix sql/item_sum.cc: move assert.h to mysql_priv.h sql/lex.h: Portability fix sql/lock.cc: move assert.h to mysql_priv.h sql/log.cc: move assert.h to mysql_priv.h sql/log_event.cc: Portability fix sql/mf_iocache.cc: move assert.h to mysql_priv.h sql/mysql_priv.h: move assert.h to mysql_priv.h sql/mysqld.cc: move assert.h to mysql_priv.h sql/opt_range.cc: move assert.h to mysql_priv.h sql/password.c: Portability fix sql/protocol.cc: move assert.h to mysql_priv.h sql/set_var.cc: Portability fix sql/slave.cc: move assert.h to mysql_priv.h sql/spatial.cc: Portability fix sql/sql_acl.cc: move assert.h to mysql_priv.h sql/sql_base.cc: move assert.h to mysql_priv.h sql/sql_cache.cc: move assert.h to mysql_priv.h sql/sql_class.cc: move assert.h to mysql_priv.h sql/sql_handler.cc: move assert.h to mysql_priv.h sql/sql_help.cc: Removed compiler warning sql/sql_lex.cc: Portability fix sql/sql_lex.h: Portability fix sql/sql_parse.cc: move assert.h to mysql_priv.h sql/sql_prepare.cc: move assert.h to mysql_priv.h sql/sql_repl.cc: move assert.h to mysql_priv.h sql/sql_select.cc: move assert.h to mysql_priv.h sql/sql_string.cc: Portability fix sql/sql_string.h: Portability fix sql/sql_table.cc: move assert.h to mysql_priv.h sql/sql_yacc.yy: Portability fix Remove not accessed code strings/ctype-bin.c: Portability fix strings/ctype-mb.c: Portability fix strings/ctype.c: Portability fix tests/client_test.c: A
2003-01-21 20:07:59 +01:00
s[0]= (char) wc;
return 1;
}
return MY_CS_ILUNI;
}
void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *key, uint len,ulong *nr1, ulong *nr2)
{
const uchar *pos = key;
key+= len;
for (; pos < (uchar*) key ; pos++)
{
nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) *
((uint)*pos)) + (nr1[0] << 8);
nr2[0]+=3;
}
}
static int my_wildcmp_bin(CHARSET_INFO *cs,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many)
{
int result= -1; /* Not found, using wildcards */
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
{
if (*wildstr == escape && wildstr+1 != wildend)
wildstr++;
if (str == str_end || *wildstr++ != *str++)
{
return(1);
}
if (wildstr == wildend)
{
return(str != str_end); /* Match if both are at end */
}
result=1; /* Found an anchor char */
}
if (*wildstr == w_one)
{
do
{
if (str == str_end) /* Skip one char if possible */
return(result);
str++;
} while (*++wildstr == w_one && wildstr != wildend);
if (wildstr == wildend)
break;
}
if (*wildstr == w_many)
{ /* Found w_many */
char cmp;
wildstr++;
/* Remove any '%' and '_' from the wild search string */
for (; wildstr != wildend ; wildstr++)
{
if (*wildstr == w_many)
continue;
if (*wildstr == w_one)
{
if (str == str_end)
{
return(-1);
}
str++;
continue;
}
break; /* Not a wild character */
}
if (wildstr == wildend)
{
return(0); /* Ok if w_many is last */
}
if (str == str_end)
{
return(-1);
}
if ((cmp= *wildstr) == escape && wildstr+1 != wildend)
cmp= *++wildstr;
wildstr++; /* This is compared trough cmp */
do
{
while (str != str_end && *str != cmp)
str++;
if (str++ == str_end)
{
return(-1);
}
{
int tmp=my_wildcmp_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
if (tmp <= 0)
{
return(tmp);
}
}
} while (str != str_end && wildstr[0] != w_many);
return(-1);
}
}
return(str != str_end ? 1 : 0);
}
static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len,
const uchar *src,
uint srclen __attribute__((unused)))
{
if (dest != src)
memcpy(dest,src,len= min(len,srclen));
return len;
}
static
uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)),
const char *b, uint b_length,
const char *s, uint s_length,
my_match_t *match, uint nmatch)
{
register const uchar *str, *search, *end, *search_end;
if (s_length <= b_length)
{
if (!s_length)
{
if (nmatch)
{
match->beg= 0;
match->end= 0;
match->mblen= 0;
}
return 1; /* Empty string is always found */
}
str= (const uchar*) b;
search= (const uchar*) s;
end= (const uchar*) b+b_length-s_length+1;
search_end= (const uchar*) s + s_length;
skipp:
while (str != end)
{
if ( (*str++) == (*search))
{
register const uchar *i,*j;
i= str;
j= search+1;
while (j != search_end)
if ((*i++) != (*j++))
goto skipp;
if (nmatch > 0)
{
match[0].beg= 0;
match[0].end= str- (const uchar*)b-1;
match[0].mblen= match[0].end;
if (nmatch > 1)
{
match[1].beg= match[0].end;
match[1].end= match[0].end+s_length;
match[1].mblen= match[1].end-match[1].beg;
}
}
return 2;
}
}
}
return 0;
}
MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
{
my_strnncoll_binary,
my_strnncollsp_binary,
my_strnxfrm_bin,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
my_instr_bin,
my_hash_sort_bin
};
static MY_CHARSET_HANDLER my_charset_handler=
{
NULL, /* ismbchar */
my_mbcharlen_8bit, /* mbcharlen */
my_numchars_8bit,
my_charpos_8bit,
my_lengthsp_8bit,
my_mb_wc_bin,
my_wc_mb_bin,
my_caseup_str_bin,
my_casedn_str_bin,
my_caseup_bin,
my_casedn_bin,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
my_fill_8bit,
my_strntol_8bit,
my_strntoul_8bit,
my_strntoll_8bit,
my_strntoull_8bit,
my_strntod_8bit,
my_scan_8bit
};
2003-01-29 14:31:20 +01:00
CHARSET_INFO my_charset_bin =
{
63,0,0, /* number */
MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */
"binary", /* cs name */
"binary", /* name */
"", /* comment */
ctype_bin, /* ctype */
Fixed a lot of wrong memory references as reported by valgrind Portability fixes Added new client function: mysql_get_server_version() New server help code (From Victor Vagin) Fixed wrong usage of binary() Disabled RTREE usage for now. BitKeeper/etc/ignore: added scripts/fill_help_tables.sql client/mysql.cc: Some fixes when using 'help' cmd-line-utils/libedit/compat.h: Portability fix cmd-line-utils/libedit/fgetln.c: Portability fix include/mysql.h: Added new client function: mysql_get_server_version() libmysql/libmysql.c: Added new client function: mysql_get_server_version() libmysqld/libmysqld.c: Fixed prototype mysql-test/install_test_db.sh: Added creation of help tables mysql-test/r/connect.result: Added help tables mysql-test/r/myisam.result: Test of RTREE index mysql-test/r/type_ranges.result: updated results mysql-test/t/myisam.test: Test of RTREE index mysql-test/t/type_ranges.test: Updated test mysys/charset.c: Indentation change mysys/my_symlink.c: Removed compiler warning scripts/fill_help_tables.sh: Update for new help tables sql/field.cc: Indentation changes sql/filesort.cc: Optimized character set usage sql/item_cmpfunc.cc: Fix wrong usage of binary() sql/item_cmpfunc.h: Fix wrong usage of binary() sql/item_func.cc: Fix wrong usage of binary() sql/item_func.h: Fix wrong usage of binary() sql/item_strfunc.cc: Fix wrong usage of binary() sql/item_sum.cc: Fix wrong usage of binary() sql/item_sum.h: Fix wrong usage of binary() sql/key.cc: Indentation change sql/lex.h: HELP -> HELP_SYM sql/mysql_priv.h: Make get_field() more general sql/password.c: Indentation change + variable initialisation moved sql/sql_acl.cc: Make get_field() more general sql/sql_base.cc: Added comments + assertion for double call to mysql_lock_tables sql/sql_cache.cc: Indentation changes sql/sql_class.h: Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort sql/sql_derived.cc: Renamed variables sql/sql_help.cc: New help functions (from Victor Vagin) sql/sql_lex.cc: Removed variables that doesn't have to be initialized for each query sql/sql_lex.h: Removed not used variable (olap) sql/sql_parse.cc: Fixed (not fatal) access of unitialized memory Indentation / code cleanup sql/sql_prepare.cc: Indentaion cleanup sql/sql_table.cc: Disabled RTREE until 5.0 sql/sql_udf.cc: Make get_field() more general sql/sql_yacc.yy: Removed access to uninitialized memory Always set offset_limit and select_limit when using LIMIT (removed warnings) Allow usage of 'help week' sql/table.cc: Make get_field() more general More comments sql/table.h: Fixded type of TABLE_LIST->derived sql/time.cc: Stricter date / datetime handling (to be able to handle timestamps with days and microseconds) strings/ctype-bin.c: Added cha
2003-02-12 20:55:37 +01:00
bin_char_array, /* to_lower */
bin_char_array, /* to_upper */
bin_char_array, /* sort_order */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
"","",
1, /* strxfrm_multiply */
1, /* mbmaxlen */
Portability fixes (for windows) Some changes to the prepared statement protocol to make it easier to use and faster. Makefile.am: Fix to make dist to work with cmd-line-utils client/mysql.cc: Portability fixes client/mysqlbinlog.cc: Portabiliy fixes and remove usafe of FILE configure.in: Fix to make dist to work with cmd-line-utils heap/_check.c: Portability fixes include/config-win.h: Portability fixes include/m_ctype.h: Indentation cleanup include/my_list.h: Portability fixes include/mysql.h: Cleanup of BIND structure include/violite.h: Portability fixes innobase/dict/dict0dict.c: Portability fixes innobase/dict/dict0load.c: Portability fixes innobase/include/os0proc.h: Portability fixes (Heikki, please check) innobase/os/os0proc.c: Portability fixes (Heikki, please check) innobase/ut/ut0ut.c: Portability fixes isam/pack_isam.c: Portability fixes libmysql/libmysql.c: Portability fixes Remove obscure usage of the length parameter for prepared statements. libmysql/libmysql.def: Remove not existing functions libmysqld/lib_sql.cc: Remove compiler warning mysql-test/r/explain.result: Fix after merge mysql-test/r/join.result: Fix after merge mysys/my_once.c: Portability fix mysys/tree.c: Portability fixes sql/field.cc: Portability fixes sql/filesort.cc: move assert.h to mysql_priv.h sql/ha_berkeley.cc: move assert.h to mysql_priv.h sql/ha_innodb.cc: move assert.h to mysql_priv.h sql/item.cc: move assert.h to mysql_priv.h Fixed syntax error sql/item_cmpfunc.cc: move assert.h to mysql_priv.h sql/item_func.cc: move assert.h to mysql_priv.h sql/item_row.cc: move assert.h to mysql_priv.h sql/item_strfunc.cc: Portability fix sql/item_subselect.cc: Portability fix sql/item_sum.cc: move assert.h to mysql_priv.h sql/lex.h: Portability fix sql/lock.cc: move assert.h to mysql_priv.h sql/log.cc: move assert.h to mysql_priv.h sql/log_event.cc: Portability fix sql/mf_iocache.cc: move assert.h to mysql_priv.h sql/mysql_priv.h: move assert.h to mysql_priv.h sql/mysqld.cc: move assert.h to mysql_priv.h sql/opt_range.cc: move assert.h to mysql_priv.h sql/password.c: Portability fix sql/protocol.cc: move assert.h to mysql_priv.h sql/set_var.cc: Portability fix sql/slave.cc: move assert.h to mysql_priv.h sql/spatial.cc: Portability fix sql/sql_acl.cc: move assert.h to mysql_priv.h sql/sql_base.cc: move assert.h to mysql_priv.h sql/sql_cache.cc: move assert.h to mysql_priv.h sql/sql_class.cc: move assert.h to mysql_priv.h sql/sql_handler.cc: move assert.h to mysql_priv.h sql/sql_help.cc: Removed compiler warning sql/sql_lex.cc: Portability fix sql/sql_lex.h: Portability fix sql/sql_parse.cc: move assert.h to mysql_priv.h sql/sql_prepare.cc: move assert.h to mysql_priv.h sql/sql_repl.cc: move assert.h to mysql_priv.h sql/sql_select.cc: move assert.h to mysql_priv.h sql/sql_string.cc: Portability fix sql/sql_string.h: Portability fix sql/sql_table.cc: move assert.h to mysql_priv.h sql/sql_yacc.yy: Portability fix Remove not accessed code strings/ctype-bin.c: Portability fix strings/ctype-mb.c: Portability fix strings/ctype.c: Portability fix tests/client_test.c: A
2003-01-21 20:07:59 +01:00
(char) 255, /* max_sort_char */
&my_charset_handler,
&my_collation_8bit_bin_handler
};