Commit 2123dc6b authored by unknown's avatar unknown

Merge mysql.com:/home/jonas/src/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0-ndb

parents cd3b9f57 40649e92
......@@ -73,7 +73,7 @@ LINK32=xilink6.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MT /W3 /Z7 /Od /I "../include" /I "../libmysqld" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# ADD CPP /nologo /MT /W3 /Z7 /Od /I "../include" /I "../libmysqld" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "SAFEMALLOC" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# SUBTRACT CPP /X /Fr
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
......
......@@ -330,6 +330,16 @@ static sig_handler mysql_end(int sig);
int main(int argc,char *argv[])
{
char buff[80];
char *defaults, *extra_defaults;
char *emb_argv[3];
int emb_argc= 1;
emb_argv[0]= argv[0];
get_defaults_files(argc, argv, &defaults, &extra_defaults);
if (defaults)
emb_argv[emb_argc++]= defaults;
if (extra_defaults)
emb_argv[emb_argc++]= extra_defaults;
MY_INIT(argv[0]);
DBUG_ENTER("main");
......@@ -375,7 +385,7 @@ int main(int argc,char *argv[])
my_end(0);
exit(1);
}
if (mysql_server_init(0, NULL, (char**) server_default_groups))
if (mysql_server_init(emb_argc, emb_argv, (char**) server_default_groups))
{
free_defaults(defaults_argv);
my_end(0);
......
......@@ -7,14 +7,14 @@ AC_DIVERT_PUSH(0)
define(CHARSETS_AVAILABLE0,binary)
define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 dec8 euckr gb2312 gbk geostd8)
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjp_ms euckr gb2312 gbk geostd8)
define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8)
DEFAULT_CHARSET=latin1
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE1 CHARSETS_AVAILABLE2 CHARSETS_AVAILABLE3 CHARSETS_AVAILABLE4 CHARSETS_AVAILABLE5"
CHARSETS_COMPLEX="big5 cp1250 euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjp_ms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
AC_DIVERT_POP
......@@ -103,9 +103,19 @@ do
cp866)
AC_DEFINE(HAVE_CHARSET_cp866, 1, [Define to enable charset cp866])
;;
cp932)
AC_DEFINE(HAVE_CHARSET_cp932, 1, [Define to enable charset cp932])
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
AC_DEFINE(USE_MB_IDENT, 1)
;;
dec8)
AC_DEFINE(HAVE_CHARSET_dec8, 1, [Define to enable charset dec8])
;;
eucjp_ms)
AC_DEFINE(HAVE_CHARSET_eucjp_ms, 1, [Define to enable charset eucjp_ms])
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
AC_DEFINE(USE_MB_IDENT, 1)
;;
euckr)
AC_DEFINE(HAVE_CHARSET_euckr, 1, [Define to enable charset euckr])
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
......@@ -241,10 +251,18 @@ case $default_charset in
default_charset_default_collation="cp866_general_ci"
default_charset_collations="cp866_general_ci cp866_bin"
;;
cp932)
default_charset_default_collation="cp932_japanese_ci"
default_charset_collations="cp932_japanese_ci cp932_bin"
;;
dec8)
default_charset_default_collation="dec8_swedish_ci"
default_charset_collations="dec8_swedish_ci dec8_bin"
;;
eucjp_ms)
default_charset_default_collation="eucjp_ms_japanese_ci"
default_charset_collations="eucjp_ms_japanese_ci ujis_bin"
;;
euckr)
default_charset_default_collation="euckr_korean_ci"
default_charset_collations="euckr_korean_ci euckr_bin"
......
......@@ -230,6 +230,10 @@ typedef struct charset_info_st
extern CHARSET_INFO my_charset_bin;
extern CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
extern CHARSET_INFO my_charset_cp932_bin;
extern CHARSET_INFO my_charset_eucjp_ms_japanese_ci;
extern CHARSET_INFO my_charset_eucjp_ms_bin;
extern CHARSET_INFO my_charset_euckr_korean_ci;
extern CHARSET_INFO my_charset_euckr_bin;
extern CHARSET_INFO my_charset_gb2312_chinese_ci;
......
......@@ -769,6 +769,8 @@ extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
extern void get_defaults_files(int argc, char **argv,
char **defaults, char **extra_defaults);
extern int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
extern int process_default_option_files(const char *conf_file,
......
......@@ -42,7 +42,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \
ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjp_ms.lo ctype-euc_kr.lo \
ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
......
......@@ -22,7 +22,7 @@
target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @openssl_libs@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ \
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ \
......
......@@ -219,12 +219,13 @@ static my_bool emb_mysql_read_query_result(MYSQL *mysql)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
char header[4];
int4store(header, stmt->stmt_id);
THD *thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
(const char*)&stmt->stmt_id,sizeof(stmt->stmt_id),
1) ||
header, sizeof(header), 1) ||
emb_mysql_read_query_result(stmt->mysql))
{
NET *net= &stmt->mysql->net;
......
......@@ -143,6 +143,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
db ? db : "(Null)",
user ? user : "(Null)"));
if (!host || !host[0])
host= mysql->options.host;
if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION ||
(mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
host && *host && strcmp(host,LOCAL_HOST)))
......
......@@ -9,13 +9,13 @@ DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
[ndbd]
HostName= CHOOSE_HOSTNAME_1
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
[ndbd]
HostName= CHOOSE_HOSTNAME_2
HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
[ndb_mgmd]
DataDir= CHOOSE_FILESYSTEM
DataDir= CHOOSE_FILESYSTEM #
PortNumber= CHOOSE_PORT_MGM
[mysqld]
......
......@@ -191,7 +191,7 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
if sleep_until_file_created $fs_ndb/ndb_3.pid 30
if sleep_until_file_created $fs_ndb/ndb_3.pid 120
then :; else
exit 1
fi
......@@ -201,7 +201,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_1.pid 30
if sleep_until_file_created $fs_ndb/ndb_1.pid 120
then :; else
stop_default_ndbcluster
exit 1
......@@ -212,7 +212,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_2.pid 30
if sleep_until_file_created $fs_ndb/ndb_2.pid 120
then :; else
stop_default_ndbcluster
exit 1
......
......@@ -96,3 +96,9 @@ select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
drop table t1,t2;
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
drop table t1;
This diff is collapsed.
This diff is collapsed.
......@@ -817,3 +817,15 @@ drop table t1;
select 'c' like '\_' as want0;
want0
0
create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
insert into t1 values (1, 'Test');
select * from t1 where soundex(a) = soundex('Test');
id a
1 Test
select * from t1 where soundex(a) = soundex('TEST');
id a
1 Test
select * from t1 where soundex(a) = soundex('test');
id a
1 Test
drop table t1;
......@@ -818,6 +818,8 @@ ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES ('hello ');
Warnings:
Note 1265 Data truncated for column 'col2' at row 1
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
ERROR 01000: Data truncated for column 'col1' at row 2
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
......
......@@ -38,3 +38,7 @@ select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
drop table t1;
This diff is collapsed.
This diff is collapsed.
......@@ -666,3 +666,12 @@ drop table t1;
#
select 'c' like '\_' as want0;
#
# Bug #7730 Server crash using soundex on an utf8 table
#
create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
insert into t1 values (1, 'Test');
select * from t1 where soundex(a) = soundex('Test');
select * from t1 where soundex(a) = soundex('TEST');
select * from t1 where soundex(a) = soundex('test');
drop table t1;
......@@ -569,7 +569,6 @@ INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
INSERT INTO t1 (col1) VALUES ('hellobob');
--error 1265
INSERT INTO t1 (col2) VALUES ('hellobob');
--error 1265
INSERT INTO t1 (col2) VALUES ('hello ');
--error 1265
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
......
......@@ -81,10 +81,20 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_cp1250_czech_ci);
#endif
#ifdef HAVE_CHARSET_cp932
add_compiled_collation(&my_charset_cp932_japanese_ci);
add_compiled_collation(&my_charset_cp932_bin);
#endif
#ifdef HAVE_CHARSET_latin2
add_compiled_collation(&my_charset_latin2_czech_ci);
#endif
#ifdef HAVE_CHARSET_eucjp_ms
add_compiled_collation(&my_charset_eucjp_ms_japanese_ci);
add_compiled_collation(&my_charset_eucjp_ms_bin);
#endif
#ifdef HAVE_CHARSET_euckr
add_compiled_collation(&my_charset_euckr_korean_ci);
add_compiled_collation(&my_charset_euckr_bin);
......
......@@ -112,20 +112,14 @@ static int search_files(const char *conf_file, int *argc, char ***argv,
DBUG_ENTER("search_files");
/* Check if we want to force the use a specific default file */
forced_default_file= 0;
if (*argc >= 2)
{
if (is_prefix(argv[0][1],"--defaults-file="))
{
forced_default_file= strchr(argv[0][1],'=') + 1;
(*args_used)++;
}
else if (is_prefix(argv[0][1],"--defaults-extra-file="))
{
defaults_extra_file= strchr(argv[0][1],'=') + 1;
(*args_used)++;
}
}
get_defaults_files(*argc, *argv,
(char **)&forced_default_file, &defaults_extra_file);
if (forced_default_file)
forced_default_file= strchr(forced_default_file,'=')+1;
if (defaults_extra_file)
defaults_extra_file= strchr(defaults_extra_file,'=')+1;
args_used+= (forced_default_file ? 1 : 0) + (defaults_extra_file ? 1 : 0);
if (forced_default_file)
{
......@@ -261,6 +255,36 @@ static int handle_default_option(void *in_ctx, const char *group_name,
}
/*
Gets --defaults-file and --defaults-extra-file options from command line.
SYNOPSIS
get_defaults_files()
argc Pointer to argc of original program
argv Pointer to argv of original program
defaults --defaults-file option
extra_defaults --defaults-extra-file option
RETURN
defaults and extra_defaults will be set to appropriate items
of argv array, or to NULL if there are no such options
*/
void get_defaults_files(int argc, char **argv,
char **defaults, char **extra_defaults)
{
*defaults=0;
*extra_defaults=0;
if (argc >= 2)
{
if (is_prefix(argv[1],"--defaults-file="))
*defaults= argv[1];
else if (is_prefix(argv[1],"--defaults-extra-file="))
*extra_defaults= argv[1];
}
}
/*
Read options from configurations files
......
......@@ -992,7 +992,11 @@ Backup::execUTIL_SEQUENCE_CONF(Signal* signal)
}//if
ndbrequire(ptr.p->masterData.state.getState() == DEFINING);
ptr.p->backupId = conf->sequenceValue[0];
{
Uint64 backupId;
memcpy(&backupId,conf->sequenceValue,8);
ptr.p->backupId= (Uint32)backupId;
}
ptr.p->backupKey[0] = (getOwnNodeId() << 16) | (ptr.p->backupId & 0xFFFF);
ptr.p->backupKey[1] = NdbTick_CurrentMillisecond();
......
......@@ -27,6 +27,14 @@
#include <NdbThread.h>
#include <signaldata/FsOpenReq.hpp>
// use this to test broken pread code
//#define HAVE_BROKEN_PREAD
#ifdef HAVE_BROKEN_PREAD
#undef HAVE_PWRITE
#undef HAVE_PREAD
#endif
#if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE
#else
// For readv and writev
......@@ -379,9 +387,12 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){
if(dwSFP != offset) {
return GetLastError();
}
#elif defined NDB_OSE || defined NDB_SOFTOSE
return_value = lseek(theFd, offset, SEEK_SET);
if (return_value != offset) {
#elif ! defined(HAVE_PREAD)
off_t seek_val;
while((seek_val= lseek(theFd, offset, SEEK_SET)) == (off_t)-1
&& errno == EINTR);
if(seek_val == (off_t)-1)
{
return errno;
}
#endif
......@@ -400,10 +411,10 @@ AsyncFile::readBuffer(char * buf, size_t size, off_t offset){
return GetLastError();
}
bytes_read = dwBytesRead;
#elif defined NDB_OSE || defined NDB_SOFTOSE
#elif ! defined(HAVE_PREAD)
return_value = ::read(theFd, buf, size);
#else // UNIX
return_value = my_pread(theFd, buf, size, offset,0);
return_value = ::pread(theFd, buf, size, offset);
#endif
#ifndef NDB_WIN32
if (return_value == -1 && errno == EINTR) {
......@@ -453,7 +464,7 @@ AsyncFile::readReq( Request * request)
void
AsyncFile::readvReq( Request * request)
{
#if defined NDB_OSE || defined NDB_SOFTOSE
#if ! defined(HAVE_PREAD)
readReq(request);
return;
#elif defined NDB_WIN32
......@@ -483,7 +494,7 @@ AsyncFile::readvReq( Request * request)
int
AsyncFile::extendfile(Request* request) {
#if defined NDB_OSE || defined NDB_SOFTOSE
#if ! defined(HAVE_PWRITE)
// Find max size of this file in this request
int maxOffset = 0;
int maxSize = 0;
......@@ -592,28 +603,14 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
if(dwSFP != offset) {
return GetLastError();
}
#elif defined NDB_OSE || defined NDB_SOFTOSE
return_value = lseek(theFd, offset, SEEK_SET);
if (return_value != offset) {
DEBUG(ndbout_c("AsyncFile::writeReq, err1: return_value=%d, offset=%d\n",
return_value, chunk_offset));
PRINT_ERRORANDFLAGS(0);
if (errno == 78) {
// Could not write beyond end of file, try to extend file
DEBUG(ndbout_c("AsyncFile::writeReq, Extend. file! filename=\"%s\" \n",
theFileName.c_str()));
return_value = extendfile(request);
if (return_value == -1) {
return errno;
}
return_value = lseek(theFd, offset, SEEK_SET);
if (return_value != offset) {
#elif ! defined(HAVE_PWRITE)
off_t seek_val;
while((seek_val= lseek(theFd, offset, SEEK_SET)) == (off_t)-1
&& errno == EINTR);
if(seek_val == (off_t)-1)
{
return errno;
}
} else {
return errno;
}
}
#endif
while (size > 0) {
......@@ -634,10 +631,10 @@ AsyncFile::writeBuffer(const char * buf, size_t size, off_t offset,
DEBUG(ndbout_c("Warning partial write %d != %d", bytes_written, bytes_to_write));
}
#elif defined NDB_OSE || defined NDB_SOFTOSE
#elif ! defined(HAVE_PWRITE)
return_value = ::write(theFd, buf, bytes_to_write);
#else // UNIX
return_value = my_pwrite(theFd, buf, bytes_to_write, offset, 0);
return_value = ::pwrite(theFd, buf, bytes_to_write, offset);
#endif
#ifndef NDB_WIN32
if (return_value == -1 && errno == EINTR) {
......
......@@ -824,7 +824,8 @@ Suma::execUTIL_SEQUENCE_CONF(Signal* signal)
return;
}
Uint32 subId = conf->sequenceValue[0];
Uint64 subId;
memcpy(&subId,conf->sequenceValue,8);
Uint32 subData = conf->senderData;
SubscriberPtr subbPtr;
......@@ -832,8 +833,8 @@ Suma::execUTIL_SEQUENCE_CONF(Signal* signal)
CreateSubscriptionIdConf * subconf = (CreateSubscriptionIdConf*)conf;
subconf->subscriptionId = subId;
subconf->subscriptionKey =(getOwnNodeId() << 16) | (subId & 0xFFFF);
subconf->subscriptionId = (Uint32)subId;
subconf->subscriptionKey =(getOwnNodeId() << 16) | (Uint32)(subId & 0xFFFF);
subconf->subscriberData = subbPtr.p->m_senderData;
sendSignal(subbPtr.p->m_subscriberRef, GSN_CREATE_SUBID_CONF, signal,
......
......@@ -228,13 +228,21 @@ bool InitConfigFileParser::parseNameValuePair(Context& ctx, const char* line)
Vector<BaseString> tmp_string_split;
if (BaseString(line).split(tmp_string_split,
BaseString("=:"),
2) != 2)
"=:", 2) != 2)
{
ctx.reportError("Parse error");
return false;
}
// *************************************
// Remove all after #
// *************************************
Vector<BaseString> tmp_string_split2;
tmp_string_split[1].split(tmp_string_split2,
"#", 2);
tmp_string_split[1]=tmp_string_split2[0];
// *************************************
// Remove leading and trailing chars
// *************************************
......
......@@ -30,7 +30,7 @@
0, 0, \
0, \
(desc), \
(void *)(value) }
(value) }
#define CPC_ARG(name, type, opt, desc) \
{ (name), \
......@@ -351,17 +351,12 @@ SimpleCpcClient::define_process(Process & p, Properties& reply){
int
SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
enum Proclist {
Proclist_Start,
Proclist_End,
Proclist_Entry
};
int start, end, entry;
const ParserRow_t list_reply[] = {
CPC_CMD("start processes", Proclist_Start, ""),
CPC_CMD("end processes", Proclist_End, ""),
CPC_CMD("start processes", &start, ""),
CPC_CMD("end processes", &end, ""),
CPC_CMD("process", Proclist_Entry, ""),
CPC_CMD("process", &entry, ""),
CPC_ARG("id", Int, Mandatory, "Id of process."),
CPC_ARG("name", String, Mandatory, "Name of process"),
CPC_ARG("group", String, Mandatory, "Group of process"),
......@@ -390,26 +385,29 @@ SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
bool done = false;
while(!done) {
const Properties *proc;
enum Proclist p;
cpc_recv(list_reply, &proc, (void **)&p);
void *p;
cpc_recv(list_reply, &proc, &p);
switch(p) {
case Proclist_Start:
if(p == &start)
{
/* do nothing */
break;
case Proclist_End:
}
else if(p == &end)
{
done = true;
break;
case Proclist_Entry:
}
else if(p == &entry)
{
if(proc != NULL){
Process p;
convert(* proc, p);
procs.push_back(p);
}
break;
default:
/* ignore */
break;
}
else
{
ndbout_c("internal error: %d", __LINE__);
return -1;
}
}
return 0;
......
......@@ -121,6 +121,7 @@ SUFFIXES = .sh
-e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
-e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
-e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
-e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \
-e 's!@''LIBS''@!@LIBS@!' \
-e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
......
......@@ -1578,9 +1578,14 @@ void Item_func_soundex::fix_length_and_dec()
else return 0
*/
static char get_scode(CHARSET_INFO *cs,char *ptr)
static char soundex_toupper(char ch)
{
uchar ch=my_toupper(cs,*ptr);
return (ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch;
}
static char get_scode(char *ptr)
{
uchar ch= soundex_toupper(*ptr);
if (ch < 'A' || ch > 'Z')
{
// Thread extended alfa (country spec)
......@@ -1610,8 +1615,8 @@ String *Item_func_soundex::val_str(String *str)
from++; /* purecov: inspected */
if (from == end)
return &my_empty_string; // No alpha characters.
*to++ = my_toupper(cs,*from); // Copy first letter
last_ch = get_scode(cs,from); // code of the first letter
*to++ = soundex_toupper(*from); // Copy first letter
last_ch = get_scode(from); // code of the first letter
// for the first 'double-letter check.
// Loop on input letters until
// end of input (null) or output
......@@ -1620,7 +1625,7 @@ String *Item_func_soundex::val_str(String *str)
{
if (!my_isalpha(cs,*from))
continue;
ch=get_scode(cs,from);
ch=get_scode(from);
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
{
*to++ = ch; // letter, copy to output
......
......@@ -7664,7 +7664,8 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
group_prefix_len(group_prefix_len_arg), have_min(have_min_arg),
have_max(have_max_arg), seen_first_key(FALSE),
min_max_arg_part(min_max_arg_part_arg), key_infix(key_infix_arg),
key_infix_len(key_infix_len_arg)
key_infix_len(key_infix_len_arg), min_functions_it(NULL),
max_functions_it(NULL)
{
head= table;
file= head->file;
......@@ -7773,16 +7774,12 @@ int QUICK_GROUP_MIN_MAX_SELECT::init()
if (!(min_functions_it= new List_iterator<Item_sum>(*min_functions)))
return 1;
}
else
min_functions_it= NULL;
if (have_max)
{
if (!(max_functions_it= new List_iterator<Item_sum>(*max_functions)))
return 1;
}
else
max_functions_it= NULL;
}
else
min_max_ranges.elements= 0;
......@@ -7799,6 +7796,8 @@ QUICK_GROUP_MIN_MAX_SELECT::~QUICK_GROUP_MIN_MAX_SELECT()
if (min_max_arg_part)
delete_dynamic(&min_max_ranges);
free_root(&alloc,MYF(0));
delete min_functions_it;
delete max_functions_it;
delete quick_prefix_select;
DBUG_VOID_RETURN;
}
......
<?xml version='1.0' encoding="utf-8"?>
<charsets max-id="94">
<charsets max-id="98">
<copyright>
Copyright (C) 2003 MySQL AB
......@@ -553,5 +553,38 @@ To make maintaining easier please:
</collation>
</charset>
<charset name="cp932">
<family>Japanese</family>
<description>SJIS for Windows Japanese</description>
<alias>ms_cp932</alias>
<alias>sjis_cp932</alias>
<alias>sjis_ms</alias>
<collation name="cp932_japanese_ci" id="95" order="Japanese">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
<collation name="cp932_bin" id="96" order="Binary">
<flag>binary</flag>
<flag>compiled</flag>
</collation>
</charset>
<charset name="eucjp_ms">
<family>Japanese</family>
<description>UJIS for Windows Japanese</description>
<alias>eucjpms</alias>
<alias>eucJP_ms</alias>
<alias>ujis_ms</alias>
<alias>ujis_cp932</alias>
<collation name="eucjp_ms_japanese_ci" id="97" order="Japanese">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
<collation name="eucjp_ms_bin" id="98" order="Japanese">
<flag>binary</flag>
<flag>compiled</flag>
</collation>
</charset>
</charsets>
......@@ -59,6 +59,7 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
return compare_ulonglong(s,t);
}
static bool append_escaped(String *to_str, String *from_str);
Procedure *
proc_analyse_init(THD *thd, ORDER *param, select_result *result,
......@@ -890,7 +891,8 @@ int collect_string(String *element,
else
info->found = 1;
info->str->append('\'');
info->str->append(*element);
if (append_escaped(info->str, element))
return 1;
info->str->append('\'');
return 0;
} // collect_string
......@@ -1025,3 +1027,58 @@ uint check_ulonglong(const char *str, uint length)
while (*cmp && *cmp++ == *str++) ;
return ((uchar) str[-1] <= (uchar) cmp[-1]) ? smaller : bigger;
} /* check_ulonlong */
/*
FUNCTION: append_escaped()
DESCRIPTION
append_escaped() takes a String type variable, where it appends
escaped the second argument. Only characters that require escaping
will be escaped.
ARGUMENTS
A pointer to a String variable, where results will be appended
A pointer to a String variable, which is appended to the result
String, escaping those characters that require it.
RETURN VALUES
0 Success
1 Out of memory
*/
static bool append_escaped(String *to_str, String *from_str)
{
char *from, *end, c;
if (to_str->realloc(to_str->length() + from_str->length()))
return 1;
from= (char*) from_str->ptr();
end= from + from_str->length();
for (; from < end; from++)
{
c= *from;
switch (c) {
case '\0':
c= '0';
break;
case '\032':
c= 'Z';
break;
case '\\':
case '\'':
break;
default:
goto normal_character;
}
if (to_str->append('\\'))
return 1;
normal_character:
if (to_str->append(c))
return 1;
}
return 0;
}
......@@ -147,7 +147,7 @@ uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match)
uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
{
int find,pos,findpos;
int find,pos;
const char *j;
DBUG_ENTER("find_type2");
DBUG_PRINT("enter",("x: '%.*s' lib: 0x%lx", length, x, typelib));
......@@ -157,7 +157,7 @@ uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
DBUG_PRINT("exit",("no count"));
DBUG_RETURN(0);
}
LINT_INIT(findpos);
for (find=0, pos=0 ; (j=typelib->type_names[pos]) ; pos++)
{
if (!my_strnncoll(cs, (const uchar*) x, length,
......
......@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c strtod.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-uca.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c decimal.c ctype-extra.c my_strtoll10.c
endif
endif
......@@ -42,7 +42,7 @@ libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src
DISTCLEANFILES = ctype_autoconf.c
# Default charset definitions
EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \
EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjp_ms.c ctype-euc_kr.c ctype-win1250ch.c \
ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \
xml.c decimal.c strto.c strings-x86.s \
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment