diff --git a/.bzrignore b/.bzrignore index ab096c20d6e..d116fd29c41 100644 --- a/.bzrignore +++ b/.bzrignore @@ -774,3 +774,8 @@ ndb/lib/libndbclient.so ndb/lib/libndbclient_extra.so libmysqld/discover.cc include/readline +ndb/config/autom4te.cache/* +ndb/config/config.mk +ndb/src/common/mgmcommon/printConfig/*.d +ndb/src/mgmclient/test_cpcd/*.d +*.d diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index a8379b3d338..c89c60287fd 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -112,6 +112,7 @@ mwagner@work.mysql.com mydev@mysql.com mysql@home.(none) mysqldev@build.mysql2.com +ndbdev@ndbmaster.mysql.com nick@mysql.com nick@nick.leippe.com papa@gbichot.local @@ -163,6 +164,8 @@ tonu@hundin.mysql.fi tonu@volk.internalnet tonu@x153.internalnet tonu@x3.internalnet +tsmith@build.mysql.com +tulin@build.mysql.com ulli@morbus.(none) venu@hundin.mysql.fi venu@myvenu.com diff --git a/Build-tools/Do-pkg b/Build-tools/Do-pkg index 2fd1946ed0e..286e33f6dd4 100755 --- a/Build-tools/Do-pkg +++ b/Build-tools/Do-pkg @@ -95,6 +95,7 @@ $SI_DESC= <$SUPFILEDIR/StartupItem.Description.plist>; $SI_PARAMS= <$SUPFILEDIR/StartupParameters.plist>; $SI_POST= <$SUPFILEDIR/StartupItem.postinstall>; $SI_NAME= "MySQLStartupItem"; +$SI_DIR_NAME= "MySQLCOM"; $SI_SCRIPT= <$SUPFILEDIR/MySQL>; @RESOURCES= qw/ ReadMe.txt postinstall preinstall /; @LICENSES= ("$SRCBASEDIR/COPYING","$SRCBASEDIR/MySQLEULA.txt"); @@ -195,16 +196,18 @@ unless ($opt_skip_si) &logger("Cleaning up $RESOURCE_DIR"); &run_command("rm -rf $RESOURCE_DIR/*", "Unable to clean up $RESOURCE_DIR!"); - &logger("Installing MySQL StartupItem files into $PKGROOT/MySQL"); + my $SI_DIR= $PKGROOT . "/" . $SI_DIR_NAME; + &logger("Installing MySQL StartupItem files into $SI_DIR"); unless($opt_dry_run) { - mkdir("$PKGROOT/MySQL") or &abort("Error creating $PKGROOT/MySQL"); - copy("$SI_SCRIPT", "$PKGROOT/MySQL/") + mkdir("$SI_DIR") + or &abort("Error creating $SI_DIR"); + copy("$SI_SCRIPT", "$SI_DIR/") or &abort("Error copying $SI_SCRIPT!"); - chmod(0755, "$PKGROOT/MySQL/" . basename("$SI_SCRIPT")); - copy("$SI_PARAMS", "$PKGROOT/MySQL/") + chmod(0755, "$SI_DIR/" . basename("$SI_SCRIPT")); + copy("$SI_PARAMS", "$SI_DIR/") or &abort("Error copying $SI_PARAMS!"); - chmod(0644, "$PKGROOT/MySQL/" . basename("$SI_PARAMS")); + chmod(0644, "$SI_DIR/" . basename("$SI_PARAMS")); &run_command("chown -R root:wheel $PKGROOT/*", "Cannot chown $PKGROOT!"); copy("$SI_POST", "$RESOURCE_DIR/postinstall") or &abort("Error copying $SI_POST!"); diff --git a/client/my_readline.h b/client/my_readline.h index 2e716eec4cf..6052d462ab9 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -29,6 +29,6 @@ typedef struct st_line_buffer } LINE_BUFFER; extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file); -extern LINE_BUFFER *batch_readline_command(my_string str); +extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str); extern char *batch_readline(LINE_BUFFER *buffer); extern void batch_readline_end(LINE_BUFFER *buffer); diff --git a/client/mysql.cc b/client/mysql.cc index fe6af909a5a..ddc6441f08a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -494,7 +494,7 @@ static struct my_option my_long_options[] = "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"batch", 'B', - "Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + "Don't use history file. Disable interactive behavior. (Enables --silent)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory where character sets are.", (gptr*) &charsets_dir, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -515,7 +515,7 @@ static struct my_option my_long_options[] = (gptr*) ¤t_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", OPT_DELIMITER, "Delimiter to be used.", (gptr*) &delimiter_str, (gptr*) &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"execute", 'e', "Execute command and quit. (Output like with --batch).", 0, + {"execute", 'e', "Execute command and quit. (Disables --force and history file)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"vertical", 'E', "Print the output of a query (rows) vertically.", (gptr*) &vertical, (gptr*) &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, @@ -597,7 +597,7 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.", (gptr*) &opt_reconnect, (gptr*) &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"silent", 's', "Be more silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, + {"silent", 's', "Be more silent. Print results with a tab as separator, each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME, @@ -755,10 +755,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'e': status.batch= 1; status.add_to_history= 0; - batch_readline_end(status.line_buff); // If multiple -e - if (!(status.line_buff= batch_readline_command(argument))) + if (!status.line_buff) + ignore_errors= 0; // do it for the first -e only + if (!(status.line_buff= batch_readline_command(status.line_buff, argument))) return 1; - ignore_errors= 0; break; case 'o': if (argument == disabled_my_option) @@ -798,12 +798,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), verbose++; break; case 'B': - if (!status.batch) - { - status.batch= 1; - status.add_to_history= 0; - opt_silent++; // more silent - } + status.batch= 1; + status.add_to_history= 0; + set_if_bigger(opt_silent,1); // more silent break; case 'W': #ifdef __WIN__ @@ -1108,11 +1105,8 @@ static bool add_line(String &buffer,char *line,char *in_string, } else { - int error= com_go(&buffer, 0); - if (error) - { - return error < 0 ? 0 : 1; // < 0 is not fatal - } + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + return 1; } buffer.length(0); out= line; diff --git a/client/mysqldump.c b/client/mysqldump.c index 1a0ef713ec7..20792f8c025 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -241,10 +241,10 @@ static struct my_option my_long_options[] = {"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-set-names", 'N', - "'SET NAMES charset_name' will not be put in the output. Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead", + "Deprecated, use --set-charset or --skip-set-charset to enable/disable charset settings instead", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"set-charset", OPT_SET_CHARSET, - "'SET NAMES charset_name' will be put in the output", + "'SET CHARACTER_SET_CLIENT=default_character_set' will be put in the output", (gptr*) &opt_set_charset, (gptr*) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"set-variable", 'O', diff --git a/client/readline.cc b/client/readline.cc index f5fbfd8cd0c..52ecb4e5c68 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -31,7 +31,8 @@ static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length); LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) { LINE_BUFFER *line_buff; - if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME)))) + if (!(line_buff=(LINE_BUFFER*) + my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL)))) return 0; if (init_line_buffer(line_buff,fileno(file),IO_SIZE,max_size)) { @@ -67,11 +68,12 @@ void batch_readline_end(LINE_BUFFER *line_buff) } -LINE_BUFFER *batch_readline_command(my_string str) +LINE_BUFFER *batch_readline_command(LINE_BUFFER *line_buff, my_string str) { - LINE_BUFFER *line_buff; - if (!(line_buff=(LINE_BUFFER*) my_malloc(sizeof(*line_buff),MYF(MY_WME)))) - return 0; + if (!line_buff) + if (!(line_buff=(LINE_BUFFER*) + my_malloc(sizeof(*line_buff),MYF(MY_WME | MY_ZEROFILL)))) + return 0; if (init_line_buffer_from_string(line_buff,str)) { my_free((char*) line_buff,MYF(0)); @@ -88,7 +90,6 @@ LINE_BUFFER *batch_readline_command(my_string str) static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer) { - bzero((char*) buffer,sizeof(buffer[0])); buffer->file=file; buffer->bufread=size; buffer->max_size=max_buffer; @@ -100,19 +101,26 @@ init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,ulong max_buffer) return 0; } - +/* + init_line_buffer_from_string can be called on the same buffer + several times. the resulting buffer will contain a + concatenation of all strings separated by spaces +*/ static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str) { - uint length; - bzero((char*) buffer,sizeof(buffer[0])); - length=(uint) strlen(str); - if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line= - (char*)my_malloc(length+2,MYF(MY_FAE)))) + uint old_length=buffer->end - buffer->buffer; + uint length= (uint) strlen(str); + if (!(buffer->buffer= buffer->start_of_line= buffer->end_of_line= + (char*)my_realloc(buffer->buffer, old_length+length+2, + MYF(MY_FAE|MY_ALLOW_ZERO_PTR)))) return 1; - memcpy(buffer->buffer,str,length); - buffer->buffer[length]='\n'; - buffer->buffer[length+1]=0; - buffer->end=buffer->buffer+length+1; + buffer->end= buffer->buffer + old_length; + if (old_length) + buffer->end[-1]=' '; + memcpy(buffer->end, str, length); + buffer->end[length]= '\n'; + buffer->end[length+1]= 0; + buffer->end+= length+1; buffer->eof=1; buffer->max_size=1; return 0; diff --git a/extra/Makefile.am b/extra/Makefile.am index 0276355ef65..df29a3a6ab7 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include +INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include @ndbcluster_includes@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ diff --git a/extra/perror.c b/extra/perror.c index 10b2442de20..1d3d7c70fac 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -23,15 +23,27 @@ #include #include #include +#ifdef HAVE_NDBCLUSTER_DB +#include "../ndb/src/ndbapi/ndberror.c" +#endif static my_bool verbose, print_all_codes; +#ifdef HAVE_NDBCLUSTER_DB +static my_bool ndb_code; +static char ndb_string[1024]; +#endif + static struct my_option my_long_options[] = { {"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef HAVE_NDBCLUSTER_DB + {"ndb", 0, "Ndbcluster storage engine specific error codes.", (gptr*) &ndb_code, + (gptr*) &ndb_code, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, +#endif #ifdef HAVE_SYS_ERRLIST {"all", 'a', "Print all the error messages and the number.", (gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG, @@ -199,7 +211,17 @@ int main(int argc,char *argv[]) { found=0; code=atoi(*argv); - msg = strerror(code); +#ifdef HAVE_NDBCLUSTER_DB + if (ndb_code) + { + if (ndb_error_string(code, ndb_string, 1024) < 0) + msg= 0; + else + msg= ndb_string; + } + else +#endif + msg = strerror(code); if (msg) { found=1; diff --git a/include/my_base.h b/include/my_base.h index 54c739bde23..4a2f3f85083 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -191,7 +191,7 @@ enum ha_base_keytype { #define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ #define HA_SPATIAL 1024 /* For spatial search */ #define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ - +#define HA_GENERATED_KEY 8192 /* Automaticly generated key */ /* Automatic bits in key-flag */ diff --git a/include/violite.h b/include/violite.h index e8f30288d34..b4b9f724d89 100644 --- a/include/violite.h +++ b/include/violite.h @@ -55,14 +55,8 @@ int vio_close_pipe(Vio * vio); void vio_delete(Vio* vio); int vio_close(Vio* vio); - -#ifdef EMBEDDED_LIBRARY -void vio_reset(Vio *vio); -#else -void vio_reset(Vio* vio, enum enum_vio_type type, - my_socket sd, HANDLE hPipe, my_bool localhost); -#endif - +void vio_reset(Vio* vio, enum enum_vio_type type, + my_socket sd, HANDLE hPipe, my_bool localhost); int vio_read(Vio *vio, gptr buf, int size); int vio_write(Vio *vio, const gptr buf, int size); int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h index b208fac8691..bfc937eb212 100644 --- a/innobase/include/ut0mem.h +++ b/innobase/include/ut0mem.h @@ -129,16 +129,6 @@ ut_str_catenate( char* str1, /* in: null-terminated string */ char* str2); /* in: null-terminated string */ -/************************************************************************** -Return a copy of the given string. The returned string must be freed -using mem_free. */ - -char* -ut_strdup( -/*======*/ - /* out, own: cnull-terminated string */ - char* str); /* in: null-terminated string */ - #ifndef UNIV_NONINL #include "ut0mem.ic" #endif diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 3f14a2158ed..aad8a911fd5 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -2314,18 +2314,18 @@ os_file_dirname( if (last_slash < 0) { /* no slash in the path, return "." */ - return(ut_strdup((char*)".")); + return(mem_strdup(".")); } /* ok, there is a slash */ if (last_slash == 0) { /* last slash is the first char of the path */ - return(ut_strdup((char*)"/")); + return(mem_strdup("/")); } /* non-trivial directory component */ - dir = ut_strdup(path); + dir = mem_strdup(path); dir[last_slash] = 0; return(dir); diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 9d0e63e6099..f21bb752fac 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -299,27 +299,3 @@ ut_str_catenate( return(str); } - -/************************************************************************** -Return a copy of the given string. The returned string must be freed -using mem_free. */ - -char* -ut_strdup( -/*======*/ - /* out, own: cnull-terminated string */ - char* str) /* in: null-terminated string */ -{ - ulint len; - char* copy; - - len = ut_strlen(str); - - copy = mem_alloc(len + 1); - - ut_memcpy(copy, str, len); - - copy[len] = 0; - - return(copy); -} diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 1c1ff9bac10..1d4f45b729f 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -42,7 +42,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); -MYSQL * +MYSQL * STDCALL cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag); diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc index 0b6416632b7..7d83023abd5 100644 --- a/libmysqld/emb_qcache.cc +++ b/libmysqld/emb_qcache.cc @@ -295,7 +295,7 @@ uint emb_count_querycache_size(THD *thd) cur_row= thd->data->data; n_rows= thd->data->rows; } - result= 4+8 + (42 + 4*n_rows)*mysql->field_count; + result= (uint) (4+8 + (42 + 4*n_rows)*mysql->field_count); for(; field < field_end; field++) { @@ -414,8 +414,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src) goto err; thd->data= data; init_alloc_root(&data->alloc, 8192,0); - row= (MYSQL_ROWS *)alloc_root(&data->alloc, rows * sizeof(MYSQL_ROWS) + - rows * (mysql->field_count+1)*sizeof(char*)); + row= (MYSQL_ROWS *)alloc_root(&data->alloc, (uint) (rows * sizeof(MYSQL_ROWS) + + rows * (mysql->field_count+1)*sizeof(char*))); end_row= row + rows; columns= (MYSQL_ROW)end_row; diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result index e2fb0607819..d4d525c8991 100644 --- a/mysql-test/r/constraints.result +++ b/mysql-test/r/constraints.result @@ -22,6 +22,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) default NULL, - UNIQUE KEY `constraint_1` (`a`) + UNIQUE KEY `constraint_1` (`a`), + UNIQUE KEY `key_1` (`a`), + UNIQUE KEY `key_2` (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 81a222c482a..b5f7da30bb3 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -155,7 +155,37 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` int(11) default NULL, PRIMARY KEY (`a`), - KEY `b` (`b`) + KEY `b` (`b`), + KEY `b_2` (`b`), + KEY `b_3` (`b`), + KEY `b_4` (`b`), + KEY `b_5` (`b`), + KEY `b_6` (`b`), + KEY `b_7` (`b`), + KEY `b_8` (`b`), + KEY `b_9` (`b`), + KEY `b_10` (`b`), + KEY `b_11` (`b`), + KEY `b_12` (`b`), + KEY `b_13` (`b`), + KEY `b_14` (`b`), + KEY `b_15` (`b`), + KEY `b_16` (`b`), + KEY `b_17` (`b`), + KEY `b_18` (`b`), + KEY `b_19` (`b`), + KEY `b_20` (`b`), + KEY `b_21` (`b`), + KEY `b_22` (`b`), + KEY `b_23` (`b`), + KEY `b_24` (`b`), + KEY `b_25` (`b`), + KEY `b_26` (`b`), + KEY `b_27` (`b`), + KEY `b_28` (`b`), + KEY `b_29` (`b`), + KEY `b_30` (`b`), + KEY `b_31` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select if(1,'1','0'), month("2002-08-02"); diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result new file mode 100644 index 00000000000..a8182438ac4 --- /dev/null +++ b/mysql-test/r/ctype_latin1.result @@ -0,0 +1,298 @@ +drop table if exists t1; +SET NAMES latin1; +CREATE TABLE t1 (a char(1) character set latin1); +INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17); +INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F); +INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27); +INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37); +INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47); +INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57); +INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67); +INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77); +INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87); +INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F); +INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97); +INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F); +INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7); +INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF); +INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7); +INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF); +INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7); +INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF); +INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7); +INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF); +INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7); +INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF); +INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7); +INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF); +SELECT +hex(a), +hex(@u:=convert(a using utf8)), +hex(@l:=convert(@u using latin1)), +a=@l FROM t1; +hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l +00 00 00 1 +01 01 01 1 +02 02 02 1 +03 03 03 1 +04 04 04 1 +05 05 05 1 +06 06 06 1 +07 07 07 1 +08 08 08 1 +09 09 09 1 +0A 0A 0A 1 +0B 0B 0B 1 +0C 0C 0C 1 +0D 0D 0D 1 +0E 0E 0E 1 +0F 0F 0F 1 +10 10 10 1 +11 11 11 1 +12 12 12 1 +13 13 13 1 +14 14 14 1 +15 15 15 1 +16 16 16 1 +17 17 17 1 +18 18 18 1 +19 19 19 1 +1A 1A 1A 1 +1B 1B 1B 1 +1C 1C 1C 1 +1D 1D 1D 1 +1E 1E 1E 1 +1F 1F 1F 1 + 1 +21 21 21 1 +22 22 22 1 +23 23 23 1 +24 24 24 1 +25 25 25 1 +26 26 26 1 +27 27 27 1 +28 28 28 1 +29 29 29 1 +2A 2A 2A 1 +2B 2B 2B 1 +2C 2C 2C 1 +2D 2D 2D 1 +2E 2E 2E 1 +2F 2F 2F 1 +30 30 30 1 +31 31 31 1 +32 32 32 1 +33 33 33 1 +34 34 34 1 +35 35 35 1 +36 36 36 1 +37 37 37 1 +38 38 38 1 +39 39 39 1 +3A 3A 3A 1 +3B 3B 3B 1 +3C 3C 3C 1 +3D 3D 3D 1 +3E 3E 3E 1 +3F 3F 3F 1 +40 40 40 1 +41 41 41 1 +42 42 42 1 +43 43 43 1 +44 44 44 1 +45 45 45 1 +46 46 46 1 +47 47 47 1 +48 48 48 1 +49 49 49 1 +4A 4A 4A 1 +4B 4B 4B 1 +4C 4C 4C 1 +4D 4D 4D 1 +4E 4E 4E 1 +4F 4F 4F 1 +50 50 50 1 +51 51 51 1 +52 52 52 1 +53 53 53 1 +54 54 54 1 +55 55 55 1 +56 56 56 1 +57 57 57 1 +58 58 58 1 +59 59 59 1 +5A 5A 5A 1 +5B 5B 5B 1 +5C 5C 5C 1 +5D 5D 5D 1 +5E 5E 5E 1 +5F 5F 5F 1 +60 60 60 1 +61 61 61 1 +62 62 62 1 +63 63 63 1 +64 64 64 1 +65 65 65 1 +66 66 66 1 +67 67 67 1 +68 68 68 1 +69 69 69 1 +6A 6A 6A 1 +6B 6B 6B 1 +6C 6C 6C 1 +6D 6D 6D 1 +6E 6E 6E 1 +6F 6F 6F 1 +70 70 70 1 +71 71 71 1 +72 72 72 1 +73 73 73 1 +74 74 74 1 +75 75 75 1 +76 76 76 1 +77 77 77 1 +78 78 78 1 +79 79 79 1 +7A 7A 7A 1 +7B 7B 7B 1 +7C 7C 7C 1 +7D 7D 7D 1 +7E 7E 7E 1 +7F 7F 7F 1 +80 E282AC 80 1 +81 3F 3F 0 +82 E2809A 82 1 +83 C692 83 1 +84 E2809E 84 1 +85 E280A6 85 1 +86 E280A0 86 1 +87 E280A1 87 1 +88 CB86 88 1 +89 E280B0 89 1 +8A C5A0 8A 1 +8B E280B9 8B 1 +8C C592 8C 1 +8D 3F 3F 0 +8E C5BD 8E 1 +8F 3F 3F 0 +90 3F 3F 0 +91 E28098 91 1 +92 E28099 92 1 +93 E2809C 93 1 +94 E2809D 94 1 +95 E280A2 95 1 +96 E28093 96 1 +97 E28094 97 1 +98 CB9C 98 1 +99 E284A2 99 1 +9A C5A1 9A 1 +9B E280BA 9B 1 +9C C593 9C 1 +9D 3F 3F 0 +9E C5BE 9E 1 +9F C5B8 9F 1 +A0 C2A0 A0 1 +A1 C2A1 A1 1 +A2 C2A2 A2 1 +A3 C2A3 A3 1 +A4 C2A4 A4 1 +A5 C2A5 A5 1 +A6 C2A6 A6 1 +A7 C2A7 A7 1 +A8 C2A8 A8 1 +A9 C2A9 A9 1 +AA C2AA AA 1 +AB C2AB AB 1 +AC C2AC AC 1 +AD C2AD AD 1 +AE C2AE AE 1 +AF C2AF AF 1 +B0 C2B0 B0 1 +B1 C2B1 B1 1 +B2 C2B2 B2 1 +B3 C2B3 B3 1 +B4 C2B4 B4 1 +B5 C2B5 B5 1 +B6 C2B6 B6 1 +B7 C2B7 B7 1 +B8 C2B8 B8 1 +B9 C2B9 B9 1 +BA C2BA BA 1 +BB C2BB BB 1 +BC C2BC BC 1 +BD C2BD BD 1 +BE C2BE BE 1 +BF C2BF BF 1 +C0 C380 C0 1 +C1 C381 C1 1 +C2 C382 C2 1 +C3 C383 C3 1 +C4 C384 C4 1 +C5 C385 C5 1 +C6 C386 C6 1 +C7 C387 C7 1 +C8 C388 C8 1 +C9 C389 C9 1 +CA C38A CA 1 +CB C38B CB 1 +CC C38C CC 1 +CD C38D CD 1 +CE C38E CE 1 +CF C38F CF 1 +D0 C390 D0 1 +D1 C391 D1 1 +D2 C392 D2 1 +D3 C393 D3 1 +D4 C394 D4 1 +D5 C395 D5 1 +D6 C396 D6 1 +D7 C397 D7 1 +D8 C398 D8 1 +D9 C399 D9 1 +DA C39A DA 1 +DB C39B DB 1 +DC C39C DC 1 +DD C39D DD 1 +DE C39E DE 1 +DF C39F DF 1 +E0 C3A0 E0 1 +E1 C3A1 E1 1 +E2 C3A2 E2 1 +E3 C3A3 E3 1 +E4 C3A4 E4 1 +E5 C3A5 E5 1 +E6 C3A6 E6 1 +E7 C3A7 E7 1 +E8 C3A8 E8 1 +E9 C3A9 E9 1 +EA C3AA EA 1 +EB C3AB EB 1 +EC C3AC EC 1 +ED C3AD ED 1 +EE C3AE EE 1 +EF C3AF EF 1 +F0 C3B0 F0 1 +F1 C3B1 F1 1 +F2 C3B2 F2 1 +F3 C3B3 F3 1 +F4 C3B4 F4 1 +F5 C3B5 F5 1 +F6 C3B6 F6 1 +F7 C3B7 F7 1 +F8 C3B8 F8 1 +F9 C3B9 F9 1 +FA C3BA FA 1 +FB C3BB FB 1 +FC C3BC FC 1 +FD C3BD FD 1 +FE C3BE FE 1 +FF C3BF FF 1 +DROP TABLE t1; diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 7209c86bb31..ed59de87395 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -82,6 +82,13 @@ Field Type Null Key Default Extra SET CHARACTER SET koi8r; DROP TABLE таблица; SET CHARACTER SET default; +SET NAMES UTF8; +CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8; +INSERT INTO t1 (t) VALUES ('x'); +SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t; +1 +1 +DROP TABLE t1; SET CHARACTER SET koi8r; CREATE DATABASE тест; USE тест; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 07445cc86d7..60280715911 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -371,6 +371,7 @@ t1 0 PRIMARY 2 b A # NULL NULL BTREE t1 0 c 1 c A # NULL NULL BTREE t1 0 b 1 b A # NULL NULL BTREE t1 1 a 1 a A # NULL NULL BTREE +t1 1 a_2 1 a A # NULL NULL BTREE drop table t1; create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); alter table t1 engine=innodb; @@ -1442,3 +1443,101 @@ drop table t1; create table t1 (a int) engine=innodb; create table t2 like t1; drop table t1,t2; +create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; +create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `t1_id_fk` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create index id on t2 (id); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create index id2 on t2 (id); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + KEY `id2` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop index id2 on t2; +drop index id on t2; +Got one of the listed errors +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + KEY `id` (`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + KEY `t1_id_fk` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +create unique index id on t2 (id,id2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `id2` int(11) NOT NULL default '0', + UNIQUE KEY `id` (`id`,`id2`), + KEY `t1_id_fk` (`id2`,`id`), + CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; +ERROR HY000: Can't create table './test/t2.frm' (errno: 150) +drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index a0c0e0f5503..71ac229601d 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -105,6 +105,18 @@ select min(a) from t1; min(a) -0.010 drop table t1; +create table t1 (a float(200,100), b double(200,100)); +insert t1 values (1.0, 2.0); +select * from t1; +a b +1.000000000000000000000000000000 2.000000000000000000000000000000 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` float(200,30) default NULL, + `b` double(200,30) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; create table t1 (f float(54)); ERROR 42000: Incorrect column specifier for column 'f' drop table if exists t1; diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test new file mode 100644 index 00000000000..14062437428 --- /dev/null +++ b/mysql-test/t/ctype_latin1.test @@ -0,0 +1,55 @@ +# +# Tests with the latin1 character set +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# WL 1494: Treat latin1 as cp1252 for unicode conversion +# + +SET NAMES latin1; +CREATE TABLE t1 (a char(1) character set latin1); +INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17); +INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F); +INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27); +INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37); +INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47); +INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57); +INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67); +INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77); +INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87); +INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F); +INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97); +INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F); +INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7); +INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF); +INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7); +INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF); +INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7); +INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF); +INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7); +INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF); +INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7); +INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF); +INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7); +INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF); + +# +# 0x81 0x8D 0x8F 0x90 0x9D are undefined in cp1252 +# +SELECT + hex(a), + hex(@u:=convert(a using utf8)), + hex(@l:=convert(@u using latin1)), + a=@l FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 40349da8aa9..8ac22e89c2d 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -56,6 +56,13 @@ SET CHARACTER SET koi8r; DROP TABLE таблица; SET CHARACTER SET default; +# Test for Item_func_conv_charset::fix_fields (bug #3704) +SET NAMES UTF8; +CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8; +INSERT INTO t1 (t) VALUES ('x'); +SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t; +DROP TABLE t1; + SET CHARACTER SET koi8r; CREATE DATABASE тест; USE тест; @@ -71,4 +78,3 @@ SET NAMES koi8r; SELECT hex('тест'); SET character_set_connection=cp1251; SELECT hex('тест'); - diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index e20be83b4b6..a260ab1263d 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1044,3 +1044,46 @@ drop table t1; create table t1 (a int) engine=innodb; create table t2 like t1; drop table t1,t2; + +# +# Test of automaticly created foreign keys +# + +create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; +create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; +show create table t1; +show create table t2; +create index id on t2 (id); +show create table t2; +create index id2 on t2 (id); +show create table t2; +drop index id2 on t2; +--error 1025,1025 +drop index id on t2; +show create table t2; +drop table t2; + +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; +show create table t2; +create unique index id on t2 (id,id2); +show create table t2; +drop table t2; + +# Check foreign key columns created in different order than key columns +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +drop table t2; + +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; +show create table t2; +drop table t2; + +create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; +show create table t2; +drop table t2; + +# Test error handling +--error 1005 +create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; + +drop table t1; diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index b45df8eb58e..9d3125efa61 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -71,7 +71,7 @@ show status like 'key_blocks_used'; # Following results differs on 64 and 32 bit systems because of different # pointer sizes, which takes up different amount of space in key cache ---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED +--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED show status like 'key_blocks_unused'; insert into t1 values (1, 'qqqq'), (11, 'yyyy'); @@ -84,7 +84,7 @@ update t1 set p=2 where p=1; update t2 set i=2 where i=1; show status like 'key_blocks_used'; ---replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED +--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED show status like 'key_blocks_unused'; cache index t1 key (`primary`) in keycache1; @@ -146,7 +146,7 @@ cache index t1,t2 in default; drop table t1,t2,t3; show status like 'key_blocks_used'; ---replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED +--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED show status like 'key_blocks_unused'; # Cleanup diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index caccf31b32a..7d3b90aabeb 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -54,6 +54,12 @@ select a from t1 order by a; select min(a) from t1; drop table t1; +create table t1 (a float(200,100), b double(200,100)); +insert t1 values (1.0, 2.0); +select * from t1; +show create table t1; +drop table t1; + # Errors --error 1063 diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 5058c301adb..8f915d6003a 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -117,10 +117,12 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, #if defined(HAVE_FCNTL) { struct flock lock; - lock.l_type= (short) locktype; - lock.l_whence=0L; - lock.l_start=(long) start; - lock.l_len=(long) length; + + lock.l_type= (short) locktype; + lock.l_whence= SEEK_SET; + lock.l_start= (off_t) start; + lock.l_len= (off_t) length; + if (MyFlags & MY_DONT_WAIT) { if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */ diff --git a/ndb/Defs.mk b/ndb/Defs.mk index d5a21c64ca9..cf891caa5c2 100644 --- a/ndb/Defs.mk +++ b/ndb/Defs.mk @@ -21,62 +21,43 @@ LIBPREFIX := lib fixpath = $1 ar_rcs = $(AR_RCS) $1 $2 #check-odbc = $(findstring sqlext.h, $(wildcard /usr/include/sqlext.h) $(wildcard /usr/local/include/sqlext.h)) -CCFLAGS_TOP += -DHAVE_STRCASECMP - endif ifeq ($(NDB_OS), WIN32) -CCFLAGS_TOP += -DHAVE_STRDUP -NDB_STRLCPY := Y -NDB_STRLCAT := Y SHLIBEXT := dll endif ifeq ($(NDB_OS), LINUX) -CCFLAGS_TOP += -DHAVE_STRDUP -NDB_STRLCAT := Y -NDB_STRLCPY := Y SHLIBEXT := so endif ifeq ($(NDB_OS), SOLARIS) -CCFLAGS_TOP += -DHAVE_STRDUP -NDB_STRLCAT := Y -NDB_STRLCPY := Y SHLIBEXT := so endif ifeq ($(NDB_OS), HPUX) -CCFLAGS_TOP += -DHAVE_STRDUP -NDB_STRLCAT := Y -NDB_STRLCPY := Y SHLIBEXT := sl endif ifeq ($(NDB_OS), MACOSX) -CCFLAGS_TOP += -DHAVE_STRLCAT -CCFLAGS_TOP += -DHAVE_STRLCAT -CCFLAGS_TOP += -DHAVE_STRLCPY CCFLAGS_TOP += -DNDBOUT_UINTPTR SHLIBEXT := dylib endif ifeq ($(NDB_OS), OSE) -NDB_STRDUP := Y -NDB_STRLCAT := Y -NDB_STRLCPY := Y SHLIBEXT := so endif ifeq ($(NDB_OS), SOFTOSE) -NDB_STRDUP := Y -NDB_STRLCAT := Y -NDB_STRLCPY := Y SHLIBEXT := so endif ifeq ($(NDB_SCI), Y) -CCFLAGS_TOP += -DHAVE_SCI +CCFLAGS_TOP += -DHAVE_NDB_SCI +endif + +ifeq ($(NDB_SHM), Y) +CCFLAGS_TOP += -DHAVE_NDB_SHM endif ifneq ($(findstring OSE, $(NDB_OS)),) diff --git a/ndb/Epilogue.mk b/ndb/Epilogue.mk index dc78a66a1f8..bcdc54a87f1 100644 --- a/ndb/Epilogue.mk +++ b/ndb/Epilogue.mk @@ -227,7 +227,7 @@ CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util) \ BIN_TARGET_LIBS += logger general portlib endif -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include) +CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include) -I$(call fixpath,$(NDB_TOP)/../include) ifeq ($(NDB_SCI), Y) BIN_TARGET_LIBS += sisci diff --git a/ndb/Makefile b/ndb/Makefile index 586a430bb17..475914f6120 100644 --- a/ndb/Makefile +++ b/ndb/Makefile @@ -6,6 +6,13 @@ DIRS := src test tools examples replace-targets := all clean NDB_RELEASE := $(shell ../scripts/mysql_config --version) +all: + $(MAKE) -C src + $(MAKE) -C test/src + $(MAKE) -C tools + $(MAKE) -C test/ndbapi/flexBench + $(MAKE) -C test/tools/waiter + include $(NDB_TOP)/Epilogue.mk _libs_test : _bins_src @@ -15,7 +22,7 @@ _bins_src : _libs_src _bins_tools : _bins_src # always release compile except for ndbapi static lib -all: +old-all: $(MAKE) -C src/ndbapi libs $(MAKE) libs NDB_VERSION=RELEASE $(MAKE) bins NDB_VERSION=RELEASE diff --git a/ndb/config/GuessConfig.sh b/ndb/config/GuessConfig.sh index d2d8446c704..3caeeaae6d0 100755 --- a/ndb/config/GuessConfig.sh +++ b/ndb/config/GuessConfig.sh @@ -11,6 +11,11 @@ then NDB_SCI=N fi +if [ -z "$NDB_SHM" ] +then + NDB_SHM=N +fi + os=`uname -s` case $os in Linux) diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp index 685c853c5d5..7abebcc832d 100644 --- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp +++ b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp @@ -63,20 +63,12 @@ */ +#include + #include #include #include // Used for cout -#ifdef SOLARIS -#include -#include -#endif - -#if defined LINUX || defined MACOSX -#include -#include -#endif - /** * Helper sleep function */ diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp index 186afdb9471..7c3a66326c6 100644 --- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp +++ b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp @@ -85,21 +85,13 @@ */ +#include + #include #include // Used for cout #include -#ifdef SOLARIS -#include -#include -#endif - -#if defined LINUX || defined MACOSX -#include -#include -#endif - /** * Helper sleep function */ diff --git a/ndb/include/debugger/SignalLoggerManager.hpp b/ndb/include/debugger/SignalLoggerManager.hpp index 3d89b399f3b..742bf7d294e 100644 --- a/ndb/include/debugger/SignalLoggerManager.hpp +++ b/ndb/include/debugger/SignalLoggerManager.hpp @@ -24,7 +24,6 @@ #define SignalLoggerManager_H -#include #include #include #include @@ -153,7 +152,7 @@ public: private: bool m_logDistributed; - int m_ownNodeId; + Uint32 m_ownNodeId; FILE * outputStream; int log(int cmd, BlockNumber bno, LogMode logMode); diff --git a/ndb/include/kernel/LogLevel.hpp b/ndb/include/kernel/LogLevel.hpp index 0902f3e488b..3363dc2befd 100644 --- a/ndb/include/kernel/LogLevel.hpp +++ b/ndb/include/kernel/LogLevel.hpp @@ -17,8 +17,7 @@ #ifndef _LOG_LEVEL_HPP #define _LOG_LEVEL_HPP -#include -#include +#include /** * diff --git a/ndb/include/kernel/signaldata/BuildIndx.hpp b/ndb/include/kernel/signaldata/BuildIndx.hpp index 9cf1123cc61..29dfaeb79a6 100644 --- a/ndb/include/kernel/signaldata/BuildIndx.hpp +++ b/ndb/include/kernel/signaldata/BuildIndx.hpp @@ -19,7 +19,6 @@ #include "SignalData.hpp" #include -#include #include /** diff --git a/ndb/include/kernel/signaldata/SignalData.hpp b/ndb/include/kernel/signaldata/SignalData.hpp index 071bd9b9104..511e7d30c21 100644 --- a/ndb/include/kernel/signaldata/SignalData.hpp +++ b/ndb/include/kernel/signaldata/SignalData.hpp @@ -17,11 +17,9 @@ #ifndef SIGNAL_DATA_H #define SIGNAL_DATA_H +#include #include #include -#include -#include -#include #ifndef NDB_ASSERT #ifdef VM_TRACE diff --git a/ndb/include/kernel/signaldata/SignalDataPrint.hpp b/ndb/include/kernel/signaldata/SignalDataPrint.hpp index 588e2893214..17ab07acd4e 100644 --- a/ndb/include/kernel/signaldata/SignalDataPrint.hpp +++ b/ndb/include/kernel/signaldata/SignalDataPrint.hpp @@ -17,8 +17,8 @@ #ifndef SIGNAL_DATA_PRINT_H #define SIGNAL_DATA_PRINT_H +#include #include -#include /** * Typedef for a Signal Data Print Function diff --git a/ndb/include/logger/FileLogHandler.hpp b/ndb/include/logger/FileLogHandler.hpp index ae69a2f5418..08e46c11844 100644 --- a/ndb/include/logger/FileLogHandler.hpp +++ b/ndb/include/logger/FileLogHandler.hpp @@ -19,7 +19,7 @@ #include "LogHandler.hpp" -class File; +class File_class; /** * Logs messages to a file. The log file will be archived depending on @@ -104,7 +104,7 @@ private: int m_maxNoFiles; long m_maxFileSize; unsigned int m_maxLogEntries; - File* m_pLogFile; + File_class* m_pLogFile; }; #endif diff --git a/ndb/include/logger/LogHandler.hpp b/ndb/include/logger/LogHandler.hpp index 8c5c9298f69..8f76783e6b0 100644 --- a/ndb/include/logger/LogHandler.hpp +++ b/ndb/include/logger/LogHandler.hpp @@ -19,7 +19,6 @@ #include "Logger.hpp" -#include // Defines NULL /** * This class is the base class for all log handlers. A log handler is diff --git a/ndb/include/logger/Logger.hpp b/ndb/include/logger/Logger.hpp index 2d12a5b8a6e..d4937c11744 100644 --- a/ndb/include/logger/Logger.hpp +++ b/ndb/include/logger/Logger.hpp @@ -17,8 +17,8 @@ #ifndef Logger_H #define Logger_H +#include #include -#include class LogHandler; class LogHandlerList; diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h index c74a046b7e7..0ecb19eaa76 100644 --- a/ndb/include/mgmapi/mgmapi.h +++ b/ndb/include/mgmapi/mgmapi.h @@ -80,13 +80,13 @@ extern "C" { * NDB Cluster node types */ enum ndb_mgm_node_type { - NDB_MGM_NODE_TYPE_UNKNOWN = -1, ///< Node type not known - NDB_MGM_NODE_TYPE_API = 0, ///< An application node (API) - NDB_MGM_NODE_TYPE_NDB = 1, ///< A database node (DB) - NDB_MGM_NODE_TYPE_MGM = 2, ///< A management server node (MGM) + NDB_MGM_NODE_TYPE_UNKNOWN = -1, /*/< Node type not known*/ + NDB_MGM_NODE_TYPE_API = 0, /*/< An application node (API)*/ + NDB_MGM_NODE_TYPE_NDB = 1, /*/< A database node (DB)*/ + NDB_MGM_NODE_TYPE_MGM = 2, /*/< A management server node (MGM)*/ - NDB_MGM_NODE_TYPE_MIN = 0, ///< Min valid value - NDB_MGM_NODE_TYPE_MAX = 2 ///< Max valid value + NDB_MGM_NODE_TYPE_MIN = 0, /*/< Min valid value*/ + NDB_MGM_NODE_TYPE_MAX = 2 /*/< Max valid value*/ }; /** diff --git a/ndb/include/mgmcommon/MgmtErrorReporter.hpp b/ndb/include/mgmcommon/MgmtErrorReporter.hpp index acc44b14d8e..925d9e6407a 100644 --- a/ndb/include/mgmcommon/MgmtErrorReporter.hpp +++ b/ndb/include/mgmcommon/MgmtErrorReporter.hpp @@ -22,8 +22,8 @@ //****************************************************************************** +#include // exit #include -#include // exit #define REPORT_WARNING(message) \ ndbout << "WARNING: " << message << endl diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h new file mode 100644 index 00000000000..5e03b972268 --- /dev/null +++ b/ndb/include/ndb_global.h @@ -0,0 +1,89 @@ + +#ifndef NDBGLOBAL_H +#define NDBGLOBAL_H + +#include + +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) +#define NDB_WIN32 +#else +#undef NDB_WIN32 +#endif + +#include +#include +#include +#include +#ifdef HAVE_STDARG_H +#include +#endif +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#include +#ifdef HAVE_SYS_STAT_H +#include +#endif +#include +#ifdef HAVE_SYS_WAIT_H +#include +#endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif + +#ifdef NDB_WIN32 +#include +#include + +#define DIR_SEPARATOR "\\" +#define PATH_MAX 256 + +#pragma warning(disable: 4503 4786) +#else + +#define DIR_SEPARATOR "/" + +#endif + +#ifdef NDB_VC98 +#define STATIC_CONST(x) enum { x } +#else +#define STATIC_CONST(x) static const Uint32 x +#endif + +#ifdef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef HAVE_STRDUP +extern char * strdup(const char *s); +#endif + +#ifndef HAVE_STRLCPY +extern size_t strlcpy (char *dst, const char *src, size_t dst_sz); +#endif + +#ifndef HAVE_STRLCAT +extern size_t strlcat (char *dst, const char *src, size_t dst_sz); +#endif + +#ifndef HAVE_STRCASECMP +extern int strcasecmp(const char *s1, const char *s2); +extern int strncasecmp(const char *s1, const char *s2, size_t n); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ndb/include/ndb_net.h b/ndb/include/ndb_net.h new file mode 100644 index 00000000000..279beb471a7 --- /dev/null +++ b/ndb/include/ndb_net.h @@ -0,0 +1,7 @@ + +#ifndef NDBNET_H +#define NDBNET_H + +#include + +#endif diff --git a/ndb/include/ndb_types.h b/ndb/include/ndb_types.h index 40d73b0f230..166368b99c5 100644 --- a/ndb/include/ndb_types.h +++ b/ndb/include/ndb_types.h @@ -21,9 +21,6 @@ #ifndef SYS_TYPES_H #define SYS_TYPES_H -#include -#include - typedef char Int8; typedef unsigned char Uint8; typedef short Int16; diff --git a/ndb/include/ndb_version.h b/ndb/include/ndb_version.h index 958dd339f74..9bb6af59590 100644 --- a/ndb/include/ndb_version.h +++ b/ndb/include/ndb_version.h @@ -17,9 +17,6 @@ #ifndef NDB_VERSION_H #define NDB_VERSION_H -#include -#include - #include #define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0)) @@ -47,7 +44,7 @@ * Used by transporter and when communicating with * managment server */ -//#define NDB_VERSION_ID 0 +/*#define NDB_VERSION_ID 0*/ #endif diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 59bdd212919..fd6e827ceb4 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -860,9 +860,9 @@ #include #include -#include "AttrType.hpp" +#include #include -#include "NdbDictionary.hpp" +#include class NdbObjectIdMap; class NdbOperation; @@ -1673,7 +1673,7 @@ private: */ struct StartTransactionNodeSelectionData { StartTransactionNodeSelectionData(): - fragment2PrimaryNodeMap(NULL) {}; + fragment2PrimaryNodeMap(0) {}; Uint32 kValue; Uint32 hashValueMask; Uint32 hashpointerValue; diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp index a1532bb2f0e..c775dd5e33d 100644 --- a/ndb/include/ndbapi/NdbConnection.hpp +++ b/ndb/include/ndbapi/NdbConnection.hpp @@ -18,9 +18,8 @@ #define NdbConnection_H #include -#include "AttrType.hpp" +#include #include -#include class NdbConnection; class NdbOperation; diff --git a/ndb/include/ndbapi/NdbError.hpp b/ndb/include/ndbapi/NdbError.hpp index b08dd1041b2..8cde2a8cf38 100644 --- a/ndb/include/ndbapi/NdbError.hpp +++ b/ndb/include/ndbapi/NdbError.hpp @@ -17,6 +17,8 @@ #ifndef NDB_ERROR_HPP #define NDB_ERROR_HPP +#include + /** * @struct NdbError * @brief Contains error information @@ -51,7 +53,7 @@ struct NdbError { * The error code indicate success
* (Includes classification: NdbError::NoError) */ - Success = 0, + Success = ndberror_st_success, /** * The error code indicates a temporary error. @@ -61,7 +63,7 @@ struct NdbError { * NdbError::OverloadError, NdbError::NodeShutdown * and NdbError::TimeoutExpired.) */ - TemporaryError = 1, + TemporaryError = ndberror_st_temporary, /** * The error code indicates a permanent error.
@@ -71,14 +73,14 @@ struct NdbError { * NdbError::UserDefinedError, NdbError::InternalError, and, * NdbError::FunctionNotImplemented.) */ - PermanentError = 2, + PermanentError = ndberror_st_permanent, /** * The result/status is unknown.
* (Includes classifications: NdbError::UnknownResultError, and * NdbError::UnknownErrorCode.) */ - UnknownResult = 3 + UnknownResult = ndberror_st_unknown }; /** @@ -88,85 +90,85 @@ struct NdbError { /** * Success. No error occurred. */ - NoError = 0, + NoError = ndberror_cl_none, /** * Error in application program. */ - ApplicationError = 1, + ApplicationError = ndberror_cl_application, /** * Read operation failed due to missing record. */ - NoDataFound = 2, + NoDataFound = ndberror_cl_no_data_found, /** * E.g. inserting a tuple with a primary key already existing * in the table. */ - ConstraintViolation = 3, + ConstraintViolation = ndberror_cl_constraint_violation, /** * Error in creating table or usage of table. */ - SchemaError = 4, + SchemaError = ndberror_cl_schema_error, /** * Error occurred in interpreted program. */ - UserDefinedError = 5, + UserDefinedError = ndberror_cl_user_defined, /** * E.g. insufficient memory for data or indexes. */ - InsufficientSpace = 6, + InsufficientSpace = ndberror_cl_insufficient_space, /** * E.g. too many active transactions. */ - TemporaryResourceError = 7, + TemporaryResourceError = ndberror_cl_temporary_resource, /** * Temporary failures which are probably inflicted by a node * recovery in progress. Examples: information sent between * application and NDB lost, distribution change. */ - NodeRecoveryError = 8, + NodeRecoveryError = ndberror_cl_node_recovery, /** * E.g. out of log file space. */ - OverloadError = 9, + OverloadError = ndberror_cl_overload, /** * Timeouts, often inflicted by deadlocks in NDB. */ - TimeoutExpired = 10, + TimeoutExpired = ndberror_cl_timeout_expired, /** * Is is unknown whether the transaction was committed or not. */ - UnknownResultError = 11, + UnknownResultError = ndberror_cl_unknown_result, /** * A serious error in NDB has occurred. */ - InternalError = 12, + InternalError = ndberror_cl_internal_error, /** * A function used is not yet implemented. */ - FunctionNotImplemented = 13, + FunctionNotImplemented = ndberror_cl_function_not_implemented, /** * Error handler could not determine correct error code. */ - UnknownErrorCode = 14, + UnknownErrorCode = ndberror_cl_unknown_error_code, /** * Node shutdown */ - NodeShutdown = 15 + NodeShutdown = ndberror_cl_node_shutdown }; /** @@ -204,6 +206,22 @@ struct NdbError { message = 0; details = 0; } + NdbError(const ndberror_struct & ndberror){ + status = (NdbError::Status) ndberror.status; + classification = (NdbError::Classification) ndberror.classification; + code = ndberror.code; + message = ndberror.message; + details = ndberror.details; + } + operator ndberror_struct() const { + ndberror_struct ndberror; + ndberror.status = (ndberror_status_enum) status; + ndberror.classification = (ndberror_classification_enum) classification; + ndberror.code = code; + ndberror.message = message; + ndberror.details = details; + return ndberror; + } }; class NdbOut& operator <<(class NdbOut&, const NdbError &); diff --git a/ndb/include/ndbapi/NdbEventOperation.hpp b/ndb/include/ndbapi/NdbEventOperation.hpp index 911b00b02c4..056e9a58c74 100644 --- a/ndb/include/ndbapi/NdbEventOperation.hpp +++ b/ndb/include/ndbapi/NdbEventOperation.hpp @@ -157,8 +157,8 @@ public: * the attribute, or a NULL pointer * (indicating error). */ - NdbRecAttr *getValue(const char *anAttrName, char *aValue = NULL); - NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = NULL); + NdbRecAttr *getValue(const char *anAttrName, char *aValue = 0); + NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0); /** * Retrieves event resultset if available, inserted into the NdbRecAttrs @@ -172,7 +172,7 @@ public: * overflow and *pOverRun will indicate the number of events that have * overwritten. */ - int next(int *pOverRun=NULL); + int next(int *pOverRun=0); /** * In the current implementation a nodefailiure may cause loss of events, diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp index 4f5f4597937..3c515fe84ef 100644 --- a/ndb/include/ndbapi/NdbOperation.hpp +++ b/ndb/include/ndbapi/NdbOperation.hpp @@ -17,14 +17,11 @@ #ifndef NdbOperation_H #define NdbOperation_H -#include -#include - #include -#include "AttrType.hpp" -#include "NdbError.hpp" -#include "NdbReceiver.hpp" -#include + +#include +#include +#include class Ndb; class NdbApiSignal; @@ -480,8 +477,8 @@ public: * the attribute, or a NULL pointer * (indicating error). */ - NdbRecAttr* getValue(const char* anAttrName, char* aValue = NULL); - NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = NULL); + NdbRecAttr* getValue(const char* anAttrName, char* aValue = 0); + NdbRecAttr* getValue(Uint32 anAttrId, char* aValue = 0); /** * Define an attribute to set or update in query. @@ -925,7 +922,7 @@ protected: virtual int equal_impl(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len); - NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = NULL); + NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = 0); int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len); int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue); int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue); diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp index a5595096bf6..7eeff88671d 100644 --- a/ndb/include/ndbapi/NdbRecAttr.hpp +++ b/ndb/include/ndbapi/NdbRecAttr.hpp @@ -17,9 +17,6 @@ #ifndef NdbRecAttr_H #define NdbRecAttr_H -#include - -#include #include #include "AttrType.hpp" @@ -427,9 +424,9 @@ inline void NdbRecAttr::release() { - if (theStorageX != NULL) { + if (theStorageX != 0) { delete [] theStorageX; - theStorageX = NULL; + theStorageX = 0; } } @@ -437,10 +434,10 @@ inline void NdbRecAttr::init() { - theStorageX = NULL; - theValue = NULL; - theRef = NULL; - theNext = NULL; + theStorageX = 0; + theValue = 0; + theRef = 0; + theNext = 0; theAttrId = 0xFFFF; theNULLind = -1; } @@ -470,7 +467,7 @@ inline bool NdbRecAttr::copyoutRequired() const { - return theRef != theValue && theValue != NULL; + return theRef != theValue && theValue != 0; } inline diff --git a/ndb/include/ndbapi/NdbReceiver.hpp b/ndb/include/ndbapi/NdbReceiver.hpp index 952803f8e70..bc11207a112 100644 --- a/ndb/include/ndbapi/NdbReceiver.hpp +++ b/ndb/include/ndbapi/NdbReceiver.hpp @@ -18,7 +18,7 @@ #define NdbReceiver_H #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL // Not part of public interface -#include +#include class Ndb; class NdbReceiver diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp index e041c79d96f..f83669fb616 100644 --- a/ndb/include/ndbapi/NdbScanOperation.hpp +++ b/ndb/include/ndbapi/NdbScanOperation.hpp @@ -172,25 +172,6 @@ SetValueRec::SetValueRec() : { } -inline -SetValueRec::~SetValueRec() -{ - if ((stype == SET_STRING_ATTR1) || - (stype == SET_INT32_ATTR1) || - (stype == SET_UINT32_ATTR1) || - (stype == SET_INT64_ATTR1) || - (stype == SET_UINT64_ATTR1) || - (stype == SET_FLOAT_ATTR1) || - (stype == SET_DOUBLE_ATTR1)) - free(anAttrName); - - if ((stype == SET_STRING_ATTR1) || - (stype == SET_STRING_ATTR2)) - free(stringStruct.aStringValue); - if (next) delete next; - next = 0; -} - class SetValueRecList { public: SetValueRecList(); diff --git a/ndb/include/ndbapi/NdbSchemaOp.hpp b/ndb/include/ndbapi/NdbSchemaOp.hpp index 90837bbc66b..c3a3827a6b4 100644 --- a/ndb/include/ndbapi/NdbSchemaOp.hpp +++ b/ndb/include/ndbapi/NdbSchemaOp.hpp @@ -18,11 +18,9 @@ #define NdbSchemaOp_H #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED -#include +#include "NdbDictionary.hpp" #include "AttrType.hpp" #include "NdbSchemaCon.hpp" -#include -#include "NdbDictionary.hpp" class NdbApiSignal; class Ndb; diff --git a/ndb/include/ndbapi/ndberror.h b/ndb/include/ndbapi/ndberror.h new file mode 100644 index 00000000000..5c2d85b82a6 --- /dev/null +++ b/ndb/include/ndbapi/ndberror.h @@ -0,0 +1,98 @@ +/* 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 */ + +#ifndef NDBERROR_H +#define NDBERROR_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum +{ + ndberror_st_success = 0, + ndberror_st_temporary = 1, + ndberror_st_permanent = 2, + ndberror_st_unknown = 3 +} ndberror_status_enum; + +typedef enum +{ + ndberror_cl_none = 0, + ndberror_cl_application = 1, + ndberror_cl_no_data_found = 2, + ndberror_cl_constraint_violation = 3, + ndberror_cl_schema_error = 4, + ndberror_cl_user_defined = 5, + ndberror_cl_insufficient_space = 6, + ndberror_cl_temporary_resource = 7, + ndberror_cl_node_recovery = 8, + ndberror_cl_overload = 9, + ndberror_cl_timeout_expired = 10, + ndberror_cl_unknown_result = 11, + ndberror_cl_internal_error = 12, + ndberror_cl_function_not_implemented = 13, + ndberror_cl_unknown_error_code = 14, + ndberror_cl_node_shutdown = 15 +} ndberror_classification_enum; + + +typedef struct { + + /** + * Error status. + */ + ndberror_status_enum status; + + /** + * Error type + */ + ndberror_classification_enum classification; + + /** + * Error code + */ + int code; + + /** + * Error message + */ + const char * message; + + /** + * The detailed description. This is extra information regarding the + * error which is not included in the error message. + * + * @note Is NULL when no details specified + */ + char * details; + +} ndberror_struct; + + +typedef ndberror_status_enum ndberror_status; +typedef ndberror_classification_enum ndberror_classification; + +const char *ndberror_status_message(ndberror_status); +const char *ndberror_classification_message(ndberror_classification); +void ndberror_update(ndberror_struct *); +int ndb_error_string(int err_no, char *str, unsigned int size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ndb/include/newtonapi/dba.h b/ndb/include/newtonapi/dba.h index eb5b3f9b5c2..4cfc0ec8eb9 100644 --- a/ndb/include/newtonapi/dba.h +++ b/ndb/include/newtonapi/dba.h @@ -102,11 +102,9 @@ /* --- Include files ---- */ +#include #include -#include - - /* --- Types and definitions --- */ /** diff --git a/ndb/include/newtonapi/defs/pcn_types.h b/ndb/include/newtonapi/defs/pcn_types.h index a823846d7be..eae6c67899d 100644 --- a/ndb/include/newtonapi/defs/pcn_types.h +++ b/ndb/include/newtonapi/defs/pcn_types.h @@ -17,16 +17,9 @@ #ifndef PCN_TYPES_H #define PCN_TYPES_H -#include -#include +#include -#ifdef NDB_MACOSX -typedef unsigned int Size_t; -#elif defined(NDB_SPARC_64) -typedef unsigned int Size_t; -#else typedef size_t Size_t; -#endif typedef int Boolean_t; diff --git a/ndb/include/portlib/NdbConstant.hpp b/ndb/include/portlib/NdbConstant.hpp deleted file mode 100644 index bd45209d2b5..00000000000 --- a/ndb/include/portlib/NdbConstant.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 */ - -#ifndef NDB_CONSTANT_HPP -#define NDB_CONSTANT_HPP - -#include - -#ifdef NDB_VC98 -#define STATIC_CONST(x) enum { x } -#else -#define STATIC_CONST(x) static const Uint32 x -#endif - -#endif diff --git a/ndb/include/portlib/NdbMem.h b/ndb/include/portlib/NdbMem.h index 38ad3f60448..0f2de80200e 100644 --- a/ndb/include/portlib/NdbMem.h +++ b/ndb/include/portlib/NdbMem.h @@ -17,8 +17,7 @@ #ifndef NDB_MEM_H #define NDB_MEM_H -#include - +#include #ifdef __cplusplus extern "C" { diff --git a/ndb/include/portlib/NdbMutex.h b/ndb/include/portlib/NdbMutex.h index d2cb6328b03..9ca2bae8ce1 100644 --- a/ndb/include/portlib/NdbMutex.h +++ b/ndb/include/portlib/NdbMutex.h @@ -17,6 +17,8 @@ #ifndef NDB_MUTEX_H #define NDB_MUTEX_H +#include + #ifdef NDB_WIN32 #include #include @@ -34,7 +36,7 @@ typedef SEMAPHORE NdbMutex; #elif defined NDB_WIN32 typedef CRITICAL_SECTION NdbMutex; #else -#include +#include typedef pthread_mutex_t NdbMutex; #define NDB_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #endif diff --git a/ndb/include/portlib/NdbTCP.h b/ndb/include/portlib/NdbTCP.h index 6e2f18b61b2..42c34855c39 100644 --- a/ndb/include/portlib/NdbTCP.h +++ b/ndb/include/portlib/NdbTCP.h @@ -17,6 +17,9 @@ #ifndef NDB_TCP_H #define NDB_TCP_H +#include +#include + #if defined NDB_OSE || defined NDB_SOFTOSE /** * Include files needed @@ -24,7 +27,6 @@ #include "inet.h" #include -#include #define NDB_NONBLOCK FNDELAY #define NDB_SOCKET_TYPE int @@ -38,65 +40,13 @@ typedef int socklen_t; #define InetErrno (* inet_errno()) -#endif +#elif NDB_WIN32 -#if defined NDB_SOLARIS || defined NDB_HPUX || defined NDB_IBMAIX || defined NDB_TRU64X -/** - * Include files needed - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define NDB_NONBLOCK O_NONBLOCK -#define NDB_SOCKET_TYPE int -#define NDB_INVALID_SOCKET -1 -#define NDB_CLOSE_SOCKET(x) close(x) - -#define InetErrno errno - -#endif - -#if defined NDB_LINUX || defined NDB_MACOSX -/** - * Include files needed - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define NDB_NONBLOCK O_NONBLOCK -#define NDB_SOCKET_TYPE int -#define NDB_INVALID_SOCKET -1 -#define NDB_CLOSE_SOCKET(x) close(x) - -#define InetErrno errno - -#endif - - -#ifdef NDB_WIN32 /** * Include files needed */ #include #include -#include #define InetErrno WSAGetLastError() #define EWOULDBLOCK WSAEWOULDBLOCK @@ -104,14 +54,23 @@ typedef int socklen_t; #define NDB_INVALID_SOCKET INVALID_SOCKET #define NDB_CLOSE_SOCKET(x) closesocket(x) -#endif - -#ifndef NDB_MACOSX -#define NDB_SOCKLEN_T socklen_t #else -#define NDB_SOCKLEN_T int + +/** + * Include files needed + */ +#include + +#define NDB_NONBLOCK O_NONBLOCK +#define NDB_SOCKET_TYPE int +#define NDB_INVALID_SOCKET -1 +#define NDB_CLOSE_SOCKET(x) close(x) + +#define InetErrno errno + #endif +#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE #ifdef __cplusplus extern "C" { diff --git a/ndb/include/portlib/NdbThread.h b/ndb/include/portlib/NdbThread.h index 516022903e3..212f7de9384 100644 --- a/ndb/include/portlib/NdbThread.h +++ b/ndb/include/portlib/NdbThread.h @@ -17,8 +17,7 @@ #ifndef NDB_THREAD_H #define NDB_THREAD_H -#include - +#include #ifdef __cplusplus extern "C" { diff --git a/ndb/include/portlib/NdbTick.h b/ndb/include/portlib/NdbTick.h index 762f65331cc..9bd8eca22bd 100644 --- a/ndb/include/portlib/NdbTick.h +++ b/ndb/include/portlib/NdbTick.h @@ -42,7 +42,7 @@ NDB_TICKS NdbTick_CurrentMillisecond(void); */ int NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros); -//#define TIME_MEASUREMENT + /*#define TIME_MEASUREMENT*/ #ifdef TIME_MEASUREMENT struct MicroSecondTimer { diff --git a/ndb/include/portlib/NdbUnistd.h b/ndb/include/portlib/NdbUnistd.h deleted file mode 100644 index 42f67e2aeb3..00000000000 --- a/ndb/include/portlib/NdbUnistd.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 */ - -#ifndef NDB_UNISTD_H -#define NDB_UNISTD_H - -#ifdef NDB_WIN32 -#include -#include -#include -#include - -#define DIR_SEPARATOR "\\" -#define PATH_MAX 256 - -#pragma warning(disable: 4503 4786) - -#else -#include -#include - -#define DIR_SEPARATOR "/" - -#endif - -#endif diff --git a/ndb/include/transporter/TransporterDefinitions.hpp b/ndb/include/transporter/TransporterDefinitions.hpp index 5bbf7c79491..cb859e310db 100644 --- a/ndb/include/transporter/TransporterDefinitions.hpp +++ b/ndb/include/transporter/TransporterDefinitions.hpp @@ -17,8 +17,8 @@ #ifndef TransporterDefinitions_H #define TransporterDefinitions_H +#include #include -#include #include /** diff --git a/ndb/include/util/BaseString.hpp b/ndb/include/util/BaseString.hpp index a88bd97ffc5..75a1c291594 100644 --- a/ndb/include/util/BaseString.hpp +++ b/ndb/include/util/BaseString.hpp @@ -17,9 +17,7 @@ #ifndef __UTIL_BASESTRING_HPP_INCLUDED__ #define __UTIL_BASESTRING_HPP_INCLUDED__ -#include -#include - +#include #include /** diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp index 1f95d62bcb6..ed981743512 100644 --- a/ndb/include/util/Bitmask.hpp +++ b/ndb/include/util/Bitmask.hpp @@ -17,12 +17,9 @@ #ifndef NDB_BITMASK_H #define NDB_BITMASK_H -#include -#include +#include #ifndef NDB_ASSERT -#include -#include #define NDB_ASSERT(x, s) \ do { if (!(x)) { printf("%s\n", s); abort(); } } while (0) #endif diff --git a/ndb/include/util/File.hpp b/ndb/include/util/File.hpp index fe3d2642b18..3ed0ad7a6f9 100644 --- a/ndb/include/util/File.hpp +++ b/ndb/include/util/File.hpp @@ -17,8 +17,7 @@ #ifndef FILE_H #define FILE_H -#include -#include +#include /** * This class provides a file abstraction . It has operations @@ -26,7 +25,7 @@ * * @version #@ $Id: File.hpp,v 1.5 2002/04/26 13:15:38 ejonore Exp $ */ -class File +class File_class { public: /** @@ -65,7 +64,7 @@ public: /** * Default constructor. */ - File(); + File_class(); /** * Creates a new File with the specified filename and file mode. @@ -76,12 +75,12 @@ public: * @param aFileName a filename. * @param mode the mode which the file should be opened/created with, default "r". */ - File(const char* aFileName, const char* mode = "r"); + File_class(const char* aFileName, const char* mode = "r"); /** * Destructor. */ - ~File(); + ~File_class(); /** * Opens/creates the file. If open() fails then 'errno' and perror() @@ -198,9 +197,9 @@ private: char m_fileName[MAX_FILE_NAME_SIZE]; const char* m_fileMode; /* Prohibit */ - File(const File& aCopy); - File operator = (const File&); - bool operator == (const File&); + File_class (const File_class& aCopy); + File_class operator = (const File_class&); + bool operator == (const File_class&); }; #endif diff --git a/ndb/include/util/InputStream.hpp b/ndb/include/util/InputStream.hpp index 6b4cf262db4..b2a56b1e433 100644 --- a/ndb/include/util/InputStream.hpp +++ b/ndb/include/util/InputStream.hpp @@ -17,7 +17,7 @@ #ifndef INPUT_STREAM_HPP #define INPUT_STREAM_HPP -#include +#include #include /** diff --git a/ndb/include/util/NdbAutoPtr.hpp b/ndb/include/util/NdbAutoPtr.hpp index 2078714d98d..c01650ffc7e 100644 --- a/ndb/include/util/NdbAutoPtr.hpp +++ b/ndb/include/util/NdbAutoPtr.hpp @@ -17,7 +17,7 @@ #ifndef __NDB_AUTO_PTR_HPP #define __NDB_AUTO_PTR_HPP -#include +#include template class NdbAutoPtr { diff --git a/ndb/include/util/NdbString.h b/ndb/include/util/NdbString.h deleted file mode 100644 index 97646f813ac..00000000000 --- a/ndb/include/util/NdbString.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 */ - -#ifndef __NDBSTRING_H_INCLUDED__ -#define __NDBSTRING_H_INCLUDED__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HAVE_STRDUP -extern char * strdup(const char *s); -#endif - -#ifndef HAVE_STRLCPY -extern size_t strlcpy (char *dst, const char *src, size_t dst_sz); -#endif - -#ifndef HAVE_STRLCAT -extern size_t strlcat (char *dst, const char *src, size_t dst_sz); -#endif - -#ifndef HAVE_STRCASECMP -extern int strcasecmp(const char *s1, const char *s2); -extern int strncasecmp(const char *s1, const char *s2, size_t n); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !__NDBSTRING_H_INCLUDED__ */ diff --git a/ndb/include/util/OutputStream.hpp b/ndb/include/util/OutputStream.hpp index 9d33ead7eb9..c7e009d4537 100644 --- a/ndb/include/util/OutputStream.hpp +++ b/ndb/include/util/OutputStream.hpp @@ -17,7 +17,7 @@ #ifndef OUTPUT_STREAM_HPP #define OUTPUT_STREAM_HPP -#include +#include #include /** diff --git a/ndb/include/util/Properties.hpp b/ndb/include/util/Properties.hpp index dbdc5f2b480..ff5d1338c79 100644 --- a/ndb/include/util/Properties.hpp +++ b/ndb/include/util/Properties.hpp @@ -17,10 +17,7 @@ #ifndef PROPERTIES_HPP #define PROPERTIES_HPP -#include -#include -#include -#include +#include #include #include diff --git a/ndb/include/util/SimpleProperties.hpp b/ndb/include/util/SimpleProperties.hpp index 37e28ea91d8..d5ebb16bb09 100644 --- a/ndb/include/util/SimpleProperties.hpp +++ b/ndb/include/util/SimpleProperties.hpp @@ -17,8 +17,7 @@ #ifndef SIMPLE_PROPERTIES_HPP #define SIMPLE_PROPERTIES_HPP -#include -#include // offsetof +#include #include /** diff --git a/ndb/include/util/UtilBuffer.hpp b/ndb/include/util/UtilBuffer.hpp index 97821ee3f9b..b357fa0fdf2 100644 --- a/ndb/include/util/UtilBuffer.hpp +++ b/ndb/include/util/UtilBuffer.hpp @@ -17,9 +17,7 @@ #ifndef __BUFFER_HPP_INCLUDED__ #define __BUFFER_HPP_INCLUDED__ -#include -#include -#include +#include /* This class represents a buffer of binary data, where you can append * data at the end, and later read the entire bunch. diff --git a/ndb/include/util/Vector.hpp b/ndb/include/util/Vector.hpp index a717dfecd7e..f60817dab67 100644 --- a/ndb/include/util/Vector.hpp +++ b/ndb/include/util/Vector.hpp @@ -17,9 +17,8 @@ #ifndef NDB_VECTOR_HPP #define NDB_VECTOR_HPP -#include +#include #include -#include template struct Vector { diff --git a/ndb/include/util/getarg.h b/ndb/include/util/getarg.h index 713cf6e4b32..03ed25f6828 100644 --- a/ndb/include/util/getarg.h +++ b/ndb/include/util/getarg.h @@ -52,7 +52,7 @@ #ifndef __GETARG_H__ #define __GETARG_H__ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/ndb/include/util/socket_io.h b/ndb/include/util/socket_io.h index bbd1bf115ae..a0e6c4e369d 100644 --- a/ndb/include/util/socket_io.h +++ b/ndb/include/util/socket_io.h @@ -17,8 +17,9 @@ #ifndef _SOCKET_IO_H #define _SOCKET_IO_H +#include + #include -#include #ifdef __cplusplus extern "C" { diff --git a/ndb/include/util/uucode.h b/ndb/include/util/uucode.h index 138a79fa3ae..f5569d033a5 100644 --- a/ndb/include/util/uucode.h +++ b/ndb/include/util/uucode.h @@ -17,7 +17,7 @@ #ifndef UUCODE_H #define UUCODE_H -#include +#include #ifdef __cplusplus extern "C" { diff --git a/ndb/src/client/odbc/common/Ctx.cpp b/ndb/src/client/odbc/common/Ctx.cpp index 85edbd1a63f..44689657788 100644 --- a/ndb/src/client/odbc/common/Ctx.cpp +++ b/ndb/src/client/odbc/common/Ctx.cpp @@ -14,11 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include +#include #include #include #include "DiagArea.hpp" diff --git a/ndb/src/client/odbc/common/DataField.cpp b/ndb/src/client/odbc/common/DataField.cpp index 5853f90c08f..dfd4137ffd9 100644 --- a/ndb/src/client/odbc/common/DataField.cpp +++ b/ndb/src/client/odbc/common/DataField.cpp @@ -14,14 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include +#include #include "DataField.hpp" -#include #ifndef INT_MAX #define INT_MAX (2147483647) diff --git a/ndb/src/client/odbc/common/DataType.cpp b/ndb/src/client/odbc/common/DataType.cpp index 62bd622b9b5..9c9629f1d24 100644 --- a/ndb/src/client/odbc/common/DataType.cpp +++ b/ndb/src/client/odbc/common/DataType.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "DataType.hpp" -#include // SqlType diff --git a/ndb/src/client/odbc/common/OdbcData.cpp b/ndb/src/client/odbc/common/OdbcData.cpp index d2402c7e0ab..2e1bd768aec 100644 --- a/ndb/src/client/odbc/common/OdbcData.cpp +++ b/ndb/src/client/odbc/common/OdbcData.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include #include "OdbcData.hpp" OdbcData::OdbcData() : diff --git a/ndb/src/common/debugger/DebuggerNames.cpp b/ndb/src/common/debugger/DebuggerNames.cpp index fdee978ab54..ebe94a6059f 100644 --- a/ndb/src/common/debugger/DebuggerNames.cpp +++ b/ndb/src/common/debugger/DebuggerNames.cpp @@ -14,16 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "DebuggerNames.hpp" #include #include #include -#include -#include -#include - static const char * localSignalNames[MAX_GSN+1]; static SignalDataPrintFunction localPrintFunctions[MAX_GSN+1]; static const char * localBlockNames[NO_OF_BLOCKS]; diff --git a/ndb/src/common/debugger/EventLogger.cpp b/ndb/src/common/debugger/EventLogger.cpp index 12f01890c54..dd957d67383 100644 --- a/ndb/src/common/debugger/EventLogger.cpp +++ b/ndb/src/common/debugger/EventLogger.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "EventLogger.hpp" #include @@ -22,10 +24,6 @@ #include #include #include -#include - -#include -#include // // PUBLIC diff --git a/ndb/src/common/debugger/SignalLoggerManager.cpp b/ndb/src/common/debugger/SignalLoggerManager.cpp index ae6edd5ed71..3839a348222 100644 --- a/ndb/src/common/debugger/SignalLoggerManager.cpp +++ b/ndb/src/common/debugger/SignalLoggerManager.cpp @@ -14,15 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SignalLoggerManager.hpp" #include -#include -#include -#include -#include -#include - #include SignalLoggerManager::SignalLoggerManager() diff --git a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp index 11ee0948c17..84410a2b2db 100644 --- a/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp +++ b/ndb/src/common/debugger/signaldata/CloseComReqConf.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/ndb/src/common/debugger/signaldata/ContinueB.cpp b/ndb/src/common/debugger/signaldata/ContinueB.cpp index 054909d961e..1be6da86cb1 100644 --- a/ndb/src/common/debugger/signaldata/ContinueB.cpp +++ b/ndb/src/common/debugger/signaldata/ContinueB.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp index 6685345f17a..027f743b5ea 100644 --- a/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp +++ b/ndb/src/common/debugger/signaldata/CreateFragmentation.cpp @@ -26,7 +26,7 @@ printCREATE_FRAGMENTATION_REQ(FILE * output, const Uint32 * theData, fprintf(output, " noOfFragments: %x\n", sig->noOfFragments); fprintf(output, " fragmentNode: %x\n", sig->fragmentNode); if (sig->primaryTableId == RNIL) - fprintf(output, " primaryTableId: none\n", sig->primaryTableId); + fprintf(output, " primaryTableId: none\n"); else fprintf(output, " primaryTableId: %x\n", sig->primaryTableId); return true; diff --git a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp index f3b4b97f0fd..2e900de8f70 100644 --- a/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp +++ b/ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/ndb/src/common/debugger/signaldata/SystemError.cpp b/ndb/src/common/debugger/signaldata/SystemError.cpp index 5ed7dc6b18d..549c34710a0 100644 --- a/ndb/src/common/debugger/signaldata/SystemError.cpp +++ b/ndb/src/common/debugger/signaldata/SystemError.cpp @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include diff --git a/ndb/src/common/editline/editline.c b/ndb/src/common/editline/editline.c index 0529d18b952..1e4c1ecba76 100644 --- a/ndb/src/common/editline/editline.c +++ b/ndb/src/common/editline/editline.c @@ -19,10 +19,10 @@ ** ** Main editing routines for editline library. */ +#include + #include "editline_internal.h" #include -#include -#include /* ** Manifest constants. diff --git a/ndb/src/common/editline/editline_internal.h b/ndb/src/common/editline/editline_internal.h index 93c13e55edc..5ed2b32a873 100644 --- a/ndb/src/common/editline/editline_internal.h +++ b/ndb/src/common/editline/editline_internal.h @@ -19,9 +19,8 @@ ** Internal header file for editline library. */ -#include -#include -#include +#include + #if defined(SYS_UNIX) #include "unix.h" #endif /* defined(SYS_UNIX) */ diff --git a/ndb/src/common/editline/editline_win32.c b/ndb/src/common/editline/editline_win32.c index feef0108523..5083edb7fae 100644 --- a/ndb/src/common/editline/editline_win32.c +++ b/ndb/src/common/editline/editline_win32.c @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include char* readline(const char* prompt) diff --git a/ndb/src/common/editline/test/testit.c b/ndb/src/common/editline/test/testit.c index 9a7dfb7bbdf..4058f8ae660 100644 --- a/ndb/src/common/editline/test/testit.c +++ b/ndb/src/common/editline/test/testit.c @@ -20,11 +20,7 @@ ** A "micro-shell" to test editline library. ** If given any arguments, commands aren't executed. */ -#include -#include -#include - -#include +#include #include int diff --git a/ndb/src/common/logger/FileLogHandler.cpp b/ndb/src/common/logger/FileLogHandler.cpp index f3d547b4fe7..d13dd7b2a78 100644 --- a/ndb/src/common/logger/FileLogHandler.cpp +++ b/ndb/src/common/logger/FileLogHandler.cpp @@ -14,16 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "FileLogHandler.hpp" +#include #include -#include -#include - -#include -#include - // // PUBLIC // @@ -35,7 +29,7 @@ FileLogHandler::FileLogHandler() : m_maxLogEntries(MAX_LOG_ENTRIES) { - m_pLogFile = new File("logger.log", "a+"); + m_pLogFile = new File_class("logger.log", "a+"); } FileLogHandler::FileLogHandler(const char* aFileName, @@ -47,7 +41,7 @@ FileLogHandler::FileLogHandler(const char* aFileName, m_maxFileSize(maxFileSize), m_maxLogEntries(maxLogEntries) { - m_pLogFile = new File(aFileName, "a+"); + m_pLogFile = new File_class(aFileName, "a+"); } FileLogHandler::~FileLogHandler() @@ -166,10 +160,10 @@ FileLogHandler::createNewFile() ::snprintf(newName, sizeof(newName), "%s.%d", m_pLogFile->getName(), fileNo++); - } while (File::exists(newName)); + } while (File_class::exists(newName)); m_pLogFile->close(); - if (!File::rename(m_pLogFile->getName(), newName)) + if (!File_class::rename(m_pLogFile->getName(), newName)) { setErrorCode(errno); rc = false; @@ -201,7 +195,7 @@ FileLogHandler::setFilename(const BaseString &filename) { close(); if(m_pLogFile) delete m_pLogFile; - m_pLogFile = new File(filename.c_str(), "a+"); + m_pLogFile = new File_class(filename.c_str(), "a+"); open(); return true; }; diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp index d1445555e87..83d479c82fd 100644 --- a/ndb/src/common/logger/LogHandler.cpp +++ b/ndb/src/common/logger/LogHandler.cpp @@ -17,9 +17,6 @@ #include "LogHandler.hpp" #include -#include - -#include // // PUBLIC diff --git a/ndb/src/common/logger/LogHandlerList.cpp b/ndb/src/common/logger/LogHandlerList.cpp index f020ad23e56..62495d7566b 100644 --- a/ndb/src/common/logger/LogHandlerList.cpp +++ b/ndb/src/common/logger/LogHandlerList.cpp @@ -17,8 +17,6 @@ #include "LogHandlerList.hpp" #include -#include -#include // // PUBLIC diff --git a/ndb/src/common/logger/Logger.cpp b/ndb/src/common/logger/Logger.cpp index 6eaafd91854..9c9f1eece18 100644 --- a/ndb/src/common/logger/Logger.cpp +++ b/ndb/src/common/logger/Logger.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include "Logger.hpp" @@ -27,12 +27,6 @@ #include #endif -#include -#include -#include - -#include - // // PUBLIC // diff --git a/ndb/src/common/logger/SysLogHandler.cpp b/ndb/src/common/logger/SysLogHandler.cpp index f3511bf5638..a300c487eb9 100644 --- a/ndb/src/common/logger/SysLogHandler.cpp +++ b/ndb/src/common/logger/SysLogHandler.cpp @@ -17,7 +17,6 @@ #include "SysLogHandler.hpp" #include -#include // // PUBLIC diff --git a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp index 22f67d15659..44ee11717b4 100644 --- a/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp +++ b/ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "LogHandlerListUnitTest.hpp" #include @@ -22,9 +24,6 @@ #include -#include -#include - typedef bool (*TESTFUNC)(const char*); typedef struct { diff --git a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp index 4b0241a0b03..017dcb79c1f 100644 --- a/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp +++ b/ndb/src/common/logger/loggertest/LoggerUnitTest.cpp @@ -25,12 +25,8 @@ #endif #include -#include #include -#include -#include - typedef bool (*TESTFUNC)(const char*); typedef struct { diff --git a/ndb/src/common/mgmcommon/Config.hpp b/ndb/src/common/mgmcommon/Config.hpp index 1314abe004a..284256d9ed6 100644 --- a/ndb/src/common/mgmcommon/Config.hpp +++ b/ndb/src/common/mgmcommon/Config.hpp @@ -23,9 +23,7 @@ #include #include -#include #include -#include #include /** diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index a3f26454df6..04dc5466bbc 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -14,6 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include + #include #include "LocalConfig.hpp" @@ -21,21 +24,15 @@ #include #include -#include -#include #include #include "MgmtErrorReporter.hpp" #include #include -#include -#include -#include #include #include -#include //**************************************************************************** //**************************************************************************** diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp index 33652fa472c..62c4bd28857 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp @@ -14,16 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "InitConfigFileParser.hpp" -#include -#include #include "Config.hpp" #include "MgmtErrorReporter.hpp" #include #include "ConfigInfo.hpp" -#include -#include -#include const int MAX_LINE_LENGTH = 120; // Max length of line of text in config file static void trim(char *); diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp index 1e85067396c..f4f27abb055 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.hpp @@ -17,7 +17,8 @@ #ifndef InitConfigFileParser_H #define InitConfigFileParser_H -#include +#include + #include class Config; diff --git a/ndb/src/common/mgmcommon/LocalConfig.hpp b/ndb/src/common/mgmcommon/LocalConfig.hpp index ec7b572e92d..eb676bf9bed 100644 --- a/ndb/src/common/mgmcommon/LocalConfig.hpp +++ b/ndb/src/common/mgmcommon/LocalConfig.hpp @@ -17,10 +17,8 @@ #ifndef LocalConfig_H #define LocalConfig_H -#include -#include +#include #include -#include //**************************************************************************** // Description: The class LocalConfig corresponds to the information possible diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/mgmcommon/NdbConfig.c index b12d9fcfaf9..827ef34a840 100644 --- a/ndb/src/common/mgmcommon/NdbConfig.c +++ b/ndb/src/common/mgmcommon/NdbConfig.c @@ -14,10 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include -#include -#include const char* NdbConfig_HomePath(char* buf, int buflen){ diff --git a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp index 7260a84ce7a..daa287cc44d 100644 --- a/ndb/src/common/mgmcommon/printConfig/printConfig.cpp +++ b/ndb/src/common/mgmcommon/printConfig/printConfig.cpp @@ -15,10 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include #include -#include #include void usage(const char * prg){ diff --git a/ndb/src/common/portlib/memtest/memtest.c b/ndb/src/common/portlib/memtest/memtest.c index d23235b7aa2..fb525c2f19f 100644 --- a/ndb/src/common/portlib/memtest/memtest.c +++ b/ndb/src/common/portlib/memtest/memtest.c @@ -16,8 +16,7 @@ -#include -#include +#include #include #include long long getMilli(); diff --git a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp index 9e396cd98ee..b1d84131810 100644 --- a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp +++ b/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp @@ -17,6 +17,8 @@ +#include + #include #include #include @@ -27,13 +29,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include - struct ThreadData { diff --git a/ndb/src/common/portlib/mmstest/mmslist.cpp b/ndb/src/common/portlib/mmstest/mmslist.cpp index bd00211445c..05538785293 100644 --- a/ndb/src/common/portlib/mmstest/mmslist.cpp +++ b/ndb/src/common/portlib/mmstest/mmslist.cpp @@ -14,14 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include #include #include #include -#include -#include #include /** diff --git a/ndb/src/common/portlib/mmstest/mmstest.cpp b/ndb/src/common/portlib/mmstest/mmstest.cpp index 6ebb5064aaf..9cc7d810985 100644 --- a/ndb/src/common/portlib/mmstest/mmstest.cpp +++ b/ndb/src/common/portlib/mmstest/mmstest.cpp @@ -14,13 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include "NdbThread.h" #include #include -#include - NDB_COMMAND(ndbmem, "ndbmem", "ndbmem", "Test the ndbmem functionality", 4096){ ndbout << "Starting test of NdbMem" << endl; diff --git a/ndb/src/common/portlib/ose/NdbCondition.c b/ndb/src/common/portlib/ose/NdbCondition.c index 2ab6e49006b..73a2dbc5d66 100644 --- a/ndb/src/common/portlib/ose/NdbCondition.c +++ b/ndb/src/common/portlib/ose/NdbCondition.c @@ -17,7 +17,6 @@ #include "NdbCondition.h" #include -#include #include #include diff --git a/ndb/src/common/portlib/ose/NdbMem.c b/ndb/src/common/portlib/ose/NdbMem.c index 6d922e4c073..0e38024bbb4 100644 --- a/ndb/src/common/portlib/ose/NdbMem.c +++ b/ndb/src/common/portlib/ose/NdbMem.c @@ -17,7 +17,6 @@ #include "NdbMem.h" -#include #if defined NDB_OSE #include @@ -134,7 +133,6 @@ int NdbMem_MemUnlockAll(){ } #else -#include #include diff --git a/ndb/src/common/portlib/ose/NdbMutex.c b/ndb/src/common/portlib/ose/NdbMutex.c index 859ddefd536..253c0e412ff 100644 --- a/ndb/src/common/portlib/ose/NdbMutex.c +++ b/ndb/src/common/portlib/ose/NdbMutex.c @@ -19,7 +19,6 @@ #include #include -#include NdbMutex* NdbMutex_Create(void) diff --git a/ndb/src/common/portlib/ose/NdbOut.cpp b/ndb/src/common/portlib/ose/NdbOut.cpp index 0ee12249ff5..eb81bc9d971 100644 --- a/ndb/src/common/portlib/ose/NdbOut.cpp +++ b/ndb/src/common/portlib/ose/NdbOut.cpp @@ -14,12 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbOut.hpp" -#include -#include -#include -#include +#include +#include "NdbOut.hpp" #if defined NDB_SOFTOSE #include diff --git a/ndb/src/common/portlib/ose/NdbThread.c b/ndb/src/common/portlib/ose/NdbThread.c index 41a5f181c40..e46903a5cce 100644 --- a/ndb/src/common/portlib/ose/NdbThread.c +++ b/ndb/src/common/portlib/ose/NdbThread.c @@ -18,7 +18,6 @@ #include "NdbThread.h" #include #include -#include #include #include diff --git a/ndb/src/common/portlib/test/NdbPortLibTest.cpp b/ndb/src/common/portlib/test/NdbPortLibTest.cpp index 8a5c8f4a878..55b9ccec5f2 100644 --- a/ndb/src/common/portlib/test/NdbPortLibTest.cpp +++ b/ndb/src/common/portlib/test/NdbPortLibTest.cpp @@ -20,7 +20,7 @@ * TODO - Add tests for NdbMem */ - +#include #include "NdbOut.hpp" #include "NdbThread.h" @@ -32,11 +32,6 @@ #include "NdbHost.h" #include "NdbMain.h" -#include -#include -#include -#include - int TestHasFailed; int verbose = 0; diff --git a/ndb/src/common/portlib/unix/NdbCondition.c b/ndb/src/common/portlib/unix/NdbCondition.c index 35b80821052..1d229bdcdef 100644 --- a/ndb/src/common/portlib/unix/NdbCondition.c +++ b/ndb/src/common/portlib/unix/NdbCondition.c @@ -15,16 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#if defined NDB_MACOSX -#include -#else -#include -#endif +#include +#include +#include #include struct NdbCondition @@ -67,8 +61,6 @@ NdbCondition_Wait(struct NdbCondition* p_cond, return result; } -#if defined NDB_SOLARIS || defined NDB_HPUX -#include int NdbCondition_WaitTimeout(struct NdbCondition* p_cond, NdbMutex* p_mutex, @@ -80,7 +72,16 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, if (p_cond == NULL || p_mutex == NULL) return 1; +#ifdef HAVE_CLOCK_GETTIME clock_gettime(CLOCK_REALTIME, &abstime); +#else + { + struct timeval tick_time; + gettimeofday(&tick_time, 0); + abstime.tv_sec = tick_time.tv_sec; + abstime.tv_nsec = tick_time.tv_usec * 1000; + } +#endif if(msecs >= 1000){ secs = msecs / 1000; @@ -98,45 +99,6 @@ NdbCondition_WaitTimeout(struct NdbCondition* p_cond, return result; } -#endif - -#if defined NDB_LINUX || defined NDB_MACOSX -#include -#include - -int -NdbCondition_WaitTimeout(struct NdbCondition* p_cond, - NdbMutex* p_mutex, - int msecs){ - int result; - struct timespec abstime; - struct timeval tick_time; - int secs = 0; - - if (p_cond == NULL || p_mutex == NULL) - return 1; - - gettimeofday(&tick_time, 0); - - if(msecs >= 1000){ - secs = msecs / 1000; - msecs = msecs % 1000; - } - - - abstime.tv_sec = tick_time.tv_sec + secs; - abstime.tv_nsec = tick_time.tv_usec * 1000 + msecs * 1000000; - if (abstime.tv_nsec >= 1000000000) { - abstime.tv_sec += 1; - abstime.tv_nsec -= 1000000000; - } - - result = pthread_cond_timedwait(&p_cond->cond, p_mutex, &abstime); - - return result; -} -#endif - int NdbCondition_Signal(struct NdbCondition* p_cond){ diff --git a/ndb/src/common/portlib/unix/NdbDaemon.c b/ndb/src/common/portlib/unix/NdbDaemon.c index fc114266c9d..6eb319e1fcf 100644 --- a/ndb/src/common/portlib/unix/NdbDaemon.c +++ b/ndb/src/common/portlib/unix/NdbDaemon.c @@ -14,40 +14,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NdbDaemon.h" -#include - -#ifdef NDB_LINUX -#include -#include -#include -#include -#include -#include -#include -#endif - -#ifdef NDB_SOLARIS -#include -#include -#include -#include -#include -#include -#include -#endif #define NdbDaemon_ErrorSize 500 #if defined(NDB_LINUX) || defined(NDB_SOLARIS) + /* XXX fix other unixes */ long NdbDaemon_DaemonPid; int NdbDaemon_ErrorCode; char NdbDaemon_ErrorText[NdbDaemon_ErrorSize]; -#endif int NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) { - /* XXX fix other unixes */ -#if defined(NDB_LINUX) || defined(NDB_SOLARIS) int lockfd = -1, logfd = -1, n; char buf[64]; @@ -149,10 +127,19 @@ NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) dup2(logfd, 2); close(logfd); } -#endif /* Success */ return 0; } +#else +int +NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags) +{ + /* Fail */ + snprintf(NdbDaemon_ErrorText, NdbDaemon_ErrorSize, + "Daemon mode not implemented"); + return -1; +} +#endif #ifdef NDB_DAEMON_TEST diff --git a/ndb/src/common/portlib/unix/NdbEnv.c b/ndb/src/common/portlib/unix/NdbEnv.c index b01e3b239ca..d294e0b52ca 100644 --- a/ndb/src/common/portlib/unix/NdbEnv.c +++ b/ndb/src/common/portlib/unix/NdbEnv.c @@ -15,9 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbEnv.h" -#include -#include +#include + +#include const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen) { diff --git a/ndb/src/common/portlib/unix/NdbHost.c b/ndb/src/common/portlib/unix/NdbHost.c index 8d2a23fccda..4749bb39ea7 100644 --- a/ndb/src/common/portlib/unix/NdbHost.c +++ b/ndb/src/common/portlib/unix/NdbHost.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NdbHost.h" -#include int NdbHost_GetHostName(char* buf) { diff --git a/ndb/src/common/portlib/unix/NdbMem.c b/ndb/src/common/portlib/unix/NdbMem.c index 3b47494967f..ce422f45a9d 100644 --- a/ndb/src/common/portlib/unix/NdbMem.c +++ b/ndb/src/common/portlib/unix/NdbMem.c @@ -15,14 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbMem.h" +#include -#include -#include -#include -#ifndef NDB_MACOSX -#include -#endif +#include void NdbMem_Create() { @@ -59,17 +54,16 @@ void NdbMem_Free(void* ptr) int NdbMem_MemLockAll(){ -#if defined NDB_MACOSX - return 0; +#ifndef HAVE_MLOCKALL + return -1; #else - //return mlockall(MCL_CURRENT | MCL_FUTURE); return mlockall(MCL_CURRENT); #endif } int NdbMem_MemUnlockAll(){ -#if defined NDB_MACOSX - return 0; +#ifndef HAVE_MLOCKALL + return -1; #else return munlockall(); #endif diff --git a/ndb/src/common/portlib/unix/NdbMutex.c b/ndb/src/common/portlib/unix/NdbMutex.c index 3cadc0667e7..50f314d2683 100644 --- a/ndb/src/common/portlib/unix/NdbMutex.c +++ b/ndb/src/common/portlib/unix/NdbMutex.c @@ -15,11 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbMutex.h" +#include -#include -#include -#include +#include +#include NdbMutex* NdbMutex_Create(void) { diff --git a/ndb/src/common/portlib/unix/NdbSleep.c b/ndb/src/common/portlib/unix/NdbSleep.c index 35132d7f9c7..8702a25d1b1 100644 --- a/ndb/src/common/portlib/unix/NdbSleep.c +++ b/ndb/src/common/portlib/unix/NdbSleep.c @@ -15,19 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NdbSleep.h" - -#ifdef NDB_SOLARIS -#include -#include -#endif - -#if defined NDB_LINUX || defined NDB_HPUX || defined NDB_MACOSX -#include -#include -#endif - int NdbSleep_MilliSleep(int milliseconds){ int result = 0; diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/unix/NdbThread.c index 3665c4c9159..7f043bef56e 100644 --- a/ndb/src/common/portlib/unix/NdbThread.c +++ b/ndb/src/common/portlib/unix/NdbThread.c @@ -15,16 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbThread.h" -#include -#ifdef NDB_MACOSX -#include -#else -#include -#endif -#include -#include -#include +#include +#include +#include #define MAX_THREAD_NAME 16 @@ -94,7 +87,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status) if (p_wait_thread == NULL) return 0; - if (p_wait_thread->thread == NULL) + if (p_wait_thread->thread == 0) return 0; result = pthread_join(p_wait_thread->thread, status); diff --git a/ndb/src/common/portlib/unix/NdbTick.c b/ndb/src/common/portlib/unix/NdbTick.c index 5adb4ec80c2..d8f0b6ec27a 100644 --- a/ndb/src/common/portlib/unix/NdbTick.c +++ b/ndb/src/common/portlib/unix/NdbTick.c @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NdbTick.h" -#include #define NANOSEC_PER_SEC 1000000000 #define MICROSEC_PER_SEC 1000000 @@ -25,7 +25,7 @@ #define MILLISEC_PER_NANOSEC 1000000 -#if defined NDB_SOLARIS || NDB_HPUX +#ifdef HAVE_CLOCK_GETTIME NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timespec tick_time; @@ -44,11 +44,7 @@ NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros){ * micros = t.tv_nsec / 1000; return res; } -#endif - -#if defined NDB_LINUX || NDB_MACOSX -#include -#include +#else NDB_TICKS NdbTick_CurrentMillisecond(void) { struct timeval tick_time; @@ -99,12 +95,12 @@ NdbTick_getMicrosPassed(struct MicroSecondTimer start, ret_value = ((NDB_TICKS)MICROSEC_PER_SEC) * sec_passed; } else if (start.seconds > stop.seconds) { return ret_value; - }//if + } if (start.micro_seconds < stop.micro_seconds) { ret_value += (stop.micro_seconds - start.micro_seconds); } else if (ret_value != (NDB_TICKS)0) { ret_value -= (start.micro_seconds - stop.micro_seconds); - }//if + } return ret_value; } #endif diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/win32/NdbCondition.c index 12b508cf33b..77869b673de 100644 --- a/ndb/src/common/portlib/win32/NdbCondition.c +++ b/ndb/src/common/portlib/win32/NdbCondition.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "NdbCondition.h" diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/win32/NdbMem.c index 274dc31353f..ab7123b0a29 100644 --- a/ndb/src/common/portlib/win32/NdbMem.c +++ b/ndb/src/common/portlib/win32/NdbMem.c @@ -16,8 +16,6 @@ #include -#include -#include #include "NdbMem.h" diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/win32/NdbMutex.c index c93384d91db..e797024d5bb 100644 --- a/ndb/src/common/portlib/win32/NdbMutex.c +++ b/ndb/src/common/portlib/win32/NdbMutex.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "NdbMutex.h" diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/win32/NdbThread.c index ae3c74be70d..1f052f034e8 100644 --- a/ndb/src/common/portlib/win32/NdbThread.c +++ b/ndb/src/common/portlib/win32/NdbThread.c @@ -17,7 +17,6 @@ #include #include -#include #include "NdbThread.h" diff --git a/ndb/src/common/transporter/Makefile b/ndb/src/common/transporter/Makefile index 3bd23b627d3..372bf640566 100644 --- a/ndb/src/common/transporter/Makefile +++ b/ndb/src/common/transporter/Makefile @@ -10,7 +10,6 @@ DIRS := basictest perftest SOURCES = \ Transporter.cpp \ SendBuffer.cpp \ - SHM_Transporter.cpp \ TCP_Transporter.cpp \ TransporterRegistry.cpp \ Packer.cpp @@ -20,37 +19,19 @@ DIRS := basictest perftest CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/kernel) \ -I$(call fixpath,$(NDB_TOP)/include/transporter) + +ifeq ($(NDB_SHM), Y) +SOURCES += SHM_Transporter.cpp ifeq ($(NDB_OS), WIN32) SOURCES += SHM_Transporter.win32.cpp -endif - -ifeq ($(NDB_OS), SOLARIS) +else SOURCES += SHM_Transporter.unix.cpp endif - -ifeq ($(NDB_OS), HPUX) -SOURCES += SHM_Transporter.unix.cpp endif -ifeq ($(NDB_OS), MACOSX) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), IBMAIX) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), TRU64X) -SOURCES += SHM_Transporter.unix.cpp -endif - -ifeq ($(NDB_OS), LINUX) -SOURCES += SHM_Transporter.unix.cpp ifeq ($(NDB_SCI), Y) SOURCES += SCI_Transporter.cpp endif -endif - ifneq ($(findstring OSE, $(NDB_OS)),) SOURCES += OSE_Transporter.cpp diff --git a/ndb/src/common/transporter/OSE_Receiver.cpp b/ndb/src/common/transporter/OSE_Receiver.cpp index 558dee92d8d..b7d47b2f88c 100644 --- a/ndb/src/common/transporter/OSE_Receiver.cpp +++ b/ndb/src/common/transporter/OSE_Receiver.cpp @@ -20,7 +20,6 @@ #include "TransporterCallback.hpp" #include #include "TransporterInternalDefinitions.hpp" -#include OSE_Receiver::OSE_Receiver(TransporterRegistry * tr, int _recBufSize, diff --git a/ndb/src/common/transporter/OSE_Transporter.cpp b/ndb/src/common/transporter/OSE_Transporter.cpp index a7a5ed81ce2..c9b0f777319 100644 --- a/ndb/src/common/transporter/OSE_Transporter.cpp +++ b/ndb/src/common/transporter/OSE_Transporter.cpp @@ -23,11 +23,9 @@ #include -#include #include #include #include -#include OSE_Transporter::OSE_Transporter(int _prioASignalSize, int _prioBSignalSize, diff --git a/ndb/src/common/transporter/Packer.cpp b/ndb/src/common/transporter/Packer.cpp index 77bd66d1ba9..fa72af12dac 100644 --- a/ndb/src/common/transporter/Packer.cpp +++ b/ndb/src/common/transporter/Packer.cpp @@ -14,13 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "Packer.hpp" #include #include #include -#include - Uint32 TransporterRegistry::unpack(Uint32 * readPtr, Uint32 sizeOfData, diff --git a/ndb/src/common/transporter/SCI_Transporter.cpp b/ndb/src/common/transporter/SCI_Transporter.cpp index 2be857e8115..c52c8a9d8c0 100644 --- a/ndb/src/common/transporter/SCI_Transporter.cpp +++ b/ndb/src/common/transporter/SCI_Transporter.cpp @@ -14,17 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SCI_Transporter.hpp" -#include #include #include #include -#include #include -#if 0 -#include -#include -#endif + #include "TransporterInternalDefinitions.hpp" #include diff --git a/ndb/src/common/transporter/SHM_Buffer.hpp b/ndb/src/common/transporter/SHM_Buffer.hpp index 43250853fee..32e59dd57a2 100644 --- a/ndb/src/common/transporter/SHM_Buffer.hpp +++ b/ndb/src/common/transporter/SHM_Buffer.hpp @@ -17,10 +17,9 @@ #ifndef SHM_BUFFER_HPP #define SHM_BUFFER_HPP -#include -#include +#include + #include -#include /** * These classes implement a circular buffer diff --git a/ndb/src/common/transporter/SHM_Transporter.cpp b/ndb/src/common/transporter/SHM_Transporter.cpp index f18b775efa4..525194db3a6 100644 --- a/ndb/src/common/transporter/SHM_Transporter.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.cpp @@ -15,15 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include #include #include -#include -#include - #ifdef NDB_WIN32 #include #else diff --git a/ndb/src/common/transporter/SHM_Transporter.unix.cpp b/ndb/src/common/transporter/SHM_Transporter.unix.cpp index 975c1191aea..afbf124432e 100644 --- a/ndb/src/common/transporter/SHM_Transporter.unix.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.unix.cpp @@ -15,15 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include #include #include -#include - - #include #include diff --git a/ndb/src/common/transporter/SHM_Transporter.win32.cpp b/ndb/src/common/transporter/SHM_Transporter.win32.cpp index 4ba52c9179d..c289a85da0e 100644 --- a/ndb/src/common/transporter/SHM_Transporter.win32.cpp +++ b/ndb/src/common/transporter/SHM_Transporter.win32.cpp @@ -15,14 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SHM_Transporter.hpp" #include "TransporterInternalDefinitions.hpp" #include #include #include -#include - #include diff --git a/ndb/src/common/transporter/SendBuffer.hpp b/ndb/src/common/transporter/SendBuffer.hpp index 75ef0708e83..63a01f3de24 100644 --- a/ndb/src/common/transporter/SendBuffer.hpp +++ b/ndb/src/common/transporter/SendBuffer.hpp @@ -33,10 +33,9 @@ #include "TransporterDefinitions.hpp" #include -#include #ifdef DEBUG_TRANSPORTER -#include +#include #endif class SendBuffer { diff --git a/ndb/src/common/transporter/TCP_Transporter.cpp b/ndb/src/common/transporter/TCP_Transporter.cpp index 8a7d1741636..99b6a137797 100644 --- a/ndb/src/common/transporter/TCP_Transporter.cpp +++ b/ndb/src/common/transporter/TCP_Transporter.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include "TCP_Transporter.hpp" #include @@ -23,13 +25,9 @@ #if defined NDB_OSE || defined NDB_SOFTOSE #define inet_send inet_send #else -#include #define inet_send send #endif -#include - - #ifdef NDB_WIN32 class ndbstrerror { diff --git a/ndb/src/common/transporter/Transporter.cpp b/ndb/src/common/transporter/Transporter.cpp index 1e19a8375ba..5ca523d5185 100644 --- a/ndb/src/common/transporter/Transporter.cpp +++ b/ndb/src/common/transporter/Transporter.cpp @@ -17,7 +17,6 @@ #include "Transporter.hpp" #include "TransporterInternalDefinitions.hpp" -#include #include Transporter::Transporter(NodeId lNodeId, NodeId rNodeId, diff --git a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp index 18d54ca1e89..624b495422f 100644 --- a/ndb/src/common/transporter/TransporterInternalDefinitions.hpp +++ b/ndb/src/common/transporter/TransporterInternalDefinitions.hpp @@ -21,39 +21,18 @@ #include #endif -#ifdef NDB_SOLARIS #define NDB_TCP_TRANSPORTER -//#define NDB_SCI_TRANSPORTER + +#ifdef HAVE_NDB_SHM #define NDB_SHM_TRANSPORTER -#elif defined NDB_OSE || defined NDB_SOFTOSE -#define NDB_TCP_TRANSPORTER -#define NDB_OSE_TRANSPORTER -#elif defined NDB_LINUX -#define NDB_TCP_TRANSPORTER -#define NDB_SCI_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_WIN32 -#define NDB_TCP_TRANSPORTER -#elif defined NDB_HPUX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_MACOSX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_IBMAIX -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#elif defined NDB_TRU64X -#define NDB_TCP_TRANSPORTER -#define NDB_SHM_TRANSPORTER -#else -#error unsupported platform #endif -#ifndef HAVE_SCI -#ifdef NDB_SCI_TRANSPORTER -#undef NDB_SCI_TRANSPORTER +#ifdef HAVE_NDB_SCI +#define NDB_SCI_TRANSPORTER #endif + +#ifdef HAVE_NDB_OSE +#define NDB_OSE_TRANSPORTER #endif #ifdef DEBUG_TRANSPORTER diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp index dcd957f40ce..3f98eeed89e 100644 --- a/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/ndb/src/common/transporter/TransporterRegistry.cpp @@ -14,14 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "TransporterRegistry.hpp" #include "TransporterInternalDefinitions.hpp" #include "Transporter.hpp" -#include -#include - #ifdef NDB_TCP_TRANSPORTER #include "TCP_Transporter.hpp" #endif diff --git a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp index 5d8186badb8..c0a437c4907 100644 --- a/ndb/src/common/transporter/basictest/basicTransporterTest.cpp +++ b/ndb/src/common/transporter/basictest/basicTransporterTest.cpp @@ -14,18 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" #include -#include -#include #include #include #include #include -#include int basePortTCP = 17000; diff --git a/ndb/src/common/transporter/buddy.cpp b/ndb/src/common/transporter/buddy.cpp index c65aad1df2c..dc25e2dc66c 100644 --- a/ndb/src/common/transporter/buddy.cpp +++ b/ndb/src/common/transporter/buddy.cpp @@ -15,9 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "buddy.hpp" -#include -#include - void Chunk256::setFree(bool free){ // Bit 0 of allocationTimeStamp represents if the segment is free or not diff --git a/ndb/src/common/transporter/buddy.hpp b/ndb/src/common/transporter/buddy.hpp index 7272ac884ec..f720e9e61a1 100644 --- a/ndb/src/common/transporter/buddy.hpp +++ b/ndb/src/common/transporter/buddy.hpp @@ -17,8 +17,7 @@ #ifndef BUDDY_H #define BUDDY_H -#include -#include +#include typedef unsigned int Uint32; typedef unsigned short Uint16; diff --git a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp index 03ce7ea6df3..803029ee565 100644 --- a/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp +++ b/ndb/src/common/transporter/failoverSCI/failoverSCI.cpp @@ -14,17 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include + #include "sisci_types.h" #include "sisci_api.h" #include "sisci_error.h" //#include "sisci_demolib.h" -#include -#include #include -#include "NdbSleep.h" +#include #define NO_CALLBACK NULL #define NO_FLAGS 0 #define DATA_TRANSFER_READY 8 diff --git a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp index 6d7f7083a48..d33221c2835 100644 --- a/ndb/src/common/transporter/perftest/perfTransporterTest.cpp +++ b/ndb/src/common/transporter/perftest/perfTransporterTest.cpp @@ -14,18 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" #include -#include -#include #include #include #include #include -#include int basePortTCP = 17000; diff --git a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp index 919cc9d7511..0fce6aaad39 100644 --- a/ndb/src/common/transporter/priotest/prioTransporterTest.cpp +++ b/ndb/src/common/transporter/priotest/prioTransporterTest.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "TransporterRegistry.hpp" #include "TransporterDefinitions.hpp" #include "TransporterCallback.hpp" @@ -21,8 +23,6 @@ #include "prioTransporterTest.hpp" -#include -#include #include #include #include diff --git a/ndb/src/common/util/Base64.cpp b/ndb/src/common/util/Base64.cpp index 5f4bbc8645a..482d0b10ad2 100644 --- a/ndb/src/common/util/Base64.cpp +++ b/ndb/src/common/util/Base64.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/ndb/src/common/util/BaseString.cpp b/ndb/src/common/util/BaseString.cpp index 1b0eaa1b83c..d15249adf72 100644 --- a/ndb/src/common/util/BaseString.cpp +++ b/ndb/src/common/util/BaseString.cpp @@ -15,11 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* -*- c-basic-offset: 4; -*- */ -#include -#include -#include -#include "BaseString.hpp" -#include +#include +#include BaseString::BaseString() { @@ -340,7 +337,6 @@ BaseString::trim(char * str, const char * delim){ #ifdef TEST_BASE_STRING -#include /* g++ -g -Wall -o tbs -DTEST_BASE_STRING -I$NDB_TOP/include/util \ diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index ad72b41835d..22d262a0d27 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -14,16 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include -#include -#include - -#if defined NDB_OSE || defined NDB_SOFTOSE -#include -#endif - #include // @@ -31,7 +25,7 @@ // bool -File::exists(const char* aFileName) +File_class::exists(const char* aFileName) { bool rc = true; @@ -56,7 +50,7 @@ File::exists(const char* aFileName) } long -File::size(FILE* f) +File_class::size(FILE* f) { long cur_pos = 0, length = 0; @@ -69,23 +63,23 @@ File::size(FILE* f) } bool -File::rename(const char* currFileName, const char* newFileName) +File_class::rename(const char* currFileName, const char* newFileName) { return ::rename(currFileName, newFileName) == 0 ? true : false; } bool -File::remove(const char* aFileName) +File_class::remove(const char* aFileName) { return ::remove(aFileName) == 0 ? true : false; } -File::File() : +File_class::File_class() : m_file(NULL), m_fileMode("r") { } -File::File(const char* aFileName, const char* mode) : +File_class::File_class(const char* aFileName, const char* mode) : m_file(NULL), m_fileMode(mode) { @@ -93,13 +87,13 @@ File::File(const char* aFileName, const char* mode) : } bool -File::open() +File_class::open() { return open(m_fileName, m_fileMode); } bool -File::open(const char* aFileName, const char* mode) +File_class::open(const char* aFileName, const char* mode) { if(m_fileName != aFileName){ /** @@ -116,21 +110,21 @@ File::open(const char* aFileName, const char* mode) return rc; } -File::~File() +File_class::~File_class() { close(); } bool -File::remove() +File_class::remove() { // Close the file first! close(); - return File::remove(m_fileName); + return File_class::remove(m_fileName); } bool -File::close() +File_class::close() { bool rc = true; if (m_file != NULL) @@ -144,55 +138,55 @@ File::close() } int -File::read(void* buf, size_t itemSize, size_t nitems) const +File_class::read(void* buf, size_t itemSize, size_t nitems) const { return ::fread(buf, itemSize, nitems, m_file); } int -File::readChar(char* buf, long start, long length) const +File_class::readChar(char* buf, long start, long length) const { return ::fread((void*)&buf[start], 1, length, m_file); } int -File::readChar(char* buf) +File_class::readChar(char* buf) { return readChar(buf, 0, strlen(buf)); } int -File::write(const void* buf, size_t size, size_t nitems) +File_class::write(const void* buf, size_t size, size_t nitems) { return ::fwrite(buf, size, nitems, m_file); } int -File::writeChar(const char* buf, long start, long length) +File_class::writeChar(const char* buf, long start, long length) { return ::fwrite((const void*)&buf[start], sizeof(char), length, m_file); } int -File::writeChar(const char* buf) +File_class::writeChar(const char* buf) { return writeChar(buf, 0, ::strlen(buf)); } long -File::size() const +File_class::size() const { - return File::size(m_file); + return File_class::size(m_file); } const char* -File::getName() const +File_class::getName() const { return m_fileName; } int -File::flush() const +File_class::flush() const { #if defined NDB_OSE || defined NDB_SOFTOSE ::fflush(m_file); diff --git a/ndb/src/common/util/InputStream.cpp b/ndb/src/common/util/InputStream.cpp index c52b594225d..410e9a70e9c 100644 --- a/ndb/src/common/util/InputStream.cpp +++ b/ndb/src/common/util/InputStream.cpp @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "InputStream.hpp" #include -#include -#include FileInputStream Stdin(stdin); diff --git a/ndb/src/common/util/Makefile b/ndb/src/common/util/Makefile index b3e33704266..e8ca2b87c20 100644 --- a/ndb/src/common/util/Makefile +++ b/ndb/src/common/util/Makefile @@ -18,15 +18,7 @@ endif ifeq ($(NDB_OS), OSE) SOURCES += NdbErrHnd.cpp endif -ifdef NDB_STRDUP - SOURCES.c += strdup.c -endif -ifdef NDB_STRLCAT - SOURCES.c += strlcat.c -endif -ifdef NDB_STRLCPY - SOURCES.c += strlcpy.c -endif + SOURCES.c += strdup.c strlcat.c strlcpy.c DIRS := testSimpleProperties diff --git a/ndb/src/common/util/NdbErrHnd.cpp b/ndb/src/common/util/NdbErrHnd.cpp index 53df5d702ca..f1c28a7bbdd 100644 --- a/ndb/src/common/util/NdbErrHnd.cpp +++ b/ndb/src/common/util/NdbErrHnd.cpp @@ -18,7 +18,6 @@ #if defined NDB_OSE || defined NDB_SOFTOSE #include -#include #include #include "ose.h" diff --git a/ndb/src/common/util/NdbOut.cpp b/ndb/src/common/util/NdbOut.cpp index 2624bfa04bd..6d76cf22402 100644 --- a/ndb/src/common/util/NdbOut.cpp +++ b/ndb/src/common/util/NdbOut.cpp @@ -14,11 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbOut.hpp" -#include -#include -#include -#include +#include + +#include #include static FileOutputStream ndbouts_fileoutputstream(stdout); diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index dba7012cc0f..e91ade374cf 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -286,7 +286,6 @@ NdbSqlUtil::cmpTimespec(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 #ifdef NDB_SQL_UTIL_TEST -#include #include #include diff --git a/ndb/src/common/util/OutputStream.cpp b/ndb/src/common/util/OutputStream.cpp index 1143fe00fd1..bf3599dbac9 100644 --- a/ndb/src/common/util/OutputStream.cpp +++ b/ndb/src/common/util/OutputStream.cpp @@ -15,8 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include #include FileOutputStream::FileOutputStream(FILE * file){ diff --git a/ndb/src/common/util/Parser.cpp b/ndb/src/common/util/Parser.cpp index d5c23fe14c1..2e8120f88ce 100644 --- a/ndb/src/common/util/Parser.cpp +++ b/ndb/src/common/util/Parser.cpp @@ -15,14 +15,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "Parser.hpp" -#include #include -#include #include -#include #include +#undef DEBUG #define DEBUG(x) ndbout << x << endl; static void trim(char * str); diff --git a/ndb/src/common/util/Properties.cpp b/ndb/src/common/util/Properties.cpp index 4841d6e5e9e..2ab008142ba 100644 --- a/ndb/src/common/util/Properties.cpp +++ b/ndb/src/common/util/Properties.cpp @@ -14,14 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include -#include -#include -#include -#include - #include /** diff --git a/ndb/src/common/util/SimpleProperties.cpp b/ndb/src/common/util/SimpleProperties.cpp index a118478ba6c..c3980f03c4d 100644 --- a/ndb/src/common/util/SimpleProperties.cpp +++ b/ndb/src/common/util/SimpleProperties.cpp @@ -14,12 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include -#include -#include #include #include -#include #include bool diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp index 39f46eceed9..a0ec0aaa676 100644 --- a/ndb/src/common/util/SocketServer.cpp +++ b/ndb/src/common/util/SocketServer.cpp @@ -15,17 +15,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SocketServer.hpp" #include -#include #include #include #include -#include -#include - #define DEBUG(x) ndbout << x << endl; SocketServer::SocketServer(int maxSessions) : diff --git a/ndb/src/common/util/filetest/FileUnitTest.cpp b/ndb/src/common/util/filetest/FileUnitTest.cpp index ebcca26d3d2..b6e7b7e8ec0 100644 --- a/ndb/src/common/util/filetest/FileUnitTest.cpp +++ b/ndb/src/common/util/filetest/FileUnitTest.cpp @@ -18,7 +18,6 @@ #include #include -#include typedef bool (*TESTFUNC)(const char*); diff --git a/ndb/src/common/util/getarg.c b/ndb/src/common/util/getarg.c index 5f792437a65..ae016746987 100644 --- a/ndb/src/common/util/getarg.c +++ b/ndb/src/common/util/getarg.c @@ -32,18 +32,8 @@ * SUCH DAMAGE. */ -#include +#include -#ifdef HAVE_CONFIG_H -#include -RCSID("$KTH: getarg.c,v 1.23 2000/09/01 21:25:54 lha Exp $"); -#endif - -#include -#include -#include -#include -#include #include "getarg.h" #define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag) @@ -407,12 +397,12 @@ arg_match_long(struct getargs *args, size_t num_args, } case arg_string: { - *(char**)current->value = optarg + 1; + *(char**)current->value = (char*)optarg + 1; return 0; } case arg_strings: { - add_string((getarg_strings*)current->value, optarg + 1); + add_string((getarg_strings*)current->value, (char*)optarg + 1); return 0; } case arg_flag: diff --git a/ndb/src/common/util/new.cpp b/ndb/src/common/util/new.cpp index a0709a3fa13..889e83edf6f 100644 --- a/ndb/src/common/util/new.cpp +++ b/ndb/src/common/util/new.cpp @@ -1,6 +1,5 @@ -#include -#include +#include extern "C" { void (* ndb_new_handler)() = 0; diff --git a/ndb/src/common/util/random.c b/ndb/src/common/util/random.c index 91da19572e2..286ab093a26 100644 --- a/ndb/src/common/util/random.c +++ b/ndb/src/common/util/random.c @@ -18,16 +18,8 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include -#include -#include +#include -#ifndef NDB_WIN32 -#include -#endif - -#include #include #include diff --git a/ndb/src/common/util/socket_io.cpp b/ndb/src/common/util/socket_io.cpp index 878a9059512..8def7ebe91b 100644 --- a/ndb/src/common/util/socket_io.cpp +++ b/ndb/src/common/util/socket_io.cpp @@ -14,13 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include -#include -#include -#include #include -#include extern "C" int diff --git a/ndb/src/common/util/strdup.c b/ndb/src/common/util/strdup.c index 5291be86b0f..afe2306427e 100644 --- a/ndb/src/common/util/strdup.c +++ b/ndb/src/common/util/strdup.c @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #ifndef HAVE_STRDUP char * diff --git a/ndb/src/common/util/strlcat.c b/ndb/src/common/util/strlcat.c index ccff15da27f..aa282abe48d 100644 --- a/ndb/src/common/util/strlcat.c +++ b/ndb/src/common/util/strlcat.c @@ -31,17 +31,13 @@ * SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include +#include /* RCSID("$KTH: strlcat.c,v 1.1 2000/08/16 01:23:47 lha Exp $"); */ -//#include #ifndef HAVE_STRLCAT + size_t strlcat (char *dst, const char *src, size_t dst_sz) { diff --git a/ndb/src/common/util/strlcpy.c b/ndb/src/common/util/strlcpy.c index 9a3048081ca..97cff177d48 100644 --- a/ndb/src/common/util/strlcpy.c +++ b/ndb/src/common/util/strlcpy.c @@ -31,20 +31,12 @@ * SUCH DAMAGE. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include +#include /* RCSID("$KTH: strlcpy.c,v 1.1 2000/08/16 01:23:48 lha Exp $"); */ #ifndef HAVE_STRLCPY -#ifdef NDB_WIN32 -#include -#endif - size_t strlcpy (char *dst, const char *src, size_t dst_sz) { diff --git a/ndb/src/common/util/testProperties/testProperties.cpp b/ndb/src/common/util/testProperties/testProperties.cpp index 4a2999b89c1..3aa2af92c5b 100644 --- a/ndb/src/common/util/testProperties/testProperties.cpp +++ b/ndb/src/common/util/testProperties/testProperties.cpp @@ -14,10 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "Properties.hpp" #include -#include -#include #include "uucode.h" diff --git a/ndb/src/common/util/testSimpleProperties/sp_test.cpp b/ndb/src/common/util/testSimpleProperties/sp_test.cpp index d6dbe2a1502..d4052b64132 100644 --- a/ndb/src/common/util/testSimpleProperties/sp_test.cpp +++ b/ndb/src/common/util/testSimpleProperties/sp_test.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SimpleProperties.hpp" #include -#include -#include Uint32 page[8192]; diff --git a/ndb/src/common/util/uucode.c b/ndb/src/common/util/uucode.c index f862d982204..da34d565153 100644 --- a/ndb/src/common/util/uucode.c +++ b/ndb/src/common/util/uucode.c @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include /* ENC is the basic 1 character encoding function to make a char printing */ /* DEC is single character decode */ diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index 2ff10f51932..10f621d5db8 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include #include #include @@ -61,7 +59,7 @@ struct NdbUpGradeCompatible { UG_MatchType matchType; }; -//#define TEST_VERSION +/*#define TEST_VERSION*/ #ifndef TEST_VERSION struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { @@ -74,7 +72,7 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = { void ndbSetOwnVersion() {} -#else // testing purposes +#else /* testing purposes */ struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { { MAKE_VERSION(4,1,5), MAKE_VERSION(4,1,0), UG_Range }, @@ -122,7 +120,7 @@ ndbGetOwnVersion() { #ifndef TEST_VERSION return NDB_VERSION_D; -#else // testing purposes +#else /* testing purposes */ if (ndbOwnVersionTesting == 0) return NDB_VERSION_D; else diff --git a/ndb/src/cw/cpcc-win32/C++/StdAfx.h b/ndb/src/cw/cpcc-win32/C++/StdAfx.h index d84b5811f8d..370d04fb466 100644 --- a/ndb/src/cw/cpcc-win32/C++/StdAfx.h +++ b/ndb/src/cw/cpcc-win32/C++/StdAfx.h @@ -48,15 +48,12 @@ #include // C RunTime Header Files -#include -#include +#include #include #include #include #include #include -#include -#include // Local Header Files #include "resource.h" diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp index 9cf17addcc2..caf19ddba0e 100644 --- a/ndb/src/cw/cpcd/APIService.cpp +++ b/ndb/src/cw/cpcd/APIService.cpp @@ -23,7 +23,6 @@ #include "APIService.hpp" #include "CPCD.hpp" #include -#include #include /** diff --git a/ndb/src/cw/cpcd/CPCD.cpp b/ndb/src/cw/cpcd/CPCD.cpp index 8864ccf6e4e..f2878b7dea1 100644 --- a/ndb/src/cw/cpcd/CPCD.cpp +++ b/ndb/src/cw/cpcd/CPCD.cpp @@ -15,11 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include -#include -#include -#include #include "APIService.hpp" #include "CPCD.hpp" diff --git a/ndb/src/cw/cpcd/Monitor.cpp b/ndb/src/cw/cpcd/Monitor.cpp index a96f3509ee8..2935cd0a648 100644 --- a/ndb/src/cw/cpcd/Monitor.cpp +++ b/ndb/src/cw/cpcd/Monitor.cpp @@ -14,9 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include -#include #include #include "CPCD.hpp" diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index a54c6b8e475..74426306a88 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -14,13 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include -#include -#include -#include #include #include @@ -28,10 +25,9 @@ #include "CPCD.hpp" #include -#include -#include -#include +#ifdef HAVE_GETRLIMIT #include +#endif void CPCD::Process::print(FILE * f){ @@ -108,12 +104,12 @@ bool CPCD::Process::isRunning() { if(m_pid <= 1){ - logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid); + //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid); return false; } /* Check if there actually exists a process with such a pid */ errno = 0; - int s = kill((pid_t) m_pid, 0); /* Sending "signal" 0 to a process only + int s = kill((pid_t)-m_pid, 0); /* Sending "signal" 0 to a process only * checkes if the process actually exists */ if(s != 0) { switch(errno) { @@ -130,7 +126,6 @@ CPCD::Process::isRunning() { } return false; } - return true; } @@ -152,7 +147,6 @@ CPCD::Process::readPid() { f = fopen(filename, "r"); if(f == NULL){ - logger.debug("readPid - %s not found", filename); return -1; /* File didn't exist */ } @@ -213,6 +207,7 @@ setup_environment(const char *env) { static int set_ulimit(const BaseString & pair){ +#ifdef HAVE_GETRLIMIT errno = 0; do { Vector list; @@ -220,42 +215,43 @@ set_ulimit(const BaseString & pair){ if(list.size() != 2){ break; } - - int resource = 0; + + int res; rlim_t value = RLIM_INFINITY; if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } + + struct rlimit rlp; +#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} + if(list[0].trim() == "c"){ - resource = RLIMIT_CORE; + _RLIMIT_FIX(RLIMIT_CORE); } else if(list[0] == "d"){ - resource = RLIMIT_DATA; + _RLIMIT_FIX(RLIMIT_DATA); } else if(list[0] == "f"){ - resource = RLIMIT_FSIZE; + _RLIMIT_FIX(RLIMIT_FSIZE); } else if(list[0] == "n"){ - resource = RLIMIT_NOFILE; + _RLIMIT_FIX(RLIMIT_NOFILE); } else if(list[0] == "s"){ - resource = RLIMIT_STACK; + _RLIMIT_FIX(RLIMIT_STACK); } else if(list[0] == "t"){ - resource = RLIMIT_CPU; + _RLIMIT_FIX(RLIMIT_CPU); } else { errno = EINVAL; break; } - struct rlimit rlp; - if(getrlimit(resource, &rlp) != 0){ + if(!res) break; - } - - rlp.rlim_cur = value; - if(setrlimit(resource, &rlp) != 0){ - break; - } + return 0; } while(false); logger.error("Unable to process ulimit: %s(%s)", pair.c_str(), strerror(errno)); return -1; +#else + return 0; // Maybe it's ok anyway... +#endif } void @@ -360,8 +356,8 @@ CPCD::Process::start() { */ switch(pid = fork()) { case 0: /* Child */ - - writePid(getpid()); + setsid(); + writePid(getpgrp()); if(runas(m_runas.c_str()) == 0){ do_exec(); } @@ -386,14 +382,13 @@ CPCD::Process::start() { switch(fork()) { case 0: /* Child */ signal(SIGCHLD, SIG_IGN); - pid_t pid; switch(pid = fork()) { case 0: /* Child */ - writePid(getpid()); + setsid(); + writePid(getpgrp()); if(runas(m_runas.c_str()) != 0){ _exit(1); } - setsid(); do_exec(); _exit(1); /* NOTREACHED */ @@ -424,15 +419,18 @@ CPCD::Process::start() { logger.critical("Unknown process type"); return -1; } - + while(readPid() < 0){ sched_yield(); } - - if(pid != -1 && pid != m_pid){ - logger.error("pid and m_pid don't match: %d %d", pid, m_pid); + + errno = 0; + pid_t pgid = getpgid(pid); + + if(pgid != -1 && pgid != m_pid){ + logger.error("pgid and m_pid don't match: %d %d (%d)", pgid, m_pid, pid); } - + if(isRunning()){ m_status = RUNNING; return 0; @@ -449,33 +447,36 @@ CPCD::Process::stop() { unlink(filename); if(m_pid <= 1){ - logger.critical("Stopping process with bogus pid: %d", m_pid); + logger.critical("Stopping process with bogus pid: %d id: %d", + m_pid, m_id); return; } m_status = STOPPING; - - int ret = kill((pid_t)m_pid, SIGTERM); + + errno = 0; + int ret = kill(-m_pid, SIGTERM); switch(ret) { case 0: - logger.debug("Sent SIGTERM to pid %d", (int)m_pid); + logger.debug("Sent SIGTERM to pid %d", (int)-m_pid); break; default: - logger.debug("kill pid: %d : %s", (int)m_pid, strerror(errno)); + logger.debug("kill pid: %d : %s", (int)-m_pid, strerror(errno)); break; } - + if(isRunning()){ - ret = kill((pid_t)m_pid, SIGKILL); + errno = 0; + ret = kill(-m_pid, SIGKILL); switch(ret) { case 0: - logger.debug("Sent SIGKILL to pid %d", (int)m_pid); + logger.debug("Sent SIGKILL to pid %d", (int)-m_pid); break; default: - logger.debug("kill pid: %d : %s\n", (int)m_pid, strerror(errno)); + logger.debug("kill pid: %d : %s\n", (int)-m_pid, strerror(errno)); break; } - } - + } + m_pid = -1; m_status = STOPPED; } diff --git a/ndb/src/cw/cpcd/common.cpp b/ndb/src/cw/cpcd/common.cpp index 731866b22fd..cb1c0c37183 100644 --- a/ndb/src/cw/cpcd/common.cpp +++ b/ndb/src/cw/cpcd/common.cpp @@ -14,11 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "common.hpp" #include #include -#include -#include #include #include @@ -152,7 +152,10 @@ parse_config_file(struct getargs args[], int num_arg, const Properties& p){ break; } } - if(!found) + if(!found) { printf("Unknown parameter: %s\n", name); + return 1; + } } + return 0; } diff --git a/ndb/src/cw/cpcd/common.hpp b/ndb/src/cw/cpcd/common.hpp index 65fcce05f66..c3d87b8b9f5 100644 --- a/ndb/src/cw/cpcd/common.hpp +++ b/ndb/src/cw/cpcd/common.hpp @@ -17,7 +17,7 @@ #ifndef __CPCD_COMMON_HPP_INCLUDED__ #define __CPCD_COMMON_HPP_INCLUDED__ -#include +#include #include #include diff --git a/ndb/src/cw/cpcd/main.cpp b/ndb/src/cw/cpcd/main.cpp index 8dd4f2b4608..11f6238d5f7 100644 --- a/ndb/src/cw/cpcd/main.cpp +++ b/ndb/src/cw/cpcd/main.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include /* Needed for mkdir(2) */ -#include /* Needed for mkdir(2) */ -#include +#include /* Needed for mkdir(2) */ #include #include "CPCD.hpp" diff --git a/ndb/src/cw/test/socketclient/socketClientTest.cpp b/ndb/src/cw/test/socketclient/socketClientTest.cpp index a4a0ed1e933..423c196aa43 100644 --- a/ndb/src/cw/test/socketclient/socketClientTest.cpp +++ b/ndb/src/cw/test/socketclient/socketClientTest.cpp @@ -15,11 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include -#include -#include #include #include #include diff --git a/ndb/src/cw/util/ClientInterface.hpp b/ndb/src/cw/util/ClientInterface.hpp index 764705afacd..66ecfe05197 100644 --- a/ndb/src/cw/util/ClientInterface.hpp +++ b/ndb/src/cw/util/ClientInterface.hpp @@ -16,6 +16,7 @@ #ifndef CLIENT_IF_HPP #define CLIENT_IF_HPP +#include #include #include #include @@ -23,9 +24,6 @@ #include #include "SocketRegistry.hpp" #include "SocketService.hpp" -#include "string.h" -#include -#include class ClientInterface { private: diff --git a/ndb/src/kernel/blocks/backup/FsBuffer.hpp b/ndb/src/kernel/blocks/backup/FsBuffer.hpp index 4b5d95a19a5..2f3c7daae43 100644 --- a/ndb/src/kernel/blocks/backup/FsBuffer.hpp +++ b/ndb/src/kernel/blocks/backup/FsBuffer.hpp @@ -17,10 +17,7 @@ #ifndef FS_BUFFER_HPP #define FS_BUFFER_HPP -#include -#include -#include -#include +#include #define DEBUG(x) diff --git a/ndb/src/kernel/blocks/backup/read.cpp b/ndb/src/kernel/blocks/backup/read.cpp index 8300c74ab43..921c352ea13 100644 --- a/ndb/src/kernel/blocks/backup/read.cpp +++ b/ndb/src/kernel/blocks/backup/read.cpp @@ -15,9 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include #include #include diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile b/ndb/src/kernel/blocks/backup/restore/Makefile index f99e3e3da0d..4c884525d73 100644 --- a/ndb/src/kernel/blocks/backup/restore/Makefile +++ b/ndb/src/kernel/blocks/backup/restore/Makefile @@ -1,12 +1,12 @@ include .defs.mk -TYPE := ndbapi ndbapiclient +TYPE := * BIN_TARGET := restore BIN_TARGET_LIBS := -BIN_TARGET_ARCHIVES := NDB_API general +BIN_TARGET_ARCHIVES := NDB_API -CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi +CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi -I$(NDB_TOP)/include/ndbapi -I$(NDB_TOP)/include/util -I$(NDB_TOP)/include/portlib -I$(NDB_TOP)/include/kernel #ifneq ($(MYSQLCLUSTER_TOP),) #CCFLAGS_LOC +=-I$(MYSQLCLUSTER_TOP)/include -D USE_MYSQL diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp index 50eb0df7c56..2c3c1c8df7b 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp @@ -14,11 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "Restore.hpp" #include "BackupFormat.hpp" #include -#include #include #include @@ -514,7 +512,8 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data, NdbDictionary::Column::Type type; if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) { tableImpl->setName(tableName); - for(Uint32 i = 0 ; i < tableImpl->getNoOfColumns(); i++) { + Uint32 noOfColumns = tableImpl->getNoOfColumns(); + for(Uint32 i = 0 ; i < noOfColumns; i++) { type = convertToV3x(tableImpl->getColumn(i)->m_extType, columnTypeMapping, -1); @@ -562,7 +561,7 @@ bool TupleS::prepareRecord(const TableS & tab){ m_currentTable = &tab; for(int i = 0; i +#include #include #include #include #include #include "myVector.hpp" -#include -#include -#include #include #include diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp index b38f6ab751b..4c15785d5c2 100644 --- a/ndb/src/kernel/blocks/backup/restore/main.cpp +++ b/ndb/src/kernel/blocks/backup/restore/main.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "Restore.hpp" #include #include diff --git a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp index b16990bda6c..bf721a0b30a 100644 --- a/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp +++ b/ndb/src/kernel/blocks/dbdict/printSchemafile/printSchemafile.cpp @@ -15,13 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include + #include #include #include -#include -#include -#include void usage(const char * prg){ diff --git a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp index 4c55425bdd7..efa4b9c92c5 100644 --- a/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp +++ b/ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp @@ -15,13 +15,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include + #include #include #include -#include -#include -#include void usage(const char * prg){ diff --git a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp index d2d166fa03e..540df7b507e 100644 --- a/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp +++ b/ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp @@ -25,11 +25,10 @@ //---------------------------------------------------------------- +#include + #include "records.hpp" -#include -#include -#include -#include + #define RETURN_ERROR 1 #define RETURN_OK 0 diff --git a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp index 887f82308d6..54cb93e9736 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp @@ -49,7 +49,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signal) Uint32 noOfAttributes = signal->theData[4]; Uint32 fragId = signal->theData[5]; Uint32 noOfNullAttr = signal->theData[7]; - Uint32 schemaVersion = signal->theData[8]; + /* Uint32 schemaVersion = signal->theData[8];*/ Uint32 noOfKeyAttr = signal->theData[9]; Uint32 noOfNewAttr = signal->theData[10]; diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index c56e455a42a..4737c8422c4 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -83,6 +83,9 @@ #define jamEntry() jamEntryLine(90000 + __LINE__) #endif +#undef max +#undef min + class Configuration; class Dbtux : public SimulatedBlock { diff --git a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp index 2cb129bc591..92410e1a784 100644 --- a/ndb/src/kernel/blocks/dbutil/DbUtil.cpp +++ b/ndb/src/kernel/blocks/dbutil/DbUtil.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "DbUtil.hpp" -#include -#include #include #include @@ -1303,26 +1303,6 @@ DbUtil::prepareOperation(Signal* signal, PreparePtr prepPtr) TcKeyReq::setAIInTcKeyReq(requestInfo, 0); // Attrinfo sent separately prepOpPtr.p->tckey.requestInfo = requestInfo; - if (operationType == UtilPrepareReq::Read) { - // ResultSet - AttrMappingBuffer::ConstDataBufferIterator tmpIt; -#if 0 //def EVENT_DEBUG - ResultSetBuffer & rs = prepOpPtr.p->rsInfo; - ResultSetInfoBuffer::DataBufferIterator it; - rs.first(it); - for (prepOpPtr.p->attrMapping.first(tmpIt); - tmpIt.curr.i != RNIL; - prepOpPtr.p->attrMapping.next(tmpIt)) { - AttributeHeader* ah = (AttributeHeader *) tmpIt.data; - ah->print(stdout); - AttributeHeader* rsah = (AttributeHeader *) it.data; - rsah->print(stdout); - rs.next(it,1); - printf("%d\n",it.data); - } -#endif - } - /**************************** * Confirm completed prepare ****************************/ @@ -1914,7 +1894,6 @@ DbUtil::runOperation(Signal* signal, TransactionPtr & transPtr, Operation * op = opPtr.p; const PreparedOperation * pop = op->prepOp; - Uint32 lastFlag = 0; if(!transPtr.p->operations.next(opPtr)){ TcKeyReq::setCommitFlag(start, 1); // Last operation TcKeyReq::setExecuteFlag(start, 1); @@ -2127,43 +2106,11 @@ DbUtil::execTRANSID_AI(Signal* signal){ /** * Save result */ - Uint32 srcSz = dataLen; const Uint32 *src = &signal->theData[3]; - const Uint32 segSize = opP->rs.getSegmentSize(); - -#if 0 //def EVENT_DEBUG - printf("rsRecv %u, dataLen %u, rsExpect %u\n", - opP->rsRecv, dataLen, opP->rsExpect); -#endif - ResultSetBuffer::DataBufferIterator rs = opP->rsIterator; -#if 0 //def EVENT_DEBUG - for(int i = 0; i < dataLen; i++) - printf("H'%.8x ", src[i]); -#endif - ndbrequire(opP->rs.import(rs,src,dataLen)); opP->rs.next(rs, dataLen); - -#if 0 // replaced this section with import() above - while(srcSz > segSize){ - ndbrequire(rs.curr.i != RNIL); - memcpy(rs.data, src, segSize << 2); - opP->rs.next(rs, segSize); - srcSz -= segSize; - // src += segSize * 4; // Bug? - src += segSize; - } - - if(srcSz > 0){ - jam(); - memcpy(rs.data, src, srcSz << 2); - rs.curr.i = RNIL; - rs.data = 0; - } -#endif - opP->rsIterator = rs; if(!opP->complete()){ @@ -2171,20 +2118,12 @@ DbUtil::execTRANSID_AI(Signal* signal){ return; } -#if 0 //def EVENT_DEBUG - printf("op complete\n"); -#endif - transPtr.p->recv++; if(!transPtr.p->complete()){ jam(); return; } -#if 0 //def EVENT_DEBUG - printf("trans complete\n"); -#endif - finishTransaction(signal, transPtr); } diff --git a/ndb/src/kernel/blocks/grep/Grep.cpp b/ndb/src/kernel/blocks/grep/Grep.cpp index 093e9a225e6..ee506ce922a 100644 --- a/ndb/src/kernel/blocks/grep/Grep.cpp +++ b/ndb/src/kernel/blocks/grep/Grep.cpp @@ -1294,7 +1294,7 @@ Grep::PSPart::execSUB_REMOVE_REF(Signal* signal) jamEntry(); SubRemoveRef * const ref = (SubRemoveRef *)signal->getDataPtr(); Uint32 subData = ref->subscriberData; - GrepError::Code err = (GrepError::Code)ref->err; + /* GrepError::Code err = (GrepError::Code)ref->err;*/ SubscriptionPtr subPtr; c_subscriptions.getPtr(subPtr, subData); diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 0e2aa4c6903..f73c1ec5ee7 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -23,20 +23,17 @@ #endif #endif +#include + #include "Error.hpp" #include "AsyncFile.hpp" #include #include -#include #include #include #include -#include -#include -#include - #ifdef NDB_LINUX // This is for pread and pwrite #ifndef __USE_UNIX98 @@ -44,9 +41,7 @@ #endif #endif -#include #if defined NDB_WIN32 || defined NDB_OSE || defined NDB_SOFTOSE -#include #else // For readv and writev #include @@ -566,9 +561,8 @@ AsyncFile::writeReq( Request * request) if (((i + 1) < request->par.readWrite.numberOfPages)) { // There are more pages to write // Check that offsets are consequtive - if ((page_offset + request->par.readWrite.pages[i].size) - != - request->par.readWrite.pages[i+1].offset) { + off_t tmp = page_offset + request->par.readWrite.pages[i].size; + if (tmp != request->par.readWrite.pages[i+1].offset) { // Next page is not aligned with previous, not allowed DEBUG(ndbout_c("Page offsets are not aligned")); request->error = EINVAL; diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp index b9954ba130f..004752c9543 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp @@ -16,10 +16,8 @@ //#define TESTDEBUG 1 -#include -#include +#include -#include #include #include #include "AsyncFile.hpp" diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.cpp b/ndb/src/kernel/blocks/ndbfs/Filename.cpp index c0bc52b4501..494c9c74eb9 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.cpp @@ -14,10 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include +#include + #include #include "Filename.hpp" diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.hpp b/ndb/src/kernel/blocks/ndbfs/Filename.hpp index 4c3569b5485..29aba79c9dc 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.hpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.hpp @@ -52,8 +52,8 @@ // //=========================================================================== +#include #include -#include class Filename { diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp index 6e0c2721ca0..435a6a6b208 100644 --- a/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp +++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp @@ -76,7 +76,6 @@ #include "NdbCondition.h" #include -#include template class MemoryChannel diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp index 9f70efcadf7..ca90bc60153 100644 --- a/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp +++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp @@ -65,7 +65,6 @@ #include "NdbMutex.h" #include "NdbCondition.h" -#include diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index 8992a2104e9..36322ffad1e 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include "Ndbfs.hpp" #include "AsyncFile.hpp" @@ -855,7 +854,7 @@ int Ndbfs::translateErrno(int aErrno) //no space left on device case ENFILE: case EDQUOT: -#ifndef NDB_MACOSX +#ifdef ENOSR case ENOSR: #endif case ENOSPC: @@ -873,12 +872,16 @@ int Ndbfs::translateErrno(int aErrno) return FsRef::fsErrInvalidParameters; //environment error case ELOOP: -#ifndef NDB_MACOSX +#ifdef ENOLINK case ENOLINK: +#endif +#ifdef EMULTIHOP case EMULTIHOP: #endif -#ifndef NDB_LINUX +#ifdef EOPNOTSUPP case EOPNOTSUPP: +#endif +#ifdef ESPIPE case ESPIPE: #endif case EPIPE: diff --git a/ndb/src/kernel/blocks/suma/SumaInit.cpp b/ndb/src/kernel/blocks/suma/SumaInit.cpp index e9fba5e789c..9f0659942a2 100644 --- a/ndb/src/kernel/blocks/suma/SumaInit.cpp +++ b/ndb/src/kernel/blocks/suma/SumaInit.cpp @@ -132,9 +132,9 @@ SumaParticipant::~SumaParticipant() Suma::Suma(const Configuration & conf) : SumaParticipant(conf), + Restart(*this), c_nodes(c_nodePool), - c_runningSubscriptions(c_subCoordinatorPool), - Restart(*this) + c_runningSubscriptions(c_subCoordinatorPool) { c_nodePool.setSize(MAX_NDB_NODES); diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 1aa937f4675..56627cba46f 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -15,17 +15,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "Error.hpp" #include "ErrorReporter.hpp" #include "ErrorMessages.hpp" #include #include -#include -#include #include #include -#include #include #define MESSAGE_LENGTH 400 diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp index f1428821ab0..20340a9602f 100644 --- a/ndb/src/kernel/error/ErrorReporter.hpp +++ b/ndb/src/kernel/error/ErrorReporter.hpp @@ -17,9 +17,10 @@ #ifndef ERRORREPORTER_H #define ERRORREPORTER_H +#include + #include "TimeModule.hpp" #include "Error.hpp" -#include #include diff --git a/ndb/src/kernel/error/TimeModule.cpp b/ndb/src/kernel/error/TimeModule.cpp index c0f4e40858f..4bd8e3daf99 100644 --- a/ndb/src/kernel/error/TimeModule.cpp +++ b/ndb/src/kernel/error/TimeModule.cpp @@ -16,8 +16,8 @@ +#include #include "TimeModule.hpp" -#include static const char* cMonth[] = { "x", "January", "February", "Mars", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; diff --git a/ndb/src/kernel/ndb-main/Main.cpp b/ndb/src/kernel/ndb-main/Main.cpp index 88fd9d177de..f936c630d50 100644 --- a/ndb/src/kernel/ndb-main/Main.cpp +++ b/ndb/src/kernel/ndb-main/Main.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include "Configuration.hpp" #include @@ -32,7 +34,6 @@ #include #if defined NDB_SOLARIS -#include // For system information #include // For system informatio #endif @@ -41,10 +42,6 @@ #endif extern EventLogger g_eventLogger; -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) -#include -#include -#endif void catchsigs(bool ignore); // for process signal handling extern "C" void handler(int signo); // for process signal handling @@ -188,9 +185,9 @@ NDB_MAIN(ndb_kernel){ void systemInfo(const Configuration & config, const LogLevel & logLevel){ +#ifdef NDB_WIN32 int processors = 0; int speed; -#ifdef NDB_WIN32 SYSTEM_INFO sinfo; GetSystemInfo(&sinfo); processors = sinfo.dwNumberOfProcessors; @@ -260,8 +257,10 @@ handler(int sig){ case SIGINT: /* 2 - Interrupt */ case SIGQUIT: /* 3 - Quit */ case SIGTERM: /* 15 - Terminate */ -#ifndef NDB_MACOSX +#ifdef SIGPWR case SIGPWR: /* 19 - Power fail */ +#endif +#ifdef SIGPOLL case SIGPOLL: /* 22 */ #endif case SIGSTOP: /* 23 */ diff --git a/ndb/src/kernel/vm/ArrayPool.hpp b/ndb/src/kernel/vm/ArrayPool.hpp index 4a84047b614..284d29dcefa 100644 --- a/ndb/src/kernel/vm/ArrayPool.hpp +++ b/ndb/src/kernel/vm/ArrayPool.hpp @@ -17,12 +17,12 @@ #ifndef ARRAY_POOL_HPP #define ARRAY_POOL_HPP +#include + #include #include #include #include -#include -#include template class Array; template class SLList; diff --git a/ndb/src/kernel/vm/ClusterConfiguration.cpp b/ndb/src/kernel/vm/ClusterConfiguration.cpp index f04081ee3c1..3a6478380d1 100644 --- a/ndb/src/kernel/vm/ClusterConfiguration.cpp +++ b/ndb/src/kernel/vm/ClusterConfiguration.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "ClusterConfiguration.hpp" #include @@ -27,9 +29,6 @@ #include #include -#include -#include - ClusterConfiguration::ClusterConfiguration() { for (unsigned i= 0; i< MAX_SIZEALT_BLOCKS; i++) // initialize diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 03495449787..706d75509f2 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include diff --git a/ndb/src/kernel/vm/DLHashTable.hpp b/ndb/src/kernel/vm/DLHashTable.hpp index f7cd7ae5228..13a9632f8da 100644 --- a/ndb/src/kernel/vm/DLHashTable.hpp +++ b/ndb/src/kernel/vm/DLHashTable.hpp @@ -17,9 +17,8 @@ #ifndef DL_HASHTABLE_HPP #define DL_HASHTABLE_HPP +#include #include "ArrayList.hpp" -#include -#include /** * DLHashTable implements a hashtable using chaining diff --git a/ndb/src/kernel/vm/DLHashTable2.hpp b/ndb/src/kernel/vm/DLHashTable2.hpp index 8386790b0a6..6b166331631 100644 --- a/ndb/src/kernel/vm/DLHashTable2.hpp +++ b/ndb/src/kernel/vm/DLHashTable2.hpp @@ -17,10 +17,9 @@ #ifndef DL_HASHTABLE2_HPP #define DL_HASHTABLE2_HPP +#include + #include "ArrayList.hpp" -#include -#include -#include /** * DLHashTable2 is a DLHashTable variant meant for cases where different diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index a852e045c6e..0d6d3f55acb 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "Emulator.hpp" #include #include @@ -31,19 +33,12 @@ #include #include #include -#include #include extern "C" { extern void (* ndb_new_handler)(); } - -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) -#include -#include -#endif - /** * Declare the global variables */ diff --git a/ndb/src/kernel/vm/GlobalData.hpp b/ndb/src/kernel/vm/GlobalData.hpp index ca7dd467750..99b65727374 100644 --- a/ndb/src/kernel/vm/GlobalData.hpp +++ b/ndb/src/kernel/vm/GlobalData.hpp @@ -17,11 +17,10 @@ #ifndef GLOBAL_DATA_H #define GLOBAL_DATA_H +#include #include #include "Prio.hpp" #include "VMSignal.hpp" -#include -#include #include #include diff --git a/ndb/src/kernel/vm/SimulatedBlock.cpp b/ndb/src/kernel/vm/SimulatedBlock.cpp index f36b3e43d42..e3f087d7d74 100644 --- a/ndb/src/kernel/vm/SimulatedBlock.cpp +++ b/ndb/src/kernel/vm/SimulatedBlock.cpp @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "SimulatedBlock.hpp" #include #include @@ -24,8 +26,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/ndb/src/kernel/vm/TransporterCallback.cpp b/ndb/src/kernel/vm/TransporterCallback.cpp index 1fec4ea86bd..3798e4040c8 100644 --- a/ndb/src/kernel/vm/TransporterCallback.cpp +++ b/ndb/src/kernel/vm/TransporterCallback.cpp @@ -14,12 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include #include #include #include -#include #include "LongSignal.hpp" diff --git a/ndb/src/kernel/vm/VMSignal.hpp b/ndb/src/kernel/vm/VMSignal.hpp index d436143c055..45e731f2079 100644 --- a/ndb/src/kernel/vm/VMSignal.hpp +++ b/ndb/src/kernel/vm/VMSignal.hpp @@ -17,14 +17,15 @@ #ifndef VMSignal_H #define VMSignal_H +#include +#include +#include + #include #include -#include -#include #include #include -#include /** * Struct used when sending to multiple blocks diff --git a/ndb/src/kernel/vm/al_test/arrayListTest.cpp b/ndb/src/kernel/vm/al_test/arrayListTest.cpp index 39d8170cfc5..bb320106653 100644 --- a/ndb/src/kernel/vm/al_test/arrayListTest.cpp +++ b/ndb/src/kernel/vm/al_test/arrayListTest.cpp @@ -16,11 +16,11 @@ +#include + #include -#include #include #include -#include struct A_Listable_Object { Uint32 next; diff --git a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp index 8b554d5bb41..e80905121e1 100644 --- a/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp +++ b/ndb/src/kernel/vm/al_test/arrayPoolTest.cpp @@ -16,12 +16,11 @@ +#include + #include -#include #include #include -#include -#include struct A_Poolable_Object { Uint32 next; diff --git a/ndb/src/kernel/vm/al_test/main.cpp b/ndb/src/kernel/vm/al_test/main.cpp index 42c36173b56..23193b50725 100644 --- a/ndb/src/kernel/vm/al_test/main.cpp +++ b/ndb/src/kernel/vm/al_test/main.cpp @@ -14,11 +14,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include #include #include -#include #include #include "arrayListTest.cpp" diff --git a/ndb/src/kernel/vm/testCopy/rr.cpp b/ndb/src/kernel/vm/testCopy/rr.cpp index 2da8383f523..1e8305dfe4c 100644 --- a/ndb/src/kernel/vm/testCopy/rr.cpp +++ b/ndb/src/kernel/vm/testCopy/rr.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include -#include -#include int main(int argc, char * const argv[]){ diff --git a/ndb/src/kernel/vm/testCopy/testCopy.cpp b/ndb/src/kernel/vm/testCopy/testCopy.cpp index 1b4b24f5934..78a1dab2619 100644 --- a/ndb/src/kernel/vm/testCopy/testCopy.cpp +++ b/ndb/src/kernel/vm/testCopy/testCopy.cpp @@ -15,11 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include -#include -#include -#include #ifdef __NDB_FORTE6 #define HAND diff --git a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp index def8387e343..5ba59418223 100644 --- a/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp +++ b/ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp @@ -14,10 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include #include #include -#include -#include + +#undef test struct Buffer { Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;} diff --git a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp index 6d421268a0a..af4e2ca6e24 100644 --- a/ndb/src/kernel/vm/testLongSig/testLongSig.cpp +++ b/ndb/src/kernel/vm/testLongSig/testLongSig.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include -#include -#include void print_help(){ diff --git a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp index 20a5d5230fb..e16870edf11 100644 --- a/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp +++ b/ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp @@ -14,12 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include #include -#include -#include + +#undef test struct Buffer { Buffer(Uint32 size){ m_sz = size; buffer = new Uint32[m_sz]; m_len = 0;} diff --git a/ndb/src/mgmapi/Makefile b/ndb/src/mgmapi/Makefile index fac852dbba8..9e7ba4f5ac7 100644 --- a/ndb/src/mgmapi/Makefile +++ b/ndb/src/mgmapi/Makefile @@ -9,7 +9,7 @@ A_LIB := Y SO_LIB := Y PIC_LIB := Y -DIRS := test +#DIRS := test LIB_TARGET := MGM_API LIB_TARGET_ARCHIVES := $(ARCHIVE_TARGET) general portlib diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 4c1355e8e46..fcdfe943fb1 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -14,17 +14,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #include "mgmapi.h" #include "mgmapi_debug.h" #include -#include - -#include -#include -#include -#include #include #include #include diff --git a/ndb/src/mgmapi/test/keso.c b/ndb/src/mgmapi/test/keso.c index f4b192e3db8..d5086b20b6a 100644 --- a/ndb/src/mgmapi/test/keso.c +++ b/ndb/src/mgmapi/test/keso.c @@ -15,6 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include #ifdef VM_TRACE @@ -22,9 +24,6 @@ #endif #include -#include - -#include static int testConnect(NdbMgmHandle h, struct ndb_mgm_reply* reply); static int testDisconnect(NdbMgmHandle h, struct ndb_mgm_reply* reply); @@ -60,8 +59,8 @@ struct test_case test_connect_disconnect[] = { struct test_case tests[] = { { "testStatus", &testStatus }, { "testFilterClusterLog", &testFilterClusterLog }, - //{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog }, - //{ "testSetLogLevelNode", &testSetLogLevelNode }, + /*{ "testSetLogLevelClusterLog", &testSetLogLevelClusterLog },*/ + /*{ "testSetLogLevelNode", &testSetLogLevelNode },*/ { "testRestartNode", &testRestartNode }, { "testGetStatPort", &testGetStatPort }, #ifdef VM_TRACE diff --git a/ndb/src/mgmapi/test/mgmSrvApi.cpp b/ndb/src/mgmapi/test/mgmSrvApi.cpp index e93c54ae5a7..4a8e38c9ba5 100644 --- a/ndb/src/mgmapi/test/mgmSrvApi.cpp +++ b/ndb/src/mgmapi/test/mgmSrvApi.cpp @@ -25,11 +25,9 @@ * Server API" document * *****************************************************/ +#include #include "mgmapi.h" #include "mgmapi_commands.h" -#include -#include -#include #include #include diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 29d25ebf7d3..fba5fda32dd 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -14,13 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include - -#include +#include "CommandInterpreter.hpp" #include #include @@ -34,7 +28,6 @@ #endif // HAVE_GLOBAL_REPLICATION #include "MgmtErrorReporter.hpp" -#include "CommandInterpreter.hpp" #include "CpcClient.hpp" #ifdef NDB_SOLARIS // XXX fix me diff --git a/ndb/src/mgmclient/CommandInterpreter.hpp b/ndb/src/mgmclient/CommandInterpreter.hpp index 9049ef39915..796a4e4838e 100644 --- a/ndb/src/mgmclient/CommandInterpreter.hpp +++ b/ndb/src/mgmclient/CommandInterpreter.hpp @@ -22,9 +22,7 @@ // Author: Peter Lind //***************************************************************************** -#include -#include -#include +#include #include #include diff --git a/ndb/src/mgmclient/CpcClient.cpp b/ndb/src/mgmclient/CpcClient.cpp index 24eab7194e9..74fa1a828ed 100644 --- a/ndb/src/mgmclient/CpcClient.cpp +++ b/ndb/src/mgmclient/CpcClient.cpp @@ -14,14 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include -#include -#include -#include #include -#include #include #include diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index bbadaeb5206..2dcadf9369d 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include #include #include diff --git a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp index 6b6dc9f1077..32f0adbcf26 100644 --- a/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp +++ b/ndb/src/mgmclient/test_cpcd/test_cpcd.cpp @@ -15,10 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "../CpcClient.hpp" #include -#include -#include SimpleCpcClient g_client("localhost", 1234); Vector g_procs; @@ -89,10 +88,16 @@ void define(){ //proc.m_proc.m_stdout = "log.out"; //proc.m_proc.m_stderr = "2>&1"; //proc.m_proc.m_runas = proc.m_host->m_user; - //proc.m_proc.m_ulimit = "c:unlimited"; - m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test"); - m_proc.m_path.assign("/bin/sleep"); - m_proc.m_args = "600"; + m_proc.m_ulimit = "c:unlimited"; + if((rand() & 15) >= 0){ + m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "sleep"); + m_proc.m_path.assign("/bin/sleep"); + m_proc.m_args = "600"; + } else { + m_proc.m_name.assfmt("%d-%d-%s", getpid(), name++, "test.sh"); + m_proc.m_path.assign("/home/jonas/run/cpcd/test.sh"); + m_proc.m_args = "600"; + } g_procs.push_back(m_proc); Properties reply; @@ -136,7 +141,7 @@ void list(){ ABORT(); } - for(int i = 0; im_status = procs[i].m_status; @@ -144,7 +149,7 @@ void list(){ } } SimpleCpcClient::Process* find(int id){ - for(int i = 0; i -#include -#include +#include #include #include #include diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 23ceeb15947..08bfe20aa95 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -14,10 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include + #include "MgmtSrvr.hpp" #include "MgmtErrorReporter.hpp" -#include #include #include #include @@ -42,15 +44,11 @@ #include #include #include -#include #include "SocketServer.hpp" #include "NodeLogLevel.hpp" #include -#include -#include - //#define MGM_SRV_DEBUG #ifdef MGM_SRV_DEBUG #define DEBUG(x) do ndbout << x << endl; while(0) diff --git a/ndb/src/mgmsrv/MgmtSrvr.hpp b/ndb/src/mgmsrv/MgmtSrvr.hpp index 4fdf3c99d43..ce8765d6c73 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -20,7 +20,6 @@ #include #include "Config.hpp" #include -#include #include diff --git a/ndb/src/mgmsrv/NodeLogLevel.hpp b/ndb/src/mgmsrv/NodeLogLevel.hpp index 3e631e57901..3ad758cde99 100644 --- a/ndb/src/mgmsrv/NodeLogLevel.hpp +++ b/ndb/src/mgmsrv/NodeLogLevel.hpp @@ -17,7 +17,8 @@ #ifndef NODELOGLEVEL_H #define NODELOGLEVEL_H -#include +#include + #include /** diff --git a/ndb/src/mgmsrv/NodeLogLevelList.cpp b/ndb/src/mgmsrv/NodeLogLevelList.cpp index 7cf6dcc4b7e..6c7c091c1a8 100644 --- a/ndb/src/mgmsrv/NodeLogLevelList.cpp +++ b/ndb/src/mgmsrv/NodeLogLevelList.cpp @@ -14,10 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NodeLogLevelList.hpp" +#include +#include "NodeLogLevelList.hpp" #include "NodeLogLevel.hpp" -#include "NdbStdio.h" // // PUBLIC diff --git a/ndb/src/mgmsrv/convertStrToInt.cpp b/ndb/src/mgmsrv/convertStrToInt.cpp index 82bdb8e4f2f..e5216047d10 100644 --- a/ndb/src/mgmsrv/convertStrToInt.cpp +++ b/ndb/src/mgmsrv/convertStrToInt.cpp @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include bool convert(const char* s, int& val) { diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index d10ad8e0f4e..91b443f61a2 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -14,8 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include #include "MgmtSrvr.hpp" #include "EventLogger.hpp" @@ -41,6 +42,7 @@ #include "CommandInterpreter.hpp" #endif +#undef DEBUG #define DEBUG(x) ndbout << x << endl; const char progname[] = "mgmtsrvr"; @@ -197,7 +199,6 @@ NDB_MAIN(mgmsrv){ goto error_end; } -#if defined (NDB_LINUX) || defined (NDB_SOLARIS) if (glob.daemon) { // Become a daemon char homePath[255],lockfile[255], logfile[255]; @@ -209,7 +210,6 @@ NDB_MAIN(mgmsrv){ return 1; } } -#endif if(!glob.mgmObject->start()){ ndbout_c("Unable to start management server."); diff --git a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp index 0e9397e43c0..224c82aa8a1 100644 --- a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp +++ b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp @@ -14,15 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include + #include #include -#include #include "InitConfigFileParser.hpp" -#include "Config.hpp" -#include -#include -#include +#include void usage(const char * prg){ ndbout << "Usage " << prg << ": " << endl; diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp index 93fb0109669..1b536b6d741 100644 --- a/ndb/src/ndbapi/ClusterMgr.cpp +++ b/ndb/src/ndbapi/ClusterMgr.cpp @@ -14,6 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include +#include + #include "TransporterFacade.hpp" #include "ClusterMgr.hpp" #include @@ -23,12 +27,8 @@ #include #include #include -#include -#include -#include -#include #include #include #include diff --git a/ndb/src/ndbapi/DictCache.cpp b/ndb/src/ndbapi/DictCache.cpp index 36fbc85a875..f6f2106f2aa 100644 --- a/ndb/src/ndbapi/DictCache.cpp +++ b/ndb/src/ndbapi/DictCache.cpp @@ -14,12 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "DictCache.hpp" #include "NdbDictionaryImpl.hpp" #include #include #include -#include LocalDictCache::LocalDictCache(){ m_tableHash.createHashTable(); diff --git a/ndb/src/ndbapi/Makefile b/ndb/src/ndbapi/Makefile index 932fbd844d2..328bb5e3741 100644 --- a/ndb/src/ndbapi/Makefile +++ b/ndb/src/ndbapi/Makefile @@ -32,6 +32,8 @@ SOURCES = \ Ndbif.cpp \ Ndbinit.cpp \ Ndberror.cpp \ + ndberror.c \ + NdbErrorOut.cpp \ NdbConnection.cpp \ NdbConnectionScan.cpp \ NdbOperation.cpp \ diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index d7930f32d72..68f49b975ee 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -21,14 +21,16 @@ Name: Ndb.cpp ******************************************************************************/ +#include + #include "NdbApiSignal.hpp" #include "NdbImpl.hpp" #include "NdbSchemaOp.hpp" #include "NdbSchemaCon.hpp" -#include "NdbOperation.hpp" -#include "NdbConnection.hpp" -#include "NdbEventOperation.hpp" -#include "NdbRecAttr.hpp" +#include +#include +#include +#include #include #include #include @@ -1221,7 +1223,6 @@ Ndb::pollEvents(int aMillisecondNumber) #ifdef VM_TRACE #include -#include static NdbMutex print_state_mutex = NDB_MUTEX_INITIALIZER; static bool checkdups(NdbConnection** list, unsigned no) diff --git a/ndb/src/ndbapi/NdbConnectionScan.cpp b/ndb/src/ndbapi/NdbConnectionScan.cpp index 67f07d2a8c0..962acc0bdac 100644 --- a/ndb/src/ndbapi/NdbConnectionScan.cpp +++ b/ndb/src/ndbapi/NdbConnectionScan.cpp @@ -27,10 +27,12 @@ * Documentation: * Adjust: 2000-06-12 UABRONM First version. ****************************************************************************/ -#include "Ndb.hpp" -#include "NdbConnection.hpp" -#include "NdbOperation.hpp" -#include "NdbScanOperation.hpp" +#include + +#include +#include +#include +#include #include "NdbScanReceiver.hpp" #include "NdbApiSignal.hpp" #include "TransporterFacade.hpp" @@ -41,7 +43,6 @@ #include #include -#include // time out for next scan result (-1 is infinite) // XXX should change default only if non-trivial interpreted program is used diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index ec9a56cda62..b068ea6460f 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -646,7 +646,6 @@ NdbDictionary::Dictionary::Dictionary(NdbDictionaryImpl & impl) : m_impl(impl) { } -#include NdbDictionary::Dictionary::~Dictionary(){ NdbDictionaryImpl * tmp = &m_impl; if(this != tmp){ diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index bd94ba9b080..02e3ee23f9c 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -35,7 +35,6 @@ #include #include #include "NdbEventOperationImpl.hpp" -#include #define DEBUG_PRINT 0 #define INCOMPATIBLE_VERSION -2 diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp index f6b0644ea15..3263a636a79 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -33,7 +33,7 @@ class NdbDictObjectImpl { public: - int m_version; + Uint32 m_version; NdbDictionary::Object::Status m_status; bool change(); diff --git a/ndb/include/portlib/NdbStdio.h b/ndb/src/ndbapi/NdbErrorOut.cpp similarity index 56% rename from ndb/include/portlib/NdbStdio.h rename to ndb/src/ndbapi/NdbErrorOut.cpp index 163b7eeef6f..07e0b2fe6e8 100644 --- a/ndb/include/portlib/NdbStdio.h +++ b/ndb/src/ndbapi/NdbErrorOut.cpp @@ -14,23 +14,32 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - * NdbStdio.h - stdio.h for ndb - * - * + +#include + +#include + +#include + +/** + * operators */ +NdbOut & +operator<<(NdbOut & out, const NdbError & error){ + if(error.message != 0) + out << error.code << ": " << error.message; + else + out << error.code << ": "; + return out; +} +NdbOut & +operator<<(NdbOut & out, const NdbError::Status & status){ + return out << ndberror_status_message((ndberror_status)status); +} -#if defined NDB_OSE || defined NDB_SOFTOSE -/* On OSE Delta the snprintf is declare in outfmt.h */ -#include -#endif - -#include - -#ifdef NDB_WIN32 -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define strtok_r(s1, s2, l) strtok(s1, s2) -#endif +NdbOut & +operator<<(NdbOut & out, const NdbError::Classification & classification){ + return out << ndberror_classification_message((ndberror_classification)classification); +} diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index d167b8205a2..acc726e28c5 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - +#include +#include #include "NdbDictionaryImpl.hpp" #include "API.hpp" @@ -24,21 +24,12 @@ #include #include "NdbApiSignal.hpp" #include "TransporterFacade.hpp" -#include -#include -#include -#include #include #include -#include -#include -#include #include #include #include #include -#include -#include #include #include #include diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp index eaa2b35965b..ccbfa767542 100644 --- a/ndb/src/ndbapi/NdbOperation.cpp +++ b/ndb/src/ndbapi/NdbOperation.cpp @@ -37,7 +37,6 @@ #include "API.hpp" #include -#include /****************************************************************************** diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index a1ce25f19d1..18f8b79d12e 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -164,7 +164,6 @@ NdbOperation::readTupleExclusive() int NdbOperation::simpleRead() { - NdbConnection* tNdbCon = theNdbCon; int tErrorLine = theErrorLine; if (theStatus == Init) { theStatus = OperationDefined; @@ -193,7 +192,6 @@ NdbOperation::dirtyRead() int NdbOperation::committedRead() { - NdbConnection* tNdbCon = theNdbCon; int tErrorLine = theErrorLine; if (theStatus == Init) { theStatus = OperationDefined; diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp index 1b0ad68b1eb..b2a6f99880c 100644 --- a/ndb/src/ndbapi/NdbOperationExec.cpp +++ b/ndb/src/ndbapi/NdbOperationExec.cpp @@ -25,11 +25,12 @@ Version: 1.2 Description: Documentation: ***************************************************************************/ -#include "NdbOperation.hpp" -#include "NdbConnection.hpp" + +#include +#include #include "NdbApiSignal.hpp" -#include "Ndb.hpp" -#include "NdbRecAttr.hpp" +#include +#include #include "NdbUtil.hpp" #include "Interpreter.hpp" diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp index 42f2b1d10d8..e1d5e823077 100644 --- a/ndb/src/ndbapi/NdbOperationSearch.cpp +++ b/ndb/src/ndbapi/NdbOperationSearch.cpp @@ -319,7 +319,7 @@ NdbOperation::setTupleId() return 0; } Uint64 tTupleId = theNdb->getTupleIdFromNdb(m_currentTable->m_tableId); - if (tTupleId == ~0){ + if (tTupleId == ~(Uint64)0){ setErrorCodeAbort(theNdb->theError.code); return 0; } diff --git a/ndb/src/ndbapi/NdbPoolImpl.cpp b/ndb/src/ndbapi/NdbPoolImpl.cpp index 08252d26d79..131edc74246 100644 --- a/ndb/src/ndbapi/NdbPoolImpl.cpp +++ b/ndb/src/ndbapi/NdbPoolImpl.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "NdbPoolImpl.hpp" -#include -#include NdbMutex *NdbPool::pool_mutex = NULL; NdbPool *the_pool = NULL; diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 11f36fbd2c4..0f7baeac4f5 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -26,8 +26,8 @@ Description: Interface between TIS and NDB Documentation: Adjust: 971206 UABRONM First version ************************************************************************************************/ +#include #include "NdbRecAttr.hpp" -#include #include "NdbDictionaryImpl.hpp" NdbRecAttr::NdbRecAttr() : diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index b3df639e9d7..31560052bae 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -26,6 +26,7 @@ * Adjust: 2002-04-01 UABMASD First version. ****************************************************************************/ +#include #include #include #include @@ -33,12 +34,6 @@ #include "NdbApiSignal.hpp" #include #include "NdbDictionaryImpl.hpp" -#include -#ifndef NDB_MACOSX -#include -#else -#include -#endif NdbScanOperation::NdbScanOperation(Ndb* aNdb) : NdbCursorOperation(aNdb), @@ -639,6 +634,24 @@ SetValueRecList::callSetValueFn(SetValueRec& aSetValueRec, NdbOperation& oper) } } +SetValueRec::~SetValueRec() +{ + if ((stype == SET_STRING_ATTR1) || + (stype == SET_INT32_ATTR1) || + (stype == SET_UINT32_ATTR1) || + (stype == SET_INT64_ATTR1) || + (stype == SET_UINT64_ATTR1) || + (stype == SET_FLOAT_ATTR1) || + (stype == SET_DOUBLE_ATTR1)) + free(anAttrName); + + if ((stype == SET_STRING_ATTR1) || + (stype == SET_STRING_ATTR2)) + free(stringStruct.aStringValue); + if (next) delete next; + next = 0; +} + int NdbScanOperation::equal_impl(const NdbColumnImpl* anAttrObject, const char* aValue, diff --git a/ndb/src/ndbapi/NdbScanReceiver.hpp b/ndb/src/ndbapi/NdbScanReceiver.hpp index 5e316719194..72f9e48f02c 100644 --- a/ndb/src/ndbapi/NdbScanReceiver.hpp +++ b/ndb/src/ndbapi/NdbScanReceiver.hpp @@ -24,7 +24,6 @@ #include "NdbReceiver.hpp" #include -#include class NdbScanReceiver { diff --git a/ndb/src/ndbapi/NdbSchemaOp.cpp b/ndb/src/ndbapi/NdbSchemaOp.cpp index 9f4d7fbcfd4..9e495229661 100644 --- a/ndb/src/ndbapi/NdbSchemaOp.cpp +++ b/ndb/src/ndbapi/NdbSchemaOp.cpp @@ -29,6 +29,7 @@ Documentation: Handles createTable and createAttribute calls Adjust: 980125 UABMNST First version. 020826 EMIKRON New version for new DICT *****************************************************************************/ +#include #include "NdbSchemaOp.hpp" #include "NdbSchemaCon.hpp" #include "API.hpp" @@ -139,6 +140,8 @@ NdbSchemaOp::createAttribute( const char* anAttrName, case String: col.setType(NdbDictionary::Column::Char); break; + case NoAttrTypeDef: + abort(); } col.setLength(anArraySize); col.setNullable(nullable); diff --git a/ndb/src/ndbapi/NdbUtil.hpp b/ndb/src/ndbapi/NdbUtil.hpp index eeee087d548..6a82af85987 100644 --- a/ndb/src/ndbapi/NdbUtil.hpp +++ b/ndb/src/ndbapi/NdbUtil.hpp @@ -29,8 +29,7 @@ Comment: #ifndef NdbUtil_H #define NdbUtil_H -#include -#include +#include #include "AttrType.hpp" class NdbApiSignal; diff --git a/ndb/src/ndbapi/Ndberror.cpp b/ndb/src/ndbapi/Ndberror.cpp index ee668605f0d..faa2f00cfce 100644 --- a/ndb/src/ndbapi/Ndberror.cpp +++ b/ndb/src/ndbapi/Ndberror.cpp @@ -16,571 +16,6 @@ #include -#include -#include - -#include - -struct ErrorBundle { - int code; - NdbError::Classification classification; - const char * message; -}; - -/** - * Shorter names in table below - */ -static const NdbError::Classification NE = NdbError::NoError; -static const NdbError::Classification AE = NdbError::ApplicationError; -static const NdbError::Classification ND = NdbError::NoDataFound; -static const NdbError::Classification CV = NdbError::ConstraintViolation; -static const NdbError::Classification SE = NdbError::SchemaError; -static const NdbError::Classification UD = NdbError::UserDefinedError; - -static const NdbError::Classification IS = NdbError::InsufficientSpace; -static const NdbError::Classification TR = NdbError::TemporaryResourceError; -static const NdbError::Classification NR = NdbError::NodeRecoveryError; -static const NdbError::Classification OL = NdbError::OverloadError; -static const NdbError::Classification TO = NdbError::TimeoutExpired; -static const NdbError::Classification NS = NdbError::NodeShutdown; - -static const NdbError::Classification UR = NdbError::UnknownResultError; - -static const NdbError::Classification IE = NdbError::InternalError; -static const NdbError::Classification NI = NdbError::FunctionNotImplemented; -static const NdbError::Classification UE = NdbError::UnknownErrorCode; - -static -const -ErrorBundle ErrorCodes[] = { - /** - * No error - */ - { 0, NE, "No error" }, - - /** - * NoDataFound - */ - { 626, ND, "Tuple did not exist" }, - - /** - * ConstraintViolation - */ - { 630, CV, "Tuple already existed when attempting to insert" }, - { 840, CV, "Trying to set a NOT NULL attribute to NULL" }, - { 893, CV, "Constraint violation e.g. duplicate value in unique index" }, - - /** - * Node recovery errors - */ - { 286, NR, "Node failure caused abort of transaction" }, - { 250, NR, "Node where lock was held crashed, restart scan transaction" }, - { 499, NR, "Scan take over error, restart scan transaction" }, - { 1204, NR, "Temporary failure, distribution changed" }, - { 4002, NR, "Send to NDB failed" }, - { 4010, NR, "Node failure caused abort of transaction" }, - { 4025, NR, "Node failure caused abort of transaction" }, - { 4027, NR, "Node failure caused abort of transaction" }, - { 4028, NR, "Node failure caused abort of transaction" }, - { 4029, NR, "Node failure caused abort of transaction" }, - { 4031, NR, "Node failure caused abort of transaction" }, - { 4033, NR, "Send to NDB failed" }, - - /** - * Node shutdown - */ - { 280, NS, "Transaction aborted due to node shutdown" }, - // This scan trans had an active fragment scan in a LQH which have crashed - { 270, NS, "Transaction aborted due to node shutdown" }, - { 1223, NS, "Read operation aborted due to node shutdown" }, - { 4023, NS, "Transaction aborted due to node shutdown" }, - { 4030, NS, "Transaction aborted due to node shutdown" }, - { 4034, NS, "Transaction aborted due to node shutdown" }, - - - - /** - * Unknown result - */ - { 4008, UR, "Receive from NDB failed" }, - { 4009, UR, "Cluster Failure" }, - { 4012, UR, - "Time-out, most likely caused by simple read or cluster failure" }, - { 4024, UR, - "Time-out, most likely caused by simple read or cluster failure" }, - { 4115, UR, - "Transaction was committed but all read information was not " - "received due to node crash" }, - - /** - * TemporaryResourceError - */ - { 217, TR, "217" }, - { 218, TR, "218" }, - { 219, TR, "219" }, - { 233, TR, "Out of operation records in transaction coordinator" }, - { 275, TR, "275" }, - { 279, TR, "Out of transaction markers in transaction coordinator" }, - { 414, TR, "414" }, - { 418, TR, "Out of transaction buffers in LQH" }, - { 419, TR, "419" }, - { 245, TR, "Too many active scans" }, - { 488, TR, "Too many active scans" }, - { 490, TR, "Too many active scans" }, - { 805, TR, "Out of attrinfo records in tuple manager" }, - { 830, TR, "Out of add fragment operation records" }, - { 873, TR, "Out of attrinfo records for scan in tuple manager" }, - { 1217, TR, "1217" }, - { 1219, TR, "Out of operation records in local data manager" }, - { 1220, TR, "1220" }, - { 1222, TR, "Out of transaction markers in LQH" }, - { 4021, TR, "Out of Send Buffer space in NDB API" }, - { 4022, TR, "Out of Send Buffer space in NDB API" }, - { 4032, TR, "Out of Send Buffer space in NDB API" }, - - /** - * InsufficientSpace - */ - { 623, IS, "623" }, - { 624, IS, "624" }, - { 625, IS, "Out of memory in Ndb Kernel, index part" }, - { 826, IS, "826" }, - { 827, IS, "Out of memory in Ndb Kernel, data part" }, - { 832, IS, "832" }, - - /** - * TimeoutExpired - */ - { 266, TO, "Time-out in NDB, probably caused by deadlock" }, - { 274, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout - { 296, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout - { 297, TO, "Time-out in NDB, probably caused by deadlock" }, // Scan trans timeout, temporary!! - { 237, TO, "Transaction had timed out when trying to commit it" }, - - - /** - * OverloadError - */ - { 410, OL, "Out of log file space temporarily" }, - { 677, OL, "Index UNDO buffers overloaded" }, - { 891, OL, "Data UNDO buffers overloaded" }, - { 1221, OL, "REDO log buffers overloaded" }, - { 4006, AE, "Connect failure - out of connection objects" }, - - - - /** - * Internal errors - */ - { 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" }, - { 895, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" }, - { 202, IE, "202" }, - { 203, IE, "203" }, - { 207, IE, "207" }, - { 208, IE, "208" }, - { 209, IE, "Communication problem, signal error" }, - { 220, IE, "220" }, - { 230, IE, "230" }, - { 232, IE, "232" }, - { 238, IE, "238" }, - { 271, IE, "Simple Read transaction without any attributes to read" }, - { 272, IE, "Update operation without any attributes to update" }, - { 276, IE, "276" }, - { 277, IE, "277" }, - { 278, IE, "278" }, - { 287, IE, "Index corrupted" }, - { 631, IE, "631" }, - { 632, IE, "632" }, - { 702, IE, "Request to non-master" }, - { 706, IE, "Inconsistency during table creation" }, - { 809, IE, "809" }, - { 812, IE, "812" }, - { 829, IE, "829" }, - { 833, IE, "833" }, - { 839, IE, "Illegal null attribute" }, - { 871, IE, "871" }, - { 882, IE, "882" }, - { 883, IE, "883" }, - { 887, IE, "887" }, - { 888, IE, "888" }, - { 890, IE, "890" }, - { 4000, IE, "MEMORY ALLOCATION ERROR" }, - { 4001, IE, "Signal Definition Error" }, - { 4005, IE, "Internal Error in NdbApi" }, - { 4011, IE, "Internal Error in NdbApi" }, - { 4107, IE, "Simple Transaction and Not Start" }, - { 4108, IE, "Faulty operation type" }, - { 4109, IE, "Faulty primary key attribute length" }, - { 4110, IE, "Faulty length in ATTRINFO signal" }, - { 4111, IE, "Status Error in NdbConnection" }, - { 4113, IE, "Too many operations received" }, - { 4320, IE, "Cannot use the same object twice to create table" }, - { 4321, IE, "Trying to start two schema transactions" }, - { 4344, IE, "Only DBDICT and TRIX can send requests to TRIX" }, - { 4345, IE, "TRIX block is not available yet, probably due to node failure" }, - { 4346, IE, "Internal error at index create/build" }, - { 4347, IE, "Bad state at alter index" }, - { 4348, IE, "Inconsistency detected at alter index" }, - { 4349, IE, "Inconsistency detected at index usage" }, - - /** - * Application error - */ - { 823, AE, "Too much attrinfo from application in tuple manager" }, - { 876, AE, "876" }, - { 877, AE, "877" }, - { 878, AE, "878" }, - { 879, AE, "879" }, - { 884, AE, "Stack overflow in interpreter" }, - { 885, AE, "Stack underflow in interpreter" }, - { 886, AE, "More than 65535 instructions executed in interpreter" }, - { 4256, AE, "Must call Ndb::init() before this function" }, - { 880, AE, "Tried to read too much - too many getValue calls" }, - { 4257, AE, "Tried to read too much - too many getValue calls" }, - - /** - * Scan application errors - */ - { 242, AE, "Zero concurrency in scan"}, - { 244, AE, "Too high concurrency in scan"}, - { 269, AE, "No condition and attributes to read in scan"}, - { 4600, AE, "Transaction is already started"}, - { 4601, AE, "Transaction is not started"}, - { 4602, AE, "You must call getNdbOperation before executeScan" }, - { 4603, AE, "There can only be ONE operation in a scan transaction" }, - { 4604, AE, "takeOverScanOp, opType must be UpdateRequest or DeleteRequest" }, - { 4605, AE, "You may only call openScanRead or openScanExclusive once for each operation"}, - { 4607, AE, "There may only be one operation in a scan transaction"}, - { 4608, AE, "You can not takeOverScan unless you have used openScanExclusive"}, - { 4609, AE, "You must call nextScanResult before trying to takeOverScan"}, - { 4232, AE, "Parallelism can only be between 1 and 240" }, - { 290, AE, "Scan not started or has been closed by kernel due to timeout" }, - - /** - * SchemaError - */ - { 701, SE, "System busy with other schema operation" }, - { 703, SE, "Invalid table format" }, - { 704, SE, "Attribute name too long" }, - { 705, SE, "Table name too long" }, - { 707, SE, "No more table metadata records" }, - { 708, SE, "No more attribute metadata records" }, - { 709, SE, "No such table existed" }, - { 721, SE, "Table or index with given name already exists" }, - { 723, SE, "No such table existed" }, - { 736, SE, "Wrong attribute size" }, - { 737, SE, "Attribute array size too big" }, - { 738, SE, "Record too big" }, - { 739, SE, "Unsupported primary key length" }, - { 740, SE, "Nullable primary key not supported" }, - { 741, SE, "Unsupported alter table" }, - { 241, SE, "Invalid schema object version" }, - { 283, SE, "Table is being dropped" }, - { 284, SE, "Table not defined in transaction coordinator" }, - { 285, SE, "Unknown table error in transaction coordinator" }, - { 881, SE, "Unable to create table, out of data pages" }, - { 1225, SE, "Table not defined in local query handler" }, - { 1226, SE, "Table is being dropped" }, - { 1228, SE, "Cannot use drop table for drop index" }, - { 1229, SE, "Too long frm data supplied" }, - - /** - * FunctionNotImplemented - */ - { 4003, NI, "Function not implemented yet" }, - - /** - * Still uncategorized - */ - { 720, AE, "Attribute name reused in table definition" }, - { 4004, AE, "Attribute name not found in the Table" }, - - { 4100, AE, "Status Error in NDB" }, - { 4101, AE, "No connections to NDB available and connect failed" }, - { 4102, AE, "Type in NdbTamper not correct" }, - { 4103, AE, "No schema connections to NDB available and connect failed" }, - { 4104, AE, "Ndb Init in wrong state, destroy Ndb object and create a new" }, - { 4105, AE, "Too many Ndb objects" }, - { 4106, AE, "All Not NULL attribute have not been defined" }, - { 4114, AE, "Transaction is already completed" }, - { 4116, AE, "Operation was not defined correctly, probably missing a key" }, - { 4117, AE, "Could not start transporter, configuration error"}, - { 4118, AE, "Parameter error in API call" }, - { 4300, AE, "Tuple Key Type not correct" }, - { 4301, AE, "Fragment Type not correct" }, - { 4302, AE, "Minimum Load Factor not correct" }, - { 4303, AE, "Maximum Load Factor not correct" }, - { 4304, AE, "Maximum Load Factor smaller than Minimum" }, - { 4305, AE, "K value must currently be set to 6" }, - { 4306, AE, "Memory Type not correct" }, - { 4307, AE, "Invalid table name" }, - { 4308, AE, "Attribute Size not correct" }, - { 4309, AE, "Fixed array too large, maximum 64000 bytes" }, - { 4310, AE, "Attribute Type not correct" }, - { 4311, AE, "Storage Mode not correct" }, - { 4312, AE, "Null Attribute Type not correct" }, - { 4313, AE, "Index only storage for non-key attribute" }, - { 4314, AE, "Storage Type of attribute not correct" }, - { 4315, AE, "No more key attributes allowed after defining variable length key attribute" }, - { 4316, AE, "Key attributes are not allowed to be NULL attributes" }, - { 4317, AE, "Too many primary keys defined in table" }, - { 4318, AE, "Invalid attribute name" }, - { 4319, AE, "createAttribute called at erroneus place" }, - { 4322, AE, "Attempt to define distribution key when not prepared to" }, - { 4323, AE, "Distribution Key set on table but not defined on first attribute" }, - { 4324, AE, "Attempt to define distribution group when not prepared to" }, - { 4325, AE, "Distribution Group set on table but not defined on first attribute" }, - { 4326, AE, "Distribution Group with erroneus number of bits" }, - { 4327, AE, "Distribution Group with 1 byte attribute is not allowed" }, - { 4328, AE, "Disk memory attributes not yet supported" }, - { 4329, AE, "Variable stored attributes not yet supported" }, - { 4330, AE, "Table names limited to 127 bytes" }, - { 4331, AE, "Attribute names limited to 31 bytes" }, - { 4332, AE, "Maximum 2000 attributes in a table" }, - { 4333, AE, "Maximum 4092 bytes long keys allowed" }, - { 4334, AE, "Attribute properties length limited to 127 bytes" }, - - { 4400, AE, "Status Error in NdbSchemaCon" }, - { 4401, AE, "Only one schema operation per schema transaction" }, - { 4402, AE, "No schema operation defined before calling execute" }, - - { 4500, AE, "Cannot handle more than 2048 tables in NdbApi" }, - { 4501, AE, "Insert in hash table failed when getting table information from Ndb" }, - { 4502, AE, "GetValue not allowed in Update operation" }, - { 4503, AE, "GetValue not allowed in Insert operation" }, - { 4504, AE, "SetValue not allowed in Read operation" }, - { 4505, AE, "NULL value not allowed in primary key search" }, - { 4506, AE, "Missing getValue/setValue when calling execute" }, - { 4507, AE, "Missing operation request when calling execute" }, - - { 4200, AE, "Status Error when defining an operation" }, - { 4201, AE, "Variable Arrays not yet supported" }, - { 4202, AE, "Set value on tuple key attribute is not allowed" }, - { 4203, AE, "Trying to set a NOT NULL attribute to NULL" }, - { 4204, AE, "Set value and Read/Delete Tuple is incompatible" }, - { 4205, AE, "No Key attribute used to define tuple" }, - { 4206, AE, "Not allowed to equal key attribute twice" }, - { 4207, AE, "Key size is limited to 4092 bytes" }, - { 4208, AE, "Trying to read a non-stored attribute" }, - { 4209, AE, "Length parameter in equal/setValue is incorrect" }, - { 4210, AE, "Ndb sent more info than the length he specified" }, - { 4211, AE, "Inconsistency in list of NdbRecAttr-objects" }, - { 4212, AE, "Ndb reports NULL value on Not NULL attribute" }, - { 4213, AE, "Not all data of an attribute has been received" }, - { 4214, AE, "Not all attributes have been received" }, - { 4215, AE, "More data received than reported in TCKEYCONF message" }, - { 4216, AE, "More than 8052 bytes in setValue cannot be handled" }, - { 4217, AE, "It is not allowed to increment any other than unsigned ints" }, - { 4218, AE, "Currently not allowed to increment NULL-able attributes" }, - { 4219, AE, "Maximum size of interpretative attributes are 64 bits" }, - { 4220, AE, "Maximum size of interpretative attributes are 64 bits" }, - { 4221, AE, "Trying to jump to a non-defined label" }, - { 4222, AE, "Label was not found, internal error" }, - { 4223, AE, "Not allowed to create jumps to yourself" }, - { 4224, AE, "Not allowed to jump to a label in a different subroutine" }, - { 4225, AE, "All primary keys defined, call setValue/getValue"}, - { 4226, AE, "Bad number when defining a label" }, - { 4227, AE, "Bad number when defining a subroutine" }, - { 4228, AE, "Illegal interpreter function in scan definition" }, - { 4229, AE, "Illegal register in interpreter function definition" }, - { 4230, AE, "Illegal state when calling getValue, probably not a read" }, - { 4231, AE, "Illegal state when calling interpreter routine" }, - { 4233, AE, "Calling execute (synchronous) when already prepared asynchronous transaction exists" }, - { 4234, AE, "Illegal to call setValue in this state" }, - { 4235, AE, "No callback from execute" }, - { 4236, AE, "Trigger name too long" }, - { 4237, AE, "Too many triggers" }, - { 4238, AE, "Trigger not found" }, - { 4239, AE, "Trigger with given name already exists"}, - { 4240, AE, "Unsupported trigger type"}, - { 4241, AE, "Index name too long" }, - { 4242, AE, "Too many indexes" }, - { 4243, AE, "Index not found" }, - { 4244, AE, "Index or table with given name already exists" }, - { 4245, AE, "Index attribute must be defined as stored, i.e. the StorageAttributeType must be defined as NormalStorageAttribute"}, - { 4246, AE, "Combined index attributes are not allowed to be NULL attributes" }, - { 4247, AE, "Illegal index/trigger create/drop/alter request" }, - { 4248, AE, "Trigger/index name invalid" }, - { 4249, AE, "Invalid table" }, - { 4250, AE, "Invalid index type or index logging option" }, - { 4251, AE, "Cannot create unique index, duplicate keys found" }, - { 4252, AE, "Failed to allocate space for index" }, - { 4253, AE, "Failed to create index table" }, - { 4254, AE, "Table not an index table" }, - { 4255, AE, "Hash index attributes must be specified in same order as table attributes" }, - { 4258, AE, "Cannot create unique index, duplicate attributes found in definition" }, - { 4259, AE, "Invalid set of range scan bounds" }, - { 4260, UD, "NdbScanFilter: Operator is not defined in NdbScanFilter::Group"}, - { 4261, UD, "NdbScanFilter: Column is NULL"}, - { 4262, UD, "NdbScanFilter: Condition is out of bounds"} - -}; - -static -const -int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle); - -struct ErrorStatusClassification { - NdbError::Status status; - NdbError::Classification classification; -}; - -/** - * Mapping between classification and status - */ -static -const -ErrorStatusClassification StatusClassificationMapping[] = { - { NdbError::Success, NdbError::NoError }, - { NdbError::PermanentError, NdbError::ApplicationError }, - { NdbError::PermanentError, NdbError::NoDataFound }, - { NdbError::PermanentError, NdbError::ConstraintViolation }, - { NdbError::PermanentError, NdbError::SchemaError }, - { NdbError::PermanentError, NdbError::UserDefinedError }, - { NdbError::PermanentError, NdbError::InsufficientSpace }, - - { NdbError::TemporaryError, NdbError::TemporaryResourceError }, - { NdbError::TemporaryError, NdbError::NodeRecoveryError }, - { NdbError::TemporaryError, NdbError::OverloadError }, - { NdbError::TemporaryError, NdbError::TimeoutExpired }, - { NdbError::TemporaryError, NdbError::NodeShutdown }, - - { NdbError::UnknownResult , NdbError::UnknownResultError }, - { NdbError::UnknownResult , NdbError::UnknownErrorCode }, - - { NdbError::PermanentError, NdbError::InternalError }, - { NdbError::PermanentError, NdbError::FunctionNotImplemented } -}; - -static -const -int Nb = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); - -/** - * Complete all fields of an NdbError given the error code - * and details - */ -static -void -set(NdbError & error, int code, const char * details, ...){ - error.code = code; - - va_list ap; - va_start(ap, details); - vsnprintf(error.details, sizeof(error.details), details, ap); - va_end(ap); -} - -static -void -update(const NdbError & _err){ - NdbError & error = (NdbError &) _err; - - bool found = false; - for(int i = 0; i - -/** - * operators - */ -NdbOut & -operator<<(NdbOut & out, const NdbError & error){ - if(error.message != 0) - out << error.code << ": " << error.message; - else - out << error.code << ": "; - return out; -} - -NdbOut & -operator<<(NdbOut & out, const NdbError::Status & status){ - switch(status) { - case NdbError::Success: out << "Success"; break; - case NdbError::TemporaryError: out << "Temporary error"; break; - case NdbError::PermanentError: out << "Permanent error"; break; - case NdbError::UnknownResult: out << "Unknown result"; break; - } - return out; -} - -NdbOut & -operator<<(NdbOut & out, const NdbError::Classification & classification){ - switch(classification) { - case NdbError::NoError: out << "No error"; break; - case NdbError::ApplicationError: out << "Application error"; break; - case NdbError::NoDataFound: out << "No data found"; break; - case NdbError::ConstraintViolation: out << "Constraint violation"; break; - case NdbError::SchemaError: out << "Schema error"; break; - case NdbError::UserDefinedError: out << "User defined error"; break; - case NdbError::InsufficientSpace: out << "Insufficient space"; break; - case NdbError::TemporaryResourceError: out << "Temporary Resource error"; - break; - case NdbError::NodeRecoveryError: out << "Node Recovery error"; break; - case NdbError::OverloadError: out << "Overload error"; break; - case NdbError::TimeoutExpired: out << "Timeout expired"; break; - case NdbError::UnknownResultError: out << "Unknown result error"; break; - case NdbError::InternalError: out << "Internal error"; break; - case NdbError::FunctionNotImplemented: out << "Function not implemented"; - break; - case NdbError::UnknownErrorCode: out << "Unknown error code"; break; - case NdbError::NodeShutdown: out << "Node shutdown"; break; - } - return out; -} - -/****************************************************** - * - */ #include "NdbImpl.hpp" #include "NdbDictionaryImpl.hpp" #include @@ -588,6 +23,14 @@ operator<<(NdbOut & out, const NdbError::Classification & classification){ #include +static void +update(const NdbError & _err){ + NdbError & error = (NdbError &) _err; + ndberror_struct ndberror = (ndberror_struct)error; + ndberror_update(&ndberror); + error = NdbError(ndberror); +} + const NdbError & Ndb::getNdbError(int code){ @@ -630,6 +73,3 @@ NdbSchemaCon::getNdbError() const { update(theError); return theError; } - - - diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index e334c1bcc39..696dfe68e40 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -40,7 +40,6 @@ #include #include -#include /****************************************************************************** * int init( int aNrOfCon, int aNrOfOp ); diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index 9afbbf0df1f..be7acc48d7a 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -55,6 +55,7 @@ Parameters: aDataBase : Name of the database. Remark: Connect to the database. ***************************************************************************/ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : + theNdbObjectIdMap(0), thePreparedTransactionsArray(NULL), theSentTransactionsArray(NULL), theCompletedTransactionsArray(NULL), @@ -89,8 +90,7 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) : theFirstTransId(0), theRestartGCI(0), theNdbBlockNumber(-1), - theInitState(NotConstructed), - theNdbObjectIdMap(0) + theInitState(NotConstructed) { cgetSignals =0; cfreeSignals = 0; diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp index a2a8d00b48f..4abb54b5081 100644 --- a/ndb/src/ndbapi/ObjectMap.hpp +++ b/ndb/src/ndbapi/ObjectMap.hpp @@ -17,10 +17,8 @@ #ifndef NDB_OBJECT_ID_MAP_HPP #define NDB_OBJECT_ID_MAP_HPP -#include +#include //#include -#include -#include #include //#define DEBUG_OBJECTMAP diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index 746ab169b41..f4a3ae3e87d 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -14,8 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include -#include "AttrType.hpp" +#include #include "TransporterFacade.hpp" #include "ClusterMgr.hpp" #include @@ -25,14 +26,12 @@ #include #include #include -#include #include "API.hpp" #include #include #include #include -#include #if !defined NDB_OSE && !defined NDB_SOFTOSE #include diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c new file mode 100644 index 00000000000..ea7cf4de426 --- /dev/null +++ b/ndb/src/ndbapi/ndberror.c @@ -0,0 +1,590 @@ +/* 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 + +#include + +typedef struct ErrorBundle { + int code; + ndberror_classification classification; + const char * message; +} ErrorBundle; + +/** + * Shorter names in table below + */ + +#define ST_S ndberror_st_success +#define ST_P ndberror_st_permanent +#define ST_T ndberror_st_temporary +#define ST_U ndberror_st_unknown + +#define NE ndberror_cl_none +#define AE ndberror_cl_application +#define ND ndberror_cl_no_data_found +#define CV ndberror_cl_constraint_violation +#define SE ndberror_cl_schema_error +#define UD ndberror_cl_user_defined + +#define IS ndberror_cl_insufficient_space +#define TR ndberror_cl_temporary_resource +#define NR ndberror_cl_node_recovery +#define OL ndberror_cl_overload +#define TO ndberror_cl_timeout_expired +#define NS ndberror_cl_node_shutdown + +#define UR ndberror_cl_unknown_result + +#define IE ndberror_cl_internal_error +#define NI ndberror_cl_function_not_implemented +#define UE ndberror_cl_unknown_error_code + +static const char* empty_string = ""; + +static +const +ErrorBundle ErrorCodes[] = { + /** + * No error + */ + { 0, NE, "No error" }, + + /** + * NoDataFound + */ + { 626, ND, "Tuple did not exist" }, + + /** + * ConstraintViolation + */ + { 630, CV, "Tuple already existed when attempting to insert" }, + { 840, CV, "Trying to set a NOT NULL attribute to NULL" }, + { 893, CV, "Constraint violation e.g. duplicate value in unique index" }, + + /** + * Node recovery errors + */ + { 286, NR, "Node failure caused abort of transaction" }, + { 250, NR, "Node where lock was held crashed, restart scan transaction" }, + { 499, NR, "Scan take over error, restart scan transaction" }, + { 1204, NR, "Temporary failure, distribution changed" }, + { 4002, NR, "Send to NDB failed" }, + { 4010, NR, "Node failure caused abort of transaction" }, + { 4025, NR, "Node failure caused abort of transaction" }, + { 4027, NR, "Node failure caused abort of transaction" }, + { 4028, NR, "Node failure caused abort of transaction" }, + { 4029, NR, "Node failure caused abort of transaction" }, + { 4031, NR, "Node failure caused abort of transaction" }, + { 4033, NR, "Send to NDB failed" }, + + /** + * Node shutdown + */ + { 280, NS, "Transaction aborted due to node shutdown" }, + /* This scan trans had an active fragment scan in a LQH which have crashed */ + { 270, NS, "Transaction aborted due to node shutdown" }, + { 1223, NS, "Read operation aborted due to node shutdown" }, + { 4023, NS, "Transaction aborted due to node shutdown" }, + { 4030, NS, "Transaction aborted due to node shutdown" }, + { 4034, NS, "Transaction aborted due to node shutdown" }, + + + + /** + * Unknown result + */ + { 4008, UR, "Receive from NDB failed" }, + { 4009, UR, "Cluster Failure" }, + { 4012, UR, + "Time-out, most likely caused by simple read or cluster failure" }, + { 4024, UR, + "Time-out, most likely caused by simple read or cluster failure" }, + { 4115, UR, + "Transaction was committed but all read information was not " + "received due to node crash" }, + + /** + * TemporaryResourceError + */ + { 217, TR, "217" }, + { 218, TR, "218" }, + { 219, TR, "219" }, + { 233, TR, "Out of operation records in transaction coordinator" }, + { 275, TR, "275" }, + { 279, TR, "Out of transaction markers in transaction coordinator" }, + { 414, TR, "414" }, + { 418, TR, "Out of transaction buffers in LQH" }, + { 419, TR, "419" }, + { 245, TR, "Too many active scans" }, + { 488, TR, "Too many active scans" }, + { 490, TR, "Too many active scans" }, + { 805, TR, "Out of attrinfo records in tuple manager" }, + { 830, TR, "Out of add fragment operation records" }, + { 873, TR, "Out of attrinfo records for scan in tuple manager" }, + { 1217, TR, "1217" }, + { 1219, TR, "Out of operation records in local data manager" }, + { 1220, TR, "1220" }, + { 1222, TR, "Out of transaction markers in LQH" }, + { 4021, TR, "Out of Send Buffer space in NDB API" }, + { 4022, TR, "Out of Send Buffer space in NDB API" }, + { 4032, TR, "Out of Send Buffer space in NDB API" }, + + /** + * InsufficientSpace + */ + { 623, IS, "623" }, + { 624, IS, "624" }, + { 625, IS, "Out of memory in Ndb Kernel, index part" }, + { 826, IS, "826" }, + { 827, IS, "Out of memory in Ndb Kernel, data part" }, + { 832, IS, "832" }, + + /** + * TimeoutExpired + */ + { 266, TO, "Time-out in NDB, probably caused by deadlock" }, + { 274, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ + { 296, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout */ + { 297, TO, "Time-out in NDB, probably caused by deadlock" }, /* Scan trans timeout, temporary!! */ + { 237, TO, "Transaction had timed out when trying to commit it" }, + + + /** + * OverloadError + */ + { 410, OL, "Out of log file space temporarily" }, + { 677, OL, "Index UNDO buffers overloaded" }, + { 891, OL, "Data UNDO buffers overloaded" }, + { 1221, OL, "REDO log buffers overloaded" }, + { 4006, AE, "Connect failure - out of connection objects" }, + + + + /** + * Internal errors + */ + { 892, IE, "Inconsistent hash index. The index needs to be dropped and recreated" }, + { 895, IE, "Inconsistent ordered index. The index needs to be dropped and recreated" }, + { 202, IE, "202" }, + { 203, IE, "203" }, + { 207, IE, "207" }, + { 208, IE, "208" }, + { 209, IE, "Communication problem, signal error" }, + { 220, IE, "220" }, + { 230, IE, "230" }, + { 232, IE, "232" }, + { 238, IE, "238" }, + { 271, IE, "Simple Read transaction without any attributes to read" }, + { 272, IE, "Update operation without any attributes to update" }, + { 276, IE, "276" }, + { 277, IE, "277" }, + { 278, IE, "278" }, + { 287, IE, "Index corrupted" }, + { 631, IE, "631" }, + { 632, IE, "632" }, + { 702, IE, "Request to non-master" }, + { 706, IE, "Inconsistency during table creation" }, + { 809, IE, "809" }, + { 812, IE, "812" }, + { 829, IE, "829" }, + { 833, IE, "833" }, + { 839, IE, "Illegal null attribute" }, + { 871, IE, "871" }, + { 882, IE, "882" }, + { 883, IE, "883" }, + { 887, IE, "887" }, + { 888, IE, "888" }, + { 890, IE, "890" }, + { 4000, IE, "MEMORY ALLOCATION ERROR" }, + { 4001, IE, "Signal Definition Error" }, + { 4005, IE, "Internal Error in NdbApi" }, + { 4011, IE, "Internal Error in NdbApi" }, + { 4107, IE, "Simple Transaction and Not Start" }, + { 4108, IE, "Faulty operation type" }, + { 4109, IE, "Faulty primary key attribute length" }, + { 4110, IE, "Faulty length in ATTRINFO signal" }, + { 4111, IE, "Status Error in NdbConnection" }, + { 4113, IE, "Too many operations received" }, + { 4320, IE, "Cannot use the same object twice to create table" }, + { 4321, IE, "Trying to start two schema transactions" }, + { 4344, IE, "Only DBDICT and TRIX can send requests to TRIX" }, + { 4345, IE, "TRIX block is not available yet, probably due to node failure" }, + { 4346, IE, "Internal error at index create/build" }, + { 4347, IE, "Bad state at alter index" }, + { 4348, IE, "Inconsistency detected at alter index" }, + { 4349, IE, "Inconsistency detected at index usage" }, + + /** + * Application error + */ + { 823, AE, "Too much attrinfo from application in tuple manager" }, + { 876, AE, "876" }, + { 877, AE, "877" }, + { 878, AE, "878" }, + { 879, AE, "879" }, + { 884, AE, "Stack overflow in interpreter" }, + { 885, AE, "Stack underflow in interpreter" }, + { 886, AE, "More than 65535 instructions executed in interpreter" }, + { 4256, AE, "Must call Ndb::init() before this function" }, + { 880, AE, "Tried to read too much - too many getValue calls" }, + { 4257, AE, "Tried to read too much - too many getValue calls" }, + + /** + * Scan application errors + */ + { 242, AE, "Zero concurrency in scan"}, + { 244, AE, "Too high concurrency in scan"}, + { 269, AE, "No condition and attributes to read in scan"}, + { 4600, AE, "Transaction is already started"}, + { 4601, AE, "Transaction is not started"}, + { 4602, AE, "You must call getNdbOperation before executeScan" }, + { 4603, AE, "There can only be ONE operation in a scan transaction" }, + { 4604, AE, "takeOverScanOp, opType must be UpdateRequest or DeleteRequest" }, + { 4605, AE, "You may only call openScanRead or openScanExclusive once for each operation"}, + { 4607, AE, "There may only be one operation in a scan transaction"}, + { 4608, AE, "You can not takeOverScan unless you have used openScanExclusive"}, + { 4609, AE, "You must call nextScanResult before trying to takeOverScan"}, + { 4232, AE, "Parallelism can only be between 1 and 240" }, + { 290, AE, "Scan not started or has been closed by kernel due to timeout" }, + + /** + * SchemaError + */ + { 701, SE, "System busy with other schema operation" }, + { 703, SE, "Invalid table format" }, + { 704, SE, "Attribute name too long" }, + { 705, SE, "Table name too long" }, + { 707, SE, "No more table metadata records" }, + { 708, SE, "No more attribute metadata records" }, + { 709, SE, "No such table existed" }, + { 721, SE, "Table or index with given name already exists" }, + { 723, SE, "No such table existed" }, + { 736, SE, "Wrong attribute size" }, + { 737, SE, "Attribute array size too big" }, + { 738, SE, "Record too big" }, + { 739, SE, "Unsupported primary key length" }, + { 740, SE, "Nullable primary key not supported" }, + { 741, SE, "Unsupported alter table" }, + { 241, SE, "Invalid schema object version" }, + { 283, SE, "Table is being dropped" }, + { 284, SE, "Table not defined in transaction coordinator" }, + { 285, SE, "Unknown table error in transaction coordinator" }, + { 881, SE, "Unable to create table, out of data pages" }, + { 1225, SE, "Table not defined in local query handler" }, + { 1226, SE, "Table is being dropped" }, + { 1228, SE, "Cannot use drop table for drop index" }, + { 1229, SE, "Too long frm data supplied" }, + + /** + * FunctionNotImplemented + */ + { 4003, NI, "Function not implemented yet" }, + + /** + * Still uncategorized + */ + { 720, AE, "Attribute name reused in table definition" }, + { 4004, AE, "Attribute name not found in the Table" }, + + { 4100, AE, "Status Error in NDB" }, + { 4101, AE, "No connections to NDB available and connect failed" }, + { 4102, AE, "Type in NdbTamper not correct" }, + { 4103, AE, "No schema connections to NDB available and connect failed" }, + { 4104, AE, "Ndb Init in wrong state, destroy Ndb object and create a new" }, + { 4105, AE, "Too many Ndb objects" }, + { 4106, AE, "All Not NULL attribute have not been defined" }, + { 4114, AE, "Transaction is already completed" }, + { 4116, AE, "Operation was not defined correctly, probably missing a key" }, + { 4117, AE, "Could not start transporter, configuration error"}, + { 4118, AE, "Parameter error in API call" }, + { 4300, AE, "Tuple Key Type not correct" }, + { 4301, AE, "Fragment Type not correct" }, + { 4302, AE, "Minimum Load Factor not correct" }, + { 4303, AE, "Maximum Load Factor not correct" }, + { 4304, AE, "Maximum Load Factor smaller than Minimum" }, + { 4305, AE, "K value must currently be set to 6" }, + { 4306, AE, "Memory Type not correct" }, + { 4307, AE, "Invalid table name" }, + { 4308, AE, "Attribute Size not correct" }, + { 4309, AE, "Fixed array too large, maximum 64000 bytes" }, + { 4310, AE, "Attribute Type not correct" }, + { 4311, AE, "Storage Mode not correct" }, + { 4312, AE, "Null Attribute Type not correct" }, + { 4313, AE, "Index only storage for non-key attribute" }, + { 4314, AE, "Storage Type of attribute not correct" }, + { 4315, AE, "No more key attributes allowed after defining variable length key attribute" }, + { 4316, AE, "Key attributes are not allowed to be NULL attributes" }, + { 4317, AE, "Too many primary keys defined in table" }, + { 4318, AE, "Invalid attribute name" }, + { 4319, AE, "createAttribute called at erroneus place" }, + { 4322, AE, "Attempt to define distribution key when not prepared to" }, + { 4323, AE, "Distribution Key set on table but not defined on first attribute" }, + { 4324, AE, "Attempt to define distribution group when not prepared to" }, + { 4325, AE, "Distribution Group set on table but not defined on first attribute" }, + { 4326, AE, "Distribution Group with erroneus number of bits" }, + { 4327, AE, "Distribution Group with 1 byte attribute is not allowed" }, + { 4328, AE, "Disk memory attributes not yet supported" }, + { 4329, AE, "Variable stored attributes not yet supported" }, + { 4330, AE, "Table names limited to 127 bytes" }, + { 4331, AE, "Attribute names limited to 31 bytes" }, + { 4332, AE, "Maximum 2000 attributes in a table" }, + { 4333, AE, "Maximum 4092 bytes long keys allowed" }, + { 4334, AE, "Attribute properties length limited to 127 bytes" }, + + { 4400, AE, "Status Error in NdbSchemaCon" }, + { 4401, AE, "Only one schema operation per schema transaction" }, + { 4402, AE, "No schema operation defined before calling execute" }, + + { 4500, AE, "Cannot handle more than 2048 tables in NdbApi" }, + { 4501, AE, "Insert in hash table failed when getting table information from Ndb" }, + { 4502, AE, "GetValue not allowed in Update operation" }, + { 4503, AE, "GetValue not allowed in Insert operation" }, + { 4504, AE, "SetValue not allowed in Read operation" }, + { 4505, AE, "NULL value not allowed in primary key search" }, + { 4506, AE, "Missing getValue/setValue when calling execute" }, + { 4507, AE, "Missing operation request when calling execute" }, + + { 4200, AE, "Status Error when defining an operation" }, + { 4201, AE, "Variable Arrays not yet supported" }, + { 4202, AE, "Set value on tuple key attribute is not allowed" }, + { 4203, AE, "Trying to set a NOT NULL attribute to NULL" }, + { 4204, AE, "Set value and Read/Delete Tuple is incompatible" }, + { 4205, AE, "No Key attribute used to define tuple" }, + { 4206, AE, "Not allowed to equal key attribute twice" }, + { 4207, AE, "Key size is limited to 4092 bytes" }, + { 4208, AE, "Trying to read a non-stored attribute" }, + { 4209, AE, "Length parameter in equal/setValue is incorrect" }, + { 4210, AE, "Ndb sent more info than the length he specified" }, + { 4211, AE, "Inconsistency in list of NdbRecAttr-objects" }, + { 4212, AE, "Ndb reports NULL value on Not NULL attribute" }, + { 4213, AE, "Not all data of an attribute has been received" }, + { 4214, AE, "Not all attributes have been received" }, + { 4215, AE, "More data received than reported in TCKEYCONF message" }, + { 4216, AE, "More than 8052 bytes in setValue cannot be handled" }, + { 4217, AE, "It is not allowed to increment any other than unsigned ints" }, + { 4218, AE, "Currently not allowed to increment NULL-able attributes" }, + { 4219, AE, "Maximum size of interpretative attributes are 64 bits" }, + { 4220, AE, "Maximum size of interpretative attributes are 64 bits" }, + { 4221, AE, "Trying to jump to a non-defined label" }, + { 4222, AE, "Label was not found, internal error" }, + { 4223, AE, "Not allowed to create jumps to yourself" }, + { 4224, AE, "Not allowed to jump to a label in a different subroutine" }, + { 4225, AE, "All primary keys defined, call setValue/getValue"}, + { 4226, AE, "Bad number when defining a label" }, + { 4227, AE, "Bad number when defining a subroutine" }, + { 4228, AE, "Illegal interpreter function in scan definition" }, + { 4229, AE, "Illegal register in interpreter function definition" }, + { 4230, AE, "Illegal state when calling getValue, probably not a read" }, + { 4231, AE, "Illegal state when calling interpreter routine" }, + { 4233, AE, "Calling execute (synchronous) when already prepared asynchronous transaction exists" }, + { 4234, AE, "Illegal to call setValue in this state" }, + { 4235, AE, "No callback from execute" }, + { 4236, AE, "Trigger name too long" }, + { 4237, AE, "Too many triggers" }, + { 4238, AE, "Trigger not found" }, + { 4239, AE, "Trigger with given name already exists"}, + { 4240, AE, "Unsupported trigger type"}, + { 4241, AE, "Index name too long" }, + { 4242, AE, "Too many indexes" }, + { 4243, AE, "Index not found" }, + { 4244, AE, "Index or table with given name already exists" }, + { 4245, AE, "Index attribute must be defined as stored, i.e. the StorageAttributeType must be defined as NormalStorageAttribute"}, + { 4246, AE, "Combined index attributes are not allowed to be NULL attributes" }, + { 4247, AE, "Illegal index/trigger create/drop/alter request" }, + { 4248, AE, "Trigger/index name invalid" }, + { 4249, AE, "Invalid table" }, + { 4250, AE, "Invalid index type or index logging option" }, + { 4251, AE, "Cannot create unique index, duplicate keys found" }, + { 4252, AE, "Failed to allocate space for index" }, + { 4253, AE, "Failed to create index table" }, + { 4254, AE, "Table not an index table" }, + { 4255, AE, "Hash index attributes must be specified in same order as table attributes" }, + { 4258, AE, "Cannot create unique index, duplicate attributes found in definition" }, + { 4259, AE, "Invalid set of range scan bounds" }, + { 4260, UD, "NdbScanFilter: Operator is not defined in NdbScanFilter::Group"}, + { 4261, UD, "NdbScanFilter: Column is NULL"}, + { 4262, UD, "NdbScanFilter: Condition is out of bounds"} + +}; + +static +const +int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle); + +typedef struct ErrorStatusMessage { + ndberror_status status; + const char * message; +} ErrorStatusMessage; + +typedef struct ErrorStatusClassification { + ndberror_status status; + ndberror_classification classification; + const char * message; +} ErrorStatusClassification; + +/** + * Mapping between classification and status + */ +static +const +ErrorStatusMessage StatusMessageMapping[] = { + { ST_S, "Success"}, + { ST_P, "Permanent error"}, + { ST_T, "Temporary error"}, + { ST_U ,"Unknown result"} +}; + +static +const +int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage); + +static +const +ErrorStatusClassification StatusClassificationMapping[] = { + { ST_S, NE, "No error"}, + { ST_P, AE, "Application error"}, + { ST_P, ND, "No data found"}, + { ST_P, CV, "Constraint violation"}, + { ST_P, SE, "Schema error"}, + { ST_P, UD, "User defined error"}, + { ST_P, IS, "Insufficient space"}, + + { ST_T, TR, "Temporary Resource error"}, + { ST_T, NR, "Node Recovery error"}, + { ST_T, OL, "Overload error"}, + { ST_T, TO, "Timeout expired"}, + { ST_T, NS, "Node shutdown"}, + + { ST_U , UR, "Unknown result error"}, + { ST_U , UE, "Unknown error code"}, + + { ST_P, IE, "Internal error"}, + { ST_P, NI, "Function not implemented"} +}; + +static +const +int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification); + +/** + * Complete all fields of an NdbError given the error code + * and details + */ +static +void +set(ndberror_struct * error, int code, const char * details, ...){ + error->code = code; + { + va_list ap; + va_start(ap, details); + vsnprintf(error->details, sizeof(error->details), details, ap); + va_end(ap); + } +} + + +void +ndberror_update(ndberror_struct * error){ + + int found = 0; + int i; + + for(i = 0; icode){ + error->classification = ErrorCodes[i].classification; + error->message = ErrorCodes[i].message; + found = 1; + break; + } + } + + if(!found){ + error->classification = UE; + error->message = "Unknown error code"; + } + + found = 0; + for(i = 0; iclassification){ + error->status = StatusClassificationMapping[i].status; + found = 1; + break; + } + } + if(!found){ + error->status = ST_U; + } + + error->details = 0; +} + +int +checkErrorCodes(){ + int i, j; + for(i = 0; i #include "SignalSender.hpp" #include "ConfigRetriever.hpp" #include diff --git a/ndb/src/ndbapi/signal-sender/SignalSender.hpp b/ndb/src/ndbapi/signal-sender/SignalSender.hpp index fffe027dbdd..e4e6c1931d2 100644 --- a/ndb/src/ndbapi/signal-sender/SignalSender.hpp +++ b/ndb/src/ndbapi/signal-sender/SignalSender.hpp @@ -17,11 +17,11 @@ #ifndef SIGNAL_SENDER_HPP #define SIGNAL_SENDER_HPP +#include #include #include #include #include -#include struct SimpleSignal { public: diff --git a/ndb/src/newtonapi/dba_binding.cpp b/ndb/src/newtonapi/dba_binding.cpp index 724f54c0e4b..63e48110b1d 100644 --- a/ndb/src/newtonapi/dba_binding.cpp +++ b/ndb/src/newtonapi/dba_binding.cpp @@ -367,6 +367,12 @@ matchSize(NdbDictionary::Column::Type t, unsigned b, Size_t s) { case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Blob: + case NdbDictionary::Column::Tinyint: + case NdbDictionary::Column::Tinyunsigned: + case NdbDictionary::Column::Smallint: + case NdbDictionary::Column::Smallunsigned: + case NdbDictionary::Column::Mediumint: + case NdbDictionary::Column::Mediumunsigned: case NdbDictionary::Column::Undefined: return false; } diff --git a/ndb/src/newtonapi/dba_error.cpp b/ndb/src/newtonapi/dba_error.cpp index 0a154ac1314..f05446522b0 100644 --- a/ndb/src/newtonapi/dba_error.cpp +++ b/ndb/src/newtonapi/dba_error.cpp @@ -15,9 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "dba_internal.hpp" -#include -#include static DBA_Error_t latestError = DBA_NO_ERROR; static DBA_ErrorCode_t latestNdbError = 0; diff --git a/ndb/src/newtonapi/dba_internal.hpp b/ndb/src/newtonapi/dba_internal.hpp index a021db40a7d..84ae7ba222b 100644 --- a/ndb/src/newtonapi/dba_internal.hpp +++ b/ndb/src/newtonapi/dba_internal.hpp @@ -17,17 +17,16 @@ #ifndef DBA_INTERNAL_HPP #define DBA_INTERNAL_HPP +#include + extern "C" { #include "dba.h" } #include #include -#include #include -#include - #ifndef INT_MAX #define INT_MAX 2147483647 #endif diff --git a/ndb/src/rep/RepApiService.cpp b/ndb/src/rep/RepApiService.cpp index f5d51f7990e..d07f7a59375 100644 --- a/ndb/src/rep/RepApiService.cpp +++ b/ndb/src/rep/RepApiService.cpp @@ -23,10 +23,8 @@ #include "RepApiInterpreter.hpp" #include "repapi/repapi.h" #include -#include #include -#include /** const char * name; const char * realName; diff --git a/ndb/src/rep/RepComponents.hpp b/ndb/src/rep/RepComponents.hpp index 8b24858271b..ff0f29e2128 100644 --- a/ndb/src/rep/RepComponents.hpp +++ b/ndb/src/rep/RepComponents.hpp @@ -26,7 +26,6 @@ #include - /** * Connection data */ diff --git a/ndb/src/rep/RepMain.cpp b/ndb/src/rep/RepMain.cpp index e00f6c0040c..d9f057be9a1 100644 --- a/ndb/src/rep/RepMain.cpp +++ b/ndb/src/rep/RepMain.cpp @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include diff --git a/ndb/src/rep/Requestor.cpp b/ndb/src/rep/Requestor.cpp index af16fc33844..3c93a6394a4 100644 --- a/ndb/src/rep/Requestor.cpp +++ b/ndb/src/rep/Requestor.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "Requestor.hpp" #include "ConfigRetriever.hpp" diff --git a/ndb/src/rep/Requestor.hpp b/ndb/src/rep/Requestor.hpp index ba753be60f2..735d2094bde 100644 --- a/ndb/src/rep/Requestor.hpp +++ b/ndb/src/rep/Requestor.hpp @@ -17,12 +17,13 @@ #ifndef REQUESTOR_HPP #define REQUESTOR_HPP +#include + #include #include #include #include #include -#include #include #include diff --git a/ndb/src/rep/adapters/AppNDB.hpp b/ndb/src/rep/adapters/AppNDB.hpp index c24774d4ed3..9563a1e41ab 100644 --- a/ndb/src/rep/adapters/AppNDB.hpp +++ b/ndb/src/rep/adapters/AppNDB.hpp @@ -18,13 +18,9 @@ #define APPNDB_HPP #include "NdbApi.hpp" -#include -#include - #include #include #include -#include #include #include diff --git a/ndb/src/rep/adapters/ExtNDB.cpp b/ndb/src/rep/adapters/ExtNDB.cpp index 5ba6bfbbe6e..eb541cdced9 100644 --- a/ndb/src/rep/adapters/ExtNDB.cpp +++ b/ndb/src/rep/adapters/ExtNDB.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "ExtNDB.hpp" #include "ConfigRetriever.hpp" #include diff --git a/ndb/src/rep/adapters/ExtNDB.hpp b/ndb/src/rep/adapters/ExtNDB.hpp index c69f94d9a7e..bcbf51393aa 100644 --- a/ndb/src/rep/adapters/ExtNDB.hpp +++ b/ndb/src/rep/adapters/ExtNDB.hpp @@ -17,12 +17,13 @@ #ifndef EXTNDB_HPP #define EXTNDB_HPP +#include + #include #include #include #include #include -#include #include #include diff --git a/ndb/src/rep/dbug_hack.cpp b/ndb/src/rep/dbug_hack.cpp index 364325b55ae..74e5f080777 100644 --- a/ndb/src/rep/dbug_hack.cpp +++ b/ndb/src/rep/dbug_hack.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include "NdbOut.hpp" #include "rep_version.hpp" @@ -25,6 +25,7 @@ int replogEnabled; /** * @todo This should be implemented using MySQLs dbug library */ +#if 0 extern "C" void DBUG_PRINT(const char * fmt, ...) @@ -40,6 +41,7 @@ DBUG_PRINT(const char * fmt, ...) va_end(ap); #endif } +#endif extern "C" void diff --git a/ndb/src/rep/rep_version.hpp b/ndb/src/rep/rep_version.hpp index 0182f080730..3830f9c351c 100644 --- a/ndb/src/rep/rep_version.hpp +++ b/ndb/src/rep/rep_version.hpp @@ -29,7 +29,7 @@ extern "C" void -DBUG_PRINT(const char * fmt, ...); +DBUG_PRINT__(const char * fmt, ...); extern "C" void diff --git a/ndb/src/rep/repapi/repapi.cpp b/ndb/src/rep/repapi/repapi.cpp index 80274896004..d34ab098c9c 100644 --- a/ndb/src/rep/repapi/repapi.cpp +++ b/ndb/src/rep/repapi/repapi.cpp @@ -14,17 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include "repapi.h" //#include "mgmapi_debug.h" #include -#include - -#include -#include -#include -#include #include #include #include diff --git a/ndb/src/rep/state/Interval.cpp b/ndb/src/rep/state/Interval.cpp index 75697fa7548..8266f19c58d 100644 --- a/ndb/src/rep/state/Interval.cpp +++ b/ndb/src/rep/state/Interval.cpp @@ -16,6 +16,8 @@ #include "Interval.hpp" +#undef min +#undef max Uint32 max(Uint32 a, Uint32 b) { return a > b ? a : b; } Uint32 min(Uint32 a, Uint32 b) { return a < b ? a : b; } diff --git a/ndb/src/rep/state/RepState.cpp b/ndb/src/rep/state/RepState.cpp index a34bff25d7f..d8a50961a3c 100644 --- a/ndb/src/rep/state/RepState.cpp +++ b/ndb/src/rep/state/RepState.cpp @@ -681,7 +681,7 @@ Properties * RepState::query(QueryCounter counter, Uint32 replicationId) if(prop == NULL) return NULL; NdbMutex_Lock(m_mutex); - if(counter != (Uint32)-1) + if(counter != ~(Uint32)0) getEpochState((Channel::Position)counter, prop ); prop->put("no_of_nodegroups", m_channel.getNoOfNodeGroups()); prop->put("subid", m_channel.getNoOfNodeGroups()); @@ -714,9 +714,13 @@ RepState::getEpochState(Channel::Position pos, Properties * p) */ pos_first--; pos_last--; + first_buf[pos_first]= '\0'; + last_buf[pos_last]= '\0'; +#if 0 sprintf(first_buf+pos_first,"",""); sprintf(last_buf + pos_last,"",""); - +#endif + p->put("first", first_buf); p->put("last", last_buf); diff --git a/ndb/src/rep/storage/GCIBuffer.cpp b/ndb/src/rep/storage/GCIBuffer.cpp index 5049e47ea66..013600b30a5 100644 --- a/ndb/src/rep/storage/GCIBuffer.cpp +++ b/ndb/src/rep/storage/GCIBuffer.cpp @@ -14,9 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "GCIBuffer.hpp" -#include -#include /***************************************************************************** * Constructor / Destructor diff --git a/ndb/src/rep/storage/GCIBuffer.hpp b/ndb/src/rep/storage/GCIBuffer.hpp index 5a07b149f81..8a8473d1d49 100644 --- a/ndb/src/rep/storage/GCIBuffer.hpp +++ b/ndb/src/rep/storage/GCIBuffer.hpp @@ -18,7 +18,7 @@ #define GCI_BUFFER_HPP #include "GCIPage.hpp" -#include "Vector.hpp" +#include #include #include diff --git a/ndb/src/rep/storage/GCIContainer.hpp b/ndb/src/rep/storage/GCIContainer.hpp index 173bb790a57..48cbc66bfbd 100644 --- a/ndb/src/rep/storage/GCIContainer.hpp +++ b/ndb/src/rep/storage/GCIContainer.hpp @@ -22,6 +22,7 @@ #include "LogRecord.hpp" #include "GCIBuffer.hpp" +#undef swap #include #include diff --git a/ndb/src/rep/storage/LogRecord.hpp b/ndb/src/rep/storage/LogRecord.hpp index ba2632e23c7..a0bf3d52372 100644 --- a/ndb/src/rep/storage/LogRecord.hpp +++ b/ndb/src/rep/storage/LogRecord.hpp @@ -17,8 +17,7 @@ #ifndef LOG_RECORD_HPP #define LOG_RECORD_HPP -#include -#include +#include #include /** diff --git a/ndb/src/rep/storage/NodeGroupInfo.hpp b/ndb/src/rep/storage/NodeGroupInfo.hpp index 605ccf76a38..3d0499d4425 100644 --- a/ndb/src/rep/storage/NodeGroupInfo.hpp +++ b/ndb/src/rep/storage/NodeGroupInfo.hpp @@ -18,12 +18,10 @@ #define NODE_GROUPINFO_HPP #include -#include #include #include #include //#include -#include #include "NodeGroup.hpp" #include diff --git a/ndb/src/rep/transfer/TransPS.cpp b/ndb/src/rep/transfer/TransPS.cpp index 7af53f24415..1f65e95850d 100644 --- a/ndb/src/rep/transfer/TransPS.cpp +++ b/ndb/src/rep/transfer/TransPS.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "ConfigRetriever.hpp" #include diff --git a/ndb/src/rep/transfer/TransPS.hpp b/ndb/src/rep/transfer/TransPS.hpp index 35823f1eb19..b47f1acfca2 100644 --- a/ndb/src/rep/transfer/TransPS.hpp +++ b/ndb/src/rep/transfer/TransPS.hpp @@ -17,12 +17,10 @@ #ifndef TransPS_HPP #define TransPS_HPP -#include #include #include #include #include -#include #include #include diff --git a/ndb/src/rep/transfer/TransSS.cpp b/ndb/src/rep/transfer/TransSS.cpp index 5399bfb4e3f..83f4b570330 100644 --- a/ndb/src/rep/transfer/TransSS.cpp +++ b/ndb/src/rep/transfer/TransSS.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "ConfigRetriever.hpp" diff --git a/ndb/src/rep/transfer/TransSS.hpp b/ndb/src/rep/transfer/TransSS.hpp index 90f320a079e..6f2089e46ac 100644 --- a/ndb/src/rep/transfer/TransSS.hpp +++ b/ndb/src/rep/transfer/TransSS.hpp @@ -17,12 +17,10 @@ #ifndef TransSS_HPP #define TransSS_HPP -#include #include #include #include #include -#include #include #include diff --git a/ndb/test/include/NDBT_Stats.hpp b/ndb/test/include/NDBT_Stats.hpp index 15a125dea86..28212bdba17 100644 --- a/ndb/test/include/NDBT_Stats.hpp +++ b/ndb/test/include/NDBT_Stats.hpp @@ -17,9 +17,7 @@ #ifndef NDBT_STATS_HPP #define NDBT_STATS_HPP -#include -#include -#include +#include class NDBT_Stats { public: diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp index a4482fa8084..950c1f15ff7 100644 --- a/ndb/test/include/NDBT_Table.hpp +++ b/ndb/test/include/NDBT_Table.hpp @@ -17,11 +17,11 @@ #ifndef NDBT_TABLE_HPP #define NDBT_TABLE_HPP +#include + #include #include -#include - class NDBT_Attribute : public NdbDictionary::Column { friend class NdbOut& operator <<(class NdbOut&, const NDBT_Attribute &); public: diff --git a/ndb/test/include/NDBT_Test.hpp b/ndb/test/include/NDBT_Test.hpp index 41332bb570c..7a5d14689bc 100644 --- a/ndb/test/include/NDBT_Test.hpp +++ b/ndb/test/include/NDBT_Test.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/ndb/test/include/NdbTimer.hpp b/ndb/test/include/NdbTimer.hpp index 8d9a088b7b5..b0d500b5c2c 100644 --- a/ndb/test/include/NdbTimer.hpp +++ b/ndb/test/include/NdbTimer.hpp @@ -17,7 +17,6 @@ #ifndef NDBTIMER_H #define NDBTIMER_H -#include #include #include diff --git a/ndb/test/ndbapi/acid2/acid2.cpp b/ndb/test/ndbapi/acid2/acid2.cpp index 5835b76453e..434a0450daa 100644 --- a/ndb/test/ndbapi/acid2/acid2.cpp +++ b/ndb/test/ndbapi/acid2/acid2.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp b/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp index ee724236855..d84818baf24 100644 --- a/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp +++ b/ndb/test/ndbapi/bank/bankCreator/bankCreator.cpp @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include diff --git a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp b/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp index 0b6fc9c1f97..55e9081a598 100644 --- a/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp +++ b/ndb/test/ndbapi/bank/bankMakeGL/bankMakeGL.cpp @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include diff --git a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp b/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp index 7071de9f63e..ab3e862e8d2 100644 --- a/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp +++ b/ndb/test/ndbapi/bank/bankSumAccounts/bankSumAccounts.cpp @@ -15,8 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include diff --git a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp b/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp index cfb2c93e4ad..ba8de9e4af1 100644 --- a/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp +++ b/ndb/test/ndbapi/bank/bankTimer/bankTimer.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp b/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp index 155a35998bb..0c7d5d72473 100644 --- a/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp +++ b/ndb/test/ndbapi/bank/bankTransactionMaker/bankTransactionMaker.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp b/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp index cc8e2792cbf..13136755de8 100644 --- a/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp +++ b/ndb/test/ndbapi/bank/bankValidateAllGLs/bankValidateAllGLs.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp index f2b28d8b057..18881cae216 100644 --- a/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp +++ b/ndb/test/ndbapi/bulk_copy/bulk_copy.cpp @@ -14,7 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include diff --git a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp b/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp index eaa99e8a79d..55d04888144 100644 --- a/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp +++ b/ndb/test/ndbapi/create_all_tabs/create_all_tabs.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/test/ndbapi/create_tab/create_tab.cpp b/ndb/test/ndbapi/create_tab/create_tab.cpp index 2f2911b4ef4..8bb1e7a9572 100644 --- a/ndb/test/ndbapi/create_tab/create_tab.cpp +++ b/ndb/test/ndbapi/create_tab/create_tab.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp b/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp index 8e67493c003..59c57396acd 100644 --- a/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp +++ b/ndb/test/ndbapi/drop_all_tabs/drop_all_tabs.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp index 3938cd21f78..0822f3ee999 100644 --- a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include diff --git a/ndb/test/ndbapi/flexBench/flexBench.cpp b/ndb/test/ndbapi/flexBench/flexBench.cpp index 17d9be73925..809d11086bf 100644 --- a/ndb/test/ndbapi/flexBench/flexBench.cpp +++ b/ndb/test/ndbapi/flexBench/flexBench.cpp @@ -51,13 +51,9 @@ Arguments: #include "NdbApi.hpp" -#include -#include - #include #include #include -#include #include #include #include @@ -296,7 +292,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) if(useLongKeys){ longKeyAttrName = (char **) malloc(sizeof(char*) * tNoOfLongPK); - for (int i = 0; i < tNoOfLongPK; i++) { + for (Uint32 i = 0; i < tNoOfLongPK; i++) { longKeyAttrName[i] = (char *) malloc(strlen("KEYATTR ") + 1); memset(longKeyAttrName[i], 0, strlen("KEYATTR ") + 1); sprintf(longKeyAttrName[i], "KEYATTR%i", i); @@ -535,7 +531,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) waitForThreads(pThreadsData); void * tmp; - for(int i = 0; iequal(longKeyAttrName[i], (char *)longKeyAttrValue[count - 1][i], tSizeOfLongPK*4); } @@ -927,8 +923,8 @@ static void* flexBenchThread(void* pArg) if (useLongKeys == true) { // Only free these areas if they have been allocated // Otherwise cores will occur - for (int n = 0; n < tNoOfOperations; n++){ - for (int i = 0; i < tNoOfLongPK; i++) { + for (Uint32 n = 0; n < tNoOfOperations; n++){ + for (Uint32 i = 0; i < tNoOfLongPK; i++) { free(longKeyAttrValue[n][i]); } free(longKeyAttrValue[n]); @@ -1068,13 +1064,13 @@ static void sleepBeforeStartingTest(int seconds){ static int createTables(Ndb* pMyNdb){ - for (int i = 0; i < tNoOfAttributes; i++){ + for (Uint32 i = 0; i < tNoOfAttributes; i++){ snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } // Note! Uses only uppercase letters in table name's // so that we can look at the tables with SQL - for (int i = 0; i < tNoOfTables; i++){ + for (Uint32 i = 0; i < tNoOfTables; i++){ if (theStdTableNameFlag == 0){ snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); @@ -1091,7 +1087,7 @@ createTables(Ndb* pMyNdb){ tmpTable.setStoredTable(!theTempTable); if(useLongKeys){ - for(int i = 0; i < tNoOfLongPK; i++) { + for(Uint32 i = 0; i < tNoOfLongPK; i++) { NdbDictionary::Column col(longKeyAttrName[i]); col.setType(NdbDictionary::Column::Unsigned); col.setLength(tSizeOfLongPK); diff --git a/ndb/test/ndbapi/flexHammer/flexHammer.cpp b/ndb/test/ndbapi/flexHammer/flexHammer.cpp index f8a519f021a..057efb31e74 100644 --- a/ndb/test/ndbapi/flexHammer/flexHammer.cpp +++ b/ndb/test/ndbapi/flexHammer/flexHammer.cpp @@ -57,8 +57,6 @@ Revision history: #include #include #include -#include -#include #include ErrorData * flexHammerErrorData; diff --git a/ndb/test/ndbapi/flexScan/flexScan.cpp b/ndb/test/ndbapi/flexScan/flexScan.cpp index 55163a99fbe..19fb6dc5ab0 100644 --- a/ndb/test/ndbapi/flexScan/flexScan.cpp +++ b/ndb/test/ndbapi/flexScan/flexScan.cpp @@ -59,12 +59,9 @@ #include #include #include -#include -#include #include #include #include -#include #define PKSIZE 1 #define FOREVER 1 diff --git a/ndb/test/ndbapi/flexTT/flexTT.cpp b/ndb/test/ndbapi/flexTT/flexTT.cpp index 1705f20b706..c45cbd95762 100644 --- a/ndb/test/ndbapi/flexTT/flexTT.cpp +++ b/ndb/test/ndbapi/flexTT/flexTT.cpp @@ -15,7 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NdbApi.hpp" +#include + +#include #include #include @@ -24,9 +26,6 @@ #include #include #include -#include -#include -#include #include #include diff --git a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp index 6a00463339b..7cc883ab3e6 100644 --- a/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp +++ b/ndb/test/ndbapi/flex_bench_mysql/flex_bench_mysql.cpp @@ -57,13 +57,9 @@ Arguments: #include "NdbApi.hpp" -#include -#include - #include #include #include -#include #include #include #include diff --git a/ndb/test/ndbapi/indexTest/index.cpp b/ndb/test/ndbapi/indexTest/index.cpp index d0eb490e1a0..508186de529 100644 --- a/ndb/test/ndbapi/indexTest/index.cpp +++ b/ndb/test/ndbapi/indexTest/index.cpp @@ -37,9 +37,8 @@ 1 - Invalid arguments * *************************************************** */ -#include -#include -#include +#include + #include #include #include diff --git a/ndb/test/ndbapi/indexTest2/index2.cpp b/ndb/test/ndbapi/indexTest2/index2.cpp index 5a3674f0bbf..e49113d2f1b 100644 --- a/ndb/test/ndbapi/indexTest2/index2.cpp +++ b/ndb/test/ndbapi/indexTest2/index2.cpp @@ -37,9 +37,8 @@ 1 - Invalid arguments * *************************************************** */ -#include -#include -#include +#include + #include #include #include diff --git a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp index b9d1eca1cc9..a2352edf707 100644 --- a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp +++ b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp @@ -54,9 +54,6 @@ * *************************************************** */ -#include -#include -#include #include #include #include diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp b/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp index 25eb1830de9..84a93414712 100644 --- a/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp +++ b/ndb/test/ndbapi/lmc-bench/async-src/generator/asyncGenerator.cpp @@ -18,8 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include +#include #include "dbGenerator.h" #include diff --git a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp b/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp index d7506c9dd2c..f613c66d07b 100644 --- a/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp +++ b/ndb/test/ndbapi/lmc-bench/async-src/generator/mainAsyncGenerator.cpp @@ -14,10 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include +#include #include #include diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h b/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h index c049cdbad33..22b7f564490 100644 --- a/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h +++ b/ndb/test/ndbapi/lmc-bench/async-src/user/macros.h @@ -17,8 +17,7 @@ #ifndef MACROS_H #define MACROS_H -#include -#include +#include #include #define ERROR(x) {ndbout_c((x));} diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp b/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp index 91a061c7cf4..9e6c5e55e73 100644 --- a/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp +++ b/ndb/test/ndbapi/lmc-bench/async-src/user/ndb_error.hpp @@ -17,7 +17,7 @@ #ifndef NDB_ERROR_H #define NDB_ERROR_H -#include +#include #include #include "userInterface.h" #include diff --git a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp index ece82628ba7..fdbc229cc98 100644 --- a/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp +++ b/ndb/test/ndbapi/lmc-bench/async-src/user/userInterface.cpp @@ -18,9 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include -#include +#include #include #include "ndb_schema.hpp" @@ -31,7 +29,6 @@ #include #include #include -#include /*************************************************************** * L O C A L C O N S T A N T S * diff --git a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h b/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h index c6ad11016b2..2f4aeb30975 100644 --- a/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h +++ b/ndb/test/ndbapi/lmc-bench/include/testDefinitions.h @@ -23,12 +23,6 @@ #include -/*************************************************************** -* M A C R O S * -***************************************************************/ - -typedef Uint32 uint32; - /***************************************************************/ /* C O N S T A N T S */ /***************************************************************/ @@ -62,14 +56,14 @@ typedef char GroupName[GROUP_NAME_LENGTH]; typedef char ChangedBy[CHANGED_BY_LENGTH]; typedef char ChangedTime[CHANGED_TIME_LENGTH]; typedef char SessionDetails[SESSION_DETAILS_LENGTH]; -typedef uint32 ServerId; -typedef uint32 ServerBit; -typedef uint32 GroupId; -typedef uint32 Location; -typedef uint32 Permission; +typedef Uint32 ServerId; +typedef Uint32 ServerBit; +typedef Uint32 GroupId; +typedef Uint32 Location; +typedef Uint32 Permission; -typedef uint32 Counter; -typedef uint32 ActiveSessions; +typedef Uint32 Counter; +typedef Uint32 ActiveSessions; typedef unsigned int BranchExecuted; typedef unsigned int DoRollback; diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c b/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c index eedcd914d85..7484c7647f5 100644 --- a/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c +++ b/ndb/test/ndbapi/lmc-bench/src/generator/dbGenerator.c @@ -18,8 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include +#include #include "dbGenerator.h" /*************************************************************** diff --git a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c b/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c index 6ddf0a47775..4a31db0b4e9 100644 --- a/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c +++ b/ndb/test/ndbapi/lmc-bench/src/generator/mainGenerator.c @@ -14,11 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include +#include #include #include diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c b/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c index 9f8629ec1f0..42fbb52f3b2 100644 --- a/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c +++ b/ndb/test/ndbapi/lmc-bench/src/populator/dbPopulate.c @@ -18,9 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include -#include +#include #include "userInterface.h" diff --git a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c b/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c index 9dde902d006..838ac8a7196 100644 --- a/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c +++ b/ndb/test/ndbapi/lmc-bench/src/populator/mainPopulate.c @@ -14,9 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include #include "userInterface.h" #include "dbPopulate.h" diff --git a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c b/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c index ca8a64ab59c..dd100507016 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c +++ b/ndb/test/ndbapi/lmc-bench/src/user/localDbPrepare.c @@ -18,7 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include +#include #include "userInterface.h" #include "userHandle.h" diff --git a/ndb/test/ndbapi/lmc-bench/src/user/macros.h b/ndb/test/ndbapi/lmc-bench/src/user/macros.h index beb4352c269..363f247b93f 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/macros.h +++ b/ndb/test/ndbapi/lmc-bench/src/user/macros.h @@ -17,8 +17,7 @@ #ifndef MACROS_H #define MACROS_H -#include -#include +#include #include #define ERROR(x) {ndbout_c((x)); } diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp b/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp index 5f792342ed9..b3aaeac822e 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp +++ b/ndb/test/ndbapi/lmc-bench/src/user/ndb_error.hpp @@ -17,7 +17,6 @@ #ifndef NDB_ERROR_H #define NDB_ERROR_H -#include #include #define error_handler(x,y, z) { \ diff --git a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp b/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp index 6a35bccd064..ce3a76cdd59 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp +++ b/ndb/test/ndbapi/lmc-bench/src/user/ndb_user_populate.cpp @@ -19,7 +19,7 @@ extern "C" { #include "user_populate.h" } -#include +#include #include #include "ndb_schema.hpp" diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c b/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c index c68f287f5dd..bacf1861dde 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c +++ b/ndb/test/ndbapi/lmc-bench/src/user/old/userInterface.c @@ -18,10 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include -#include -#include +#include #include "userInterface.h" #include "userHandle.h" diff --git a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c b/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c index 17069b0a042..a2f4787bb0c 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c +++ b/ndb/test/ndbapi/lmc-bench/src/user/old/userTransaction.c @@ -18,8 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include +#include #include #include "sql.h" diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp index fc3f6955a47..67c4e037215 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp +++ b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp @@ -18,9 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include -#include +#include #ifndef NDB_WIN32 #include #endif diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c b/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c index 17069b0a042..a2f4787bb0c 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c +++ b/ndb/test/ndbapi/lmc-bench/src/user/userTransaction.c @@ -18,8 +18,7 @@ * I N C L U D E D F I L E S * ***************************************************************/ -#include -#include +#include #include #include "sql.h" diff --git a/ndb/test/ndbapi/restarter/restarter.cpp b/ndb/test/ndbapi/restarter/restarter.cpp index ad3507df98a..9a522f5dcac 100644 --- a/ndb/test/ndbapi/restarter/restarter.cpp +++ b/ndb/test/ndbapi/restarter/restarter.cpp @@ -26,8 +26,6 @@ #include #include #include -#include -#include int main(int argc, const char** argv){ diff --git a/ndb/test/ndbapi/restarter2/restarter2.cpp b/ndb/test/ndbapi/restarter2/restarter2.cpp index 71eaf1a9b0f..f2bcf6f8e7b 100644 --- a/ndb/test/ndbapi/restarter2/restarter2.cpp +++ b/ndb/test/ndbapi/restarter2/restarter2.cpp @@ -24,8 +24,6 @@ #include #include -#include -#include int main(int argc, const char** argv){ diff --git a/ndb/test/ndbapi/restarts/restarts.cpp b/ndb/test/ndbapi/restarts/restarts.cpp index 2f9bab3b233..0ec2883d53c 100644 --- a/ndb/test/ndbapi/restarts/restarts.cpp +++ b/ndb/test/ndbapi/restarts/restarts.cpp @@ -25,8 +25,6 @@ #include #include -#include -#include int main(int argc, const char** argv){ diff --git a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp b/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp index 71fa286a21b..ce0aee35e8f 100644 --- a/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp +++ b/ndb/test/ndbapi/ronja/benchronja/benchronja.cpp @@ -26,6 +26,8 @@ * *************************************************** */ +#include + #include #include #include @@ -36,11 +38,6 @@ #include #include -#include -#include -#include -#include - #define MAX_TIMERS 4 #define MAXSTRLEN 16 #define MAXATTR 64 diff --git a/ndb/test/ndbapi/telco/msa.cpp b/ndb/test/ndbapi/telco/msa.cpp index f074733dce4..39ddaac2019 100644 --- a/ndb/test/ndbapi/telco/msa.cpp +++ b/ndb/test/ndbapi/telco/msa.cpp @@ -14,17 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include #include #include -#include #include #include -#include const char* const c_szDatabaseName = "TEST_DB"; diff --git a/ndb/test/ndbapi/testBlobs/testBlobs.cpp b/ndb/test/ndbapi/testBlobs/testBlobs.cpp index b8fe51dc1e4..9f959702402 100644 --- a/ndb/test/ndbapi/testBlobs/testBlobs.cpp +++ b/ndb/test/ndbapi/testBlobs/testBlobs.cpp @@ -18,13 +18,8 @@ * testBlobs */ -#include -#include -#include -#include -#include -#include -#include +#include + #include #include #include diff --git a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp index fd6570fad0a..b8e0fef6cef 100644 --- a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp +++ b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp @@ -28,14 +28,12 @@ * Creates tables TB00 to TB15 */ -#include -#include -#include +#include + #include #include #include #include -#include // limits static int const MaxAttr = 64; diff --git a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp b/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp index 056aa9bf173..7fd2c19d9f7 100644 --- a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp +++ b/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp @@ -31,8 +31,6 @@ #include #include #include -#include -#include #define CHECK(b) if (!(b)) { \ diff --git a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp index 68fa6ec5474..a47d9d2099e 100644 --- a/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp +++ b/ndb/test/ndbapi/testOIBasic/testOIBasic.cpp @@ -18,17 +18,12 @@ * testOIBasic - ordered index test */ -#include -#include -#include -#include -#include -#include +#include + #include #include #include #include -#include #include #include #include diff --git a/ndb/test/ndbapi/vw_test/bcd.h b/ndb/test/ndbapi/vw_test/bcd.h index ce1309693c8..d0aaffbd8b7 100644 --- a/ndb/test/ndbapi/vw_test/bcd.h +++ b/ndb/test/ndbapi/vw_test/bcd.h @@ -14,8 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include struct bcdtab { char tab[3]; diff --git a/ndb/test/ndbapi/vw_test/cdrserver.cpp b/ndb/test/ndbapi/vw_test/cdrserver.cpp index 3c3f32e8886..8354d28f53f 100644 --- a/ndb/test/ndbapi/vw_test/cdrserver.cpp +++ b/ndb/test/ndbapi/vw_test/cdrserver.cpp @@ -31,28 +31,22 @@ /* must also have the same entry (same port number) in its */ /* ./etc/services file. */ /* **************************************************************** */ + +#include + /******** NDB INCLUDE ******/ #include /***************************/ /*#include */ -#include -#include -#include #include #include -#include #include -#include -#include #include #include -#include #include #include #include #include -#include -#include extern "C" { #include "utv.h" diff --git a/ndb/test/ndbapi/vw_test/size.cpp b/ndb/test/ndbapi/vw_test/size.cpp index 397cc02f4f6..c506771ebde 100644 --- a/ndb/test/ndbapi/vw_test/size.cpp +++ b/ndb/test/ndbapi/vw_test/size.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include "utv.h" int main(void) diff --git a/ndb/test/newtonapi/basic_test/basic/basic.cpp b/ndb/test/newtonapi/basic_test/basic/basic.cpp index 90f5bf14acf..bc33400078d 100644 --- a/ndb/test/newtonapi/basic_test/basic/basic.cpp +++ b/ndb/test/newtonapi/basic_test/basic/basic.cpp @@ -26,7 +26,6 @@ extern "C" { #include #include #include -#include static const DBA_ColumnDesc_t EmpColDesc[] = { diff --git a/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp b/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp index fb26abc65aa..4120cfba864 100644 --- a/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp +++ b/ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp @@ -26,7 +26,6 @@ extern "C" { #include #include #include -#include static const DBA_ColumnDesc_t EmpColDesc[] = { diff --git a/ndb/test/newtonapi/basic_test/common.cpp b/ndb/test/newtonapi/basic_test/common.cpp index 6fd63730832..d4c4e6a74a7 100644 --- a/ndb/test/newtonapi/basic_test/common.cpp +++ b/ndb/test/newtonapi/basic_test/common.cpp @@ -16,10 +16,6 @@ #include "common.hpp" -#include -#include -#include -#include NdbOut & operator << (NdbOut & out, const Employee_t & emp){ diff --git a/ndb/test/newtonapi/basic_test/common.hpp b/ndb/test/newtonapi/basic_test/common.hpp index e081df723ef..0df8f7e078d 100644 --- a/ndb/test/newtonapi/basic_test/common.hpp +++ b/ndb/test/newtonapi/basic_test/common.hpp @@ -17,12 +17,13 @@ #ifndef COMMON_H #define COMMON_H +#include + extern "C" { #include } #include -#include typedef struct Employee { UInt32_t EmpNo; diff --git a/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp b/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp index fc6dfc40372..2c9cee5be87 100644 --- a/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp +++ b/ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp @@ -26,7 +26,6 @@ extern "C" { #include #include #include -#include static const DBA_ColumnDesc_t ColDesc[] = { diff --git a/ndb/test/newtonapi/basic_test/too_basic.cpp b/ndb/test/newtonapi/basic_test/too_basic.cpp index 9099f0d9154..883aacf8841 100644 --- a/ndb/test/newtonapi/basic_test/too_basic.cpp +++ b/ndb/test/newtonapi/basic_test/too_basic.cpp @@ -18,6 +18,9 @@ /****** THIS LINE IS 80 CHARACTERS WIDE - DO *NOT* EXCEED 80 CHARACTERS! ****/ +#include +#include + //#include //#include //#include "pcn_types.h" @@ -27,13 +30,6 @@ extern "C" { #include } -#include -#include -#include -#include - - - typedef struct Employee { UInt32_t EmpNo; diff --git a/ndb/test/newtonapi/perf_test/perf.cpp b/ndb/test/newtonapi/perf_test/perf.cpp index 81d4cc5fd08..7b818e93a2a 100644 --- a/ndb/test/newtonapi/perf_test/perf.cpp +++ b/ndb/test/newtonapi/perf_test/perf.cpp @@ -15,14 +15,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + extern "C" { #include } -#include -#include -#include - #include #include #include @@ -31,6 +29,9 @@ extern "C" { #include #include +#undef min +#undef max + static const int NP_Insert = 0; static const int NP_Update = 1; static const int NP_WriteUpdate = 2; diff --git a/ndb/test/odbc/driver/testOdbcDriver.cpp b/ndb/test/odbc/driver/testOdbcDriver.cpp index 9731c00eeaf..b856b6a21f2 100644 --- a/ndb/test/odbc/driver/testOdbcDriver.cpp +++ b/ndb/test/odbc/driver/testOdbcDriver.cpp @@ -36,12 +36,7 @@ * Test of ODBC and SQL using a fixed set of tables. */ -#include -#include -#include -#include -#include -#include +#include #include #include #include @@ -49,9 +44,7 @@ #ifdef ndbODBC #include #endif -#include #include -#include #undef BOOL diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 1ce9124431c..eb8a626dc2b 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include #include diff --git a/ndb/test/run-test/run-test.hpp b/ndb/test/run-test/run-test.hpp index 8387f8638ed..8d00a7b6a55 100644 --- a/ndb/test/run-test/run-test.hpp +++ b/ndb/test/run-test/run-test.hpp @@ -24,6 +24,8 @@ #include #include +#undef MYSQL_CLIENT + enum ErrorCodes { ERR_OK = 0, ERR_NDB_FAILED = 101, diff --git a/ndb/test/src/HugoAsynchTransactions.cpp b/ndb/test/src/HugoAsynchTransactions.cpp index d045032d455..2af22b5f48d 100644 --- a/ndb/test/src/HugoAsynchTransactions.cpp +++ b/ndb/test/src/HugoAsynchTransactions.cpp @@ -473,6 +473,10 @@ HugoAsynchTransactions::executeAsynchOperation(Ndb* pNdb, } } break; + case NO_INSERT: + case NO_UPDATE: + case NO_DELETE: + abort(); } // Close all transactions diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp index 9e2ba9f143e..55aa96a4909 100644 --- a/ndb/test/src/HugoCalculator.cpp +++ b/ndb/test/src/HugoCalculator.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "HugoCalculator.hpp" -#include -#include #include /* ************************************************************* @@ -159,7 +157,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{ << ", NdbDict::Column::getLength(): " << attr->getLength() << endl; const char* buf2 = pRow->attributeStore(i)->aRef(); - for (int j = 0; j < pRow->attributeStore(i)->arraySize(); j++) + for (Uint32 j = 0; j < pRow->attributeStore(i)->arraySize(); j++) { g_err << j << ":" << buf[j] << "[" << buf2[j] << "]"; if (buf[j] != buf2[j]) diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp index edcec460ba0..91263aa29b4 100644 --- a/ndb/test/src/HugoOperations.cpp +++ b/ndb/test/src/HugoOperations.cpp @@ -652,7 +652,7 @@ void HugoOperations::deallocRows(){ int HugoOperations::saveCopyOfRecord(int numRecords ){ - if (numRecords > rows.size()) + if (numRecords > (int)rows.size()) return NDBT_FAILED; for (int i = 0; i < numRecords; i++){ @@ -662,7 +662,7 @@ int HugoOperations::saveCopyOfRecord(int numRecords ){ } BaseString HugoOperations::getRecordStr(int recordNum){ - if (recordNum > rows.size()) + if (recordNum > (int)rows.size()) return NULL; return rows[recordNum]->c_str(); } @@ -673,7 +673,7 @@ int HugoOperations::getRecordGci(int recordNum){ int HugoOperations::compareRecordToCopy(int numRecords ){ - if (numRecords > rows.size()) + if (numRecords > (int)rows.size()) return NDBT_FAILED; if ((unsigned)numRecords > savedRecords.size()) return NDBT_FAILED; diff --git a/ndb/test/src/HugoTransactions.cpp b/ndb/test/src/HugoTransactions.cpp index 1293d395974..7f12484ddc8 100644 --- a/ndb/test/src/HugoTransactions.cpp +++ b/ndb/test/src/HugoTransactions.cpp @@ -1253,9 +1253,11 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, g_info << " UPDATE: "; recEvent = recUpdateEvent; break; + case NdbDictionary::Event::TE_ALL: + abort(); } - if (pk < records) { + if ((int)pk < records) { recEvent[pk].pk = pk; recEvent[pk].count++; } @@ -1304,7 +1306,7 @@ HugoTransactions::eventOperation(Ndb* pNdb, void* pstats, if (stats.n_updates > 0) { stats.n_consecutive++; } - for (Uint32 i = 0; i < records/3; i++) { + for (Uint32 i = 0; i < (Uint32)records/3; i++) { if (recInsertEvent[i].pk != i) { stats.n_consecutive ++; ndbout << "missing insert pk " << i << endl; diff --git a/ndb/test/src/NDBT_Error.cpp b/ndb/test/src/NDBT_Error.cpp index 92c0b2e5c1f..ffacb3eb928 100644 --- a/ndb/test/src/NDBT_Error.cpp +++ b/ndb/test/src/NDBT_Error.cpp @@ -17,11 +17,9 @@ /* NDBT_Error.cpp */ /* This program deals with error handling */ -#include -#include +#include #include #include -#include #include #include #include diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp index 098e4cfb796..ba46be203e1 100644 --- a/ndb/test/src/NDBT_ResultRow.cpp +++ b/ndb/test/src/NDBT_ResultRow.cpp @@ -14,10 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NDBT_ResultRow.hpp" -#include -#include -#include #include NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab, @@ -68,6 +66,7 @@ NDBT_ResultRow::attributeStore(const char* name){ return data[i]; } assert(false); + return 0; } NdbOut & @@ -191,7 +190,8 @@ NDBT_ResultRow::clone () const { NDBT_ResultRow * row = new NDBT_ResultRow(m_table, ad[0]); row->m_ownData = true; - for(Uint32 i = 0; idata[i] = data[i]->clone(); } diff --git a/ndb/test/src/NDBT_ReturnCodes.cpp b/ndb/test/src/NDBT_ReturnCodes.cpp index 542547c7a48..5bffc00177f 100644 --- a/ndb/test/src/NDBT_ReturnCodes.cpp +++ b/ndb/test/src/NDBT_ReturnCodes.cpp @@ -14,14 +14,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* System include files */ +#include + #include "NDBT_ReturnCodes.h" /* Ndb include files */ #include -/* System include files */ -#include - const char* rcodeToChar(int rcode){ switch (rcode){ case NDBT_OK: diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp index 2bd2c265f10..c520b01c990 100644 --- a/ndb/test/src/NDBT_Table.cpp +++ b/ndb/test/src/NDBT_Table.cpp @@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "NDBT_Table.hpp" -#include -#include #include #include diff --git a/ndb/test/src/NDBT_Tables.cpp b/ndb/test/src/NDBT_Tables.cpp index 41a38e4fe44..548e755a3fb 100644 --- a/ndb/test/src/NDBT_Tables.cpp +++ b/ndb/test/src/NDBT_Tables.cpp @@ -18,7 +18,6 @@ #include #include -#include /* ******************************************************* */ // Define Ndb standard tables // diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 689aae64c81..6cbb69508f5 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -67,7 +66,6 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ /** * Fetch configuration from management server */ - char buf[255]; ConfigRetriever cr; diff --git a/ndb/test/src/NdbConfig.cpp b/ndb/test/src/NdbConfig.cpp index d61b74cf62b..3a254bc1577 100644 --- a/ndb/test/src/NdbConfig.cpp +++ b/ndb/test/src/NdbConfig.cpp @@ -17,7 +17,6 @@ #include "NdbConfig.hpp" #include #include -#include #include #include #include @@ -32,7 +31,6 @@ NdbConfig::getPropsForNode(unsigned int node_id, /** * Fetch configuration from management server */ - char buf[255]; ConfigRetriever cr; @@ -112,7 +110,6 @@ NdbConfig::getHostName(unsigned int node_id, /** * Fetch configuration from management server */ - char buf[255]; ConfigRetriever cr; diff --git a/ndb/test/src/NdbGrep.cpp b/ndb/test/src/NdbGrep.cpp index 747c62d5bc6..8b7442b0e77 100644 --- a/ndb/test/src/NdbGrep.cpp +++ b/ndb/test/src/NdbGrep.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/ndb/test/src/NdbRestarter.cpp b/ndb/test/src/NdbRestarter.cpp index 1df214572c7..cc2fab46cc5 100644 --- a/ndb/test/src/NdbRestarter.cpp +++ b/ndb/test/src/NdbRestarter.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #define MGMERR(h) \ ndbout << "latest_error="< + #include -#include #include #include #include diff --git a/ndb/test/tools/hugoFill/hugoFill.cpp b/ndb/test/tools/hugoFill/hugoFill.cpp index 748623cb253..dee6ce2e6c8 100644 --- a/ndb/test/tools/hugoFill/hugoFill.cpp +++ b/ndb/test/tools/hugoFill/hugoFill.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp b/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp index 90c08649ec2..e2c2cd13f00 100644 --- a/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp +++ b/ndb/test/tools/hugoLockRecords/hugoLockRecords.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp b/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp index f77dc21bd0b..1855f19796f 100644 --- a/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp +++ b/ndb/test/tools/hugoPkDelete/hugoPkDel.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp b/ndb/test/tools/hugoPkRead/hugoPkRead.cpp index 2e9c2c35260..50351f08195 100644 --- a/ndb/test/tools/hugoPkRead/hugoPkRead.cpp +++ b/ndb/test/tools/hugoPkRead/hugoPkRead.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp b/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp index 6335c391bc3..ac17ffffee8 100644 --- a/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp +++ b/ndb/test/tools/hugoPkReadRecord/hugoPkReadRecord.cpp @@ -14,8 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include -#include #include #include #include diff --git a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp b/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp index 141d01e3aee..e7edc3a991d 100644 --- a/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp +++ b/ndb/test/tools/hugoPkUpdate/hugoPkUpd.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp b/ndb/test/tools/hugoScanRead/hugoScanRead.cpp index 2376280d004..47ea8f4a8a7 100644 --- a/ndb/test/tools/hugoScanRead/hugoScanRead.cpp +++ b/ndb/test/tools/hugoScanRead/hugoScanRead.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp b/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp index 56cd3b8c969..3e2255ca0f3 100644 --- a/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp +++ b/ndb/test/tools/hugoScanUpdate/hugoScanUpd.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/test/tools/restart/restart.cpp b/ndb/test/tools/restart/restart.cpp index f391aecabe1..88cfb231a72 100644 --- a/ndb/test/tools/restart/restart.cpp +++ b/ndb/test/tools/restart/restart.cpp @@ -15,7 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include + #include #include #include @@ -24,8 +25,6 @@ #include #include -#include -#include int main(int argc, const char** argv){ diff --git a/ndb/test/tools/waiter/waiter.cpp b/ndb/test/tools/waiter/waiter.cpp index 14803fec71d..d57daff3aea 100644 --- a/ndb/test/tools/waiter/waiter.cpp +++ b/ndb/test/tools/waiter/waiter.cpp @@ -25,7 +25,6 @@ #include #include -#include int main(int argc, const char** argv){ diff --git a/ndb/tools/copy_tab/copy_tab.cpp b/ndb/tools/copy_tab/copy_tab.cpp index 32cfb0b35ff..33ce8e01d9a 100644 --- a/ndb/tools/copy_tab/copy_tab.cpp +++ b/ndb/tools/copy_tab/copy_tab.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/tools/cpcc/cpcc.cpp b/ndb/tools/cpcc/cpcc.cpp index 5a826f250c0..e768d707bbc 100644 --- a/ndb/tools/cpcc/cpcc.cpp +++ b/ndb/tools/cpcc/cpcc.cpp @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include "CpcClient.hpp" #include @@ -116,7 +116,7 @@ public: } virtual bool evaluate(SimpleCpcClient* c,const SimpleCpcClient::Process & p){ - return p.m_id == id && c == host; + return p.m_id == (int)id && c == host; } }; diff --git a/ndb/tools/create_index/create_index.cpp b/ndb/tools/create_index/create_index.cpp index 32da39a5208..dc9e6c606d6 100644 --- a/ndb/tools/create_index/create_index.cpp +++ b/ndb/tools/create_index/create_index.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/tools/delete_all/delete_all.cpp b/ndb/tools/delete_all/delete_all.cpp index e78ad4a2e1e..9cbba503e68 100644 --- a/ndb/tools/delete_all/delete_all.cpp +++ b/ndb/tools/delete_all/delete_all.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/tools/drop_index/drop_index.cpp b/ndb/tools/drop_index/drop_index.cpp index 146f01113b2..327f15741c9 100644 --- a/ndb/tools/drop_index/drop_index.cpp +++ b/ndb/tools/drop_index/drop_index.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/tools/drop_tab/drop_tab.cpp b/ndb/tools/drop_tab/drop_tab.cpp index 5946ada5956..70e5d85aabe 100644 --- a/ndb/tools/drop_tab/drop_tab.cpp +++ b/ndb/tools/drop_tab/drop_tab.cpp @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include diff --git a/ndb/tools/list_tables/listTables.cpp b/ndb/tools/list_tables/listTables.cpp index c14808050c6..41433862304 100644 --- a/ndb/tools/list_tables/listTables.cpp +++ b/ndb/tools/list_tables/listTables.cpp @@ -21,8 +21,9 @@ * */ -#include +#include #include + #include #include diff --git a/ndb/tools/select_all/select_all.cpp b/ndb/tools/select_all/select_all.cpp index 32e9d1c6872..34f63a095bb 100644 --- a/ndb/tools/select_all/select_all.cpp +++ b/ndb/tools/select_all/select_all.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/tools/select_count/select_count.cpp b/ndb/tools/select_count/select_count.cpp index 4d281b9bdd5..b1513ad4135 100644 --- a/ndb/tools/select_count/select_count.cpp +++ b/ndb/tools/select_count/select_count.cpp @@ -15,8 +15,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include + #include #include diff --git a/ndb/tools/transproxy/transproxy.cpp b/ndb/tools/transproxy/transproxy.cpp index 4c1308e63e7..384a8a34f03 100644 --- a/ndb/tools/transproxy/transproxy.cpp +++ b/ndb/tools/transproxy/transproxy.cpp @@ -14,14 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include diff --git a/ndb/tools/verify_index/verify_index.cpp b/ndb/tools/verify_index/verify_index.cpp index 324bb11cfe4..1295b657e9b 100644 --- a/ndb/tools/verify_index/verify_index.cpp +++ b/ndb/tools/verify_index/verify_index.cpp @@ -14,9 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include -#include -#include #include #include diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 61d173aac05..abde6ecbe73 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -10,6 +10,8 @@ in_rpm=0 windows=0 defaults="" +tmp_file=/tmp/mysql_install_db.$$ + case "$1" in --no-defaults|--defaults-file=*|--defaults-extra-file=*) defaults="$1"; shift @@ -212,9 +214,11 @@ then then echo "Fill help tables" fi - if ! (echo "use mysql; - " - cat $fill_help_tables) | eval "$mysqld_install_cmd_line" + echo "use mysql;" > $tmp_file + cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line" + res=$? + rm $tmp_file + if test $res != 0 then echo "" echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc index e2463761e67..b8ae5967475 100644 --- a/sql/examples/ha_example.cc +++ b/sql/examples/ha_example.cc @@ -14,6 +14,55 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + ha_example is a stubbed storage engine. It does nothing at this point. It + will let you create/open/delete tables but that is all. You can enable it + in your buld by doing the following during your build process: + ./configure --with-example-storage-engine + + Once this is done mysql will let you create tables with: + CREATE TABLE A (...) ENGINE=EXAMPLE; + + The example is setup to use table locks. It implements an example "SHARE" + that is inserted into a hash by table name. You can use this to store + information of state that any example handler object will be able to see + if it is using the same table. + + Please read the object definition in ha_example.h before reading the rest + if this file. + + To get an idea of what occurs here is an example select that would do a + scan of an entire table: + ha_example::store_lock + ha_example::external_lock + ha_example::info + ha_example::rnd_init + ha_example::extra + ENUM HA_EXTRA_CACHE Cash record in HA_rrnd() + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::rnd_next + ha_example::extra + ENUM HA_EXTRA_NO_CACHE End cacheing of records (def) + ha_example::external_lock + ha_example::extra + ENUM HA_EXTRA_RESET Reset database to after open + + In the above example has 9 row called before rnd_next signalled that it was + at the end of its data. In the above example the table was already opened + (or you would have seen a call to ha_example::open(). Calls to + ha_example::extra() are hints as to what will be occuring to the request. + + Happy coding! + -Brian +*/ + #ifdef __GNUC__ #pragma implementation // gcc: Class implementation #endif @@ -24,10 +73,14 @@ #include "ha_example.h" /* Variables for example share methods */ -pthread_mutex_t example_mutex; -static HASH example_open_tables; -static int example_init= 0; +static HASH example_open_tables; // Hash used to track open tables +pthread_mutex_t example_mutex; // This is the mutex we use to init the hash +static int example_init= 0; // Variable for checking the init state of hash + +/* + Function we use in the creation of our hash to get key. +*/ static byte* example_get_key(EXAMPLE_SHARE *share,uint *length, my_bool not_used __attribute__((unused))) { @@ -37,7 +90,9 @@ static byte* example_get_key(EXAMPLE_SHARE *share,uint *length, /* - Example of simple lock controls. + Example of simple lock controls. The "share" it creates is structure we will + pass to each example handler. Do you have to have one of these? Well, you have + pieces that are used for locking, and they are needed to function. */ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) { @@ -45,6 +100,12 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) uint length; char *tmp_name; + /* + So why does this exist? There is no way currently to init a storage engine. + Innodb and BDB both have modifications to the server to allow them to + do this. Since you will not want to do this, this is probably the next + best method. + */ if (!example_init) { /* Hijack a mutex for init'ing the storage engine */ @@ -101,7 +162,8 @@ error: /* - Free lock controls. + Free lock controls. We call this whenever we close a table. If the table had + the last reference to the share then we free memory associated with it. */ static int free_share(EXAMPLE_SHARE *share) { @@ -119,10 +181,24 @@ static int free_share(EXAMPLE_SHARE *share) } +/* + If frm_error() is called then we will use this to to find out what file extentions + exist for the storage engine. This is also used by the default rename_table and + delete_table method in handler.cc. +*/ const char **ha_example::bas_ext() const { static const char *ext[]= { NullS }; return ext; } +/* + Used for opening tables. The name will be the name of the file. + A table is opened when it needs to be opened. For instance + when a request comes in for a select on the table (tables are not + open and closed for each request, they are cached). + + Called from handler.cc by handler::ha_open(). The server opens all tables by + calling ha_open() which then calls the handler specific open(). +*/ int ha_example::open(const char *name, int mode, uint test_if_locked) { DBUG_ENTER("ha_example::open"); @@ -134,18 +210,66 @@ int ha_example::open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(0); } + +/* + Closes a table. We call the free_share() function to free any resources + that we have allocated in the "shared" structure. + + Called from sql_base.cc, sql_select.cc, and table.cc. + In sql_select.cc it is only used to close up temporary tables or during + the process where a temporary table is converted over to being a + myisam table. + For sql_base.cc look at close_data_tables(). +*/ int ha_example::close(void) { DBUG_ENTER("ha_example::close"); DBUG_RETURN(free_share(share)); } + +/* + write_row() inserts a row. No extra() hint is given currently if a bulk load + is happeneding. buf() is a byte array of data. You can use the field + information to extract the data from the native byte array type. + Example of this would be: + for (Field **field=table->field ; *field ; field++) + { + ... + } + + See ha_tina.cc for an example of extracting all of the data as strings. + ha_berekly.cc has an example of how to store it intact by "packing" it + for ha_berkeley's own native storage type. + + See the note for update_row() on auto_increments and timestamps. This + case also applied to write_row(). + + Called from item_sum.cc, item_sum.cc, sql_acl.cc, sql_insert.cc, + sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc, and sql_update.cc. +*/ int ha_example::write_row(byte * buf) { DBUG_ENTER("ha_example::write_row"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + Yes, update_row() does what you expect, it updates a row. old_data will have + the previous row record in it, while new_data will have the newest data in + it. + Keep in mind that the server can do updates based on ordering if an ORDER BY + clause was used. Consecutive ordering is not guarenteed. + Currently new_data will not have an updated auto_increament record, or + and updated timestamp field. You can do these for example by doing these: + if (table->timestamp_on_update_now) + update_timestamp(new_row+table->timestamp_on_update_now-1); + if (table->next_number_field && record == table->record[0]) + update_auto_increment(); + + Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc. +*/ int ha_example::update_row(const byte * old_data, byte * new_data) { @@ -153,12 +277,32 @@ int ha_example::update_row(const byte * old_data, byte * new_data) DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + This will delete a row. buf will contain a copy of the row to be deleted. + The server will call this right after the current row has been called (from + either a previous rnd_nexT() or index call). + If you keep a pointer to the last row or can access a primary key it will + make doing the deletion quite a bit easier. + Keep in mind that the server does no guarentee consecutive deletions. ORDER BY + clauses can be used. + + Called in sql_acl.cc and sql_udf.cc to manage internal table information. + Called in sql_delete.cc, sql_insert.cc, and sql_select.cc. In sql_select it is + used for removing duplicates while in insert it is used for REPLACE calls. +*/ int ha_example::delete_row(const byte * buf) { DBUG_ENTER("ha_example::delete_row"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + Positions an index cursor to the index specified in the handle. Fetches the + row if available. If the key value is null, begin at the first key of the + index. +*/ int ha_example::index_read(byte * buf, const byte * key, uint key_len __attribute__((unused)), enum ha_rkey_function find_flag @@ -168,6 +312,11 @@ int ha_example::index_read(byte * buf, const byte * key, DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + Positions an index cursor to the index specified in key. Fetches the + row if any. This is only used to read whole keys. +*/ int ha_example::index_read_idx(byte * buf, uint index, const byte * key, uint key_len __attribute__((unused)), enum ha_rkey_function find_flag @@ -178,66 +327,187 @@ int ha_example::index_read_idx(byte * buf, uint index, const byte * key, } +/* + Used to read forward through the index. +*/ int ha_example::index_next(byte * buf) { DBUG_ENTER("ha_example::index_next"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + Used to read backwards through the index. +*/ int ha_example::index_prev(byte * buf) { DBUG_ENTER("ha_example::index_prev"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + index_first() asks for the first key in the index. + + Called from opt_range.cc, opt_sum.cc, sql_handler.cc, + and sql_select.cc. +*/ int ha_example::index_first(byte * buf) { DBUG_ENTER("ha_example::index_first"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + index_last() asks for the last key in the index. + + Called from opt_range.cc, opt_sum.cc, sql_handler.cc, + and sql_select.cc. +*/ int ha_example::index_last(byte * buf) { DBUG_ENTER("ha_example::index_last"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + rnd_init() is called when the system wants the storage engine to do a table + scan. + See the example in the introduction at the top of this file to see when + rnd_init() is called. + + Called from filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc, + and sql_update.cc. +*/ int ha_example::rnd_init(bool scan) { DBUG_ENTER("ha_example::rnd_init"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + This is called for each row of the table scan. When you run out of records + you should return HA_ERR_END_OF_FILE. Fill buff up with the row information. + The Field structure for the table is the key to getting data into buf + in a manner that will allow the server to understand it. + + Called from filesort.cc, records.cc, sql_handler.cc, sql_select.cc, sql_table.cc, + and sql_update.cc. +*/ int ha_example::rnd_next(byte *buf) { DBUG_ENTER("ha_example::rnd_next"); DBUG_RETURN(HA_ERR_END_OF_FILE); } + +/* + position() is called after each call to rnd_next() if the data needs + to be ordered. You can do something like the following to store + the position: + ha_store_ptr(ref, ref_length, current_position); + + The server uses ref to store data. ref_length in the above case is + the size needed to store current_position. ref is just a byte array + that the server will maintain. If you are using offsets to mark rows, then + current_position should be the offset. If it is a primary key like in + BDB, then it needs to be a primary key. + + Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc. +*/ void ha_example::position(const byte *record) { DBUG_ENTER("ha_example::position"); DBUG_VOID_RETURN; } + +/* + This is like rnd_next, but you are given a position to use + to determine the row. The position will be of the type that you stored in + ref. You can use ha_get_ptr(pos,ref_length) to retrieve whatever key + or position you saved when position() was called. + Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc. +*/ int ha_example::rnd_pos(byte * buf, byte *pos) { DBUG_ENTER("ha_example::rnd_pos"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + ::info() is used to return information to the optimizer. + Currently this table handler doesn't implement most of the fields + really needed. SHOW also makes use of this data + Another note, you will probably want to have the following in your + code: + if (records < 2) + records = 2; + The reason is that the server will optimize for cases of only a single + record. If in a table scan you don't know the number of records + it will probably be better to set records to two so you can return + as many records as you need. + Along with records a few more variables you may wish to set are: + records + deleted + data_file_length + index_file_length + delete_length + check_time + Take a look at the public variables in handler.h for more information. + + Called in: + filesort.cc + ha_heap.cc + item_sum.cc + opt_sum.cc + sql_delete.cc + sql_delete.cc + sql_derived.cc + sql_select.cc + sql_select.cc + sql_select.cc + sql_select.cc + sql_select.cc + sql_show.cc + sql_show.cc + sql_show.cc + sql_show.cc + sql_table.cc + sql_union.cc + sql_update.cc + +*/ void ha_example::info(uint flag) { DBUG_ENTER("ha_example::info"); DBUG_VOID_RETURN; } + +/* + extra() is called whenever the server wishes to send a hint to + the storage engine. The myisam engine implements the most hints. + ha_innodb.cc has the most exhaustive list of these hints. +*/ int ha_example::extra(enum ha_extra_function operation) { DBUG_ENTER("ha_example::extra"); DBUG_RETURN(0); } + +/* + Deprecated and likely to be removed in the future. Storage engines normally + just make a call like: + ha_example::extra(HA_EXTRA_RESET); + to handle it. +*/ int ha_example::reset(void) { DBUG_ENTER("ha_example::reset"); @@ -245,18 +515,71 @@ int ha_example::reset(void) } +/* + Used to delete all rows in a table. Both for cases of truncate and + for cases where the optimizer realizes that all rows will be + removed as a result of a SQL statement. + + Called from item_sum.cc by Item_func_group_concat::clear(), + Item_sum_count_distinct::clear(), and Item_func_group_concat::clear(). + Called from sql_delete.cc by mysql_delete(). + Called from sql_select.cc by JOIN::reinit(). + Called from sql_union.cc by st_select_lex_unit::exec(). +*/ int ha_example::delete_all_rows() { DBUG_ENTER("ha_example::delete_all_rows"); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } + +/* + First you should go read the section "locking functions for mysql" in + lock.cc to understand this. + This create a lock on the table. If you are implementing a storage engine + that can handle transacations look at ha_berkely.cc to see how you will + want to goo about doing this. Otherwise you should consider calling flock() + here. + + Called from lock.cc by lock_external() and unlock_external(). Also called + from sql_table.cc by copy_data_between_tables(). +*/ int ha_example::external_lock(THD *thd, int lock_type) { DBUG_ENTER("ha_example::external_lock"); DBUG_RETURN(0); } + +/* + The idea with handler::store_lock() is the following: + + The statement decided which locks we should need for the table + for updates/deletes/inserts we get WRITE locks, for SELECT... we get + read locks. + + Before adding the lock into the table lock handler (see thr_lock.c) + mysqld calls store lock with the requested locks. Store lock can now + modify a write lock to a read lock (or some other lock), ignore the + lock (if we don't want to use MySQL table locks at all) or add locks + for many tables (like we do when we are using a MERGE handler). + + Berkeley DB for example changes all WRITE locks to TL_WRITE_ALLOW_WRITE + (which signals that we are doing WRITES, but we are still allowing other + reader's and writer's. + + When releasing locks, store_lock() are also called. In this case one + usually doesn't have to do anything. + + In some exceptional cases MySQL may send a request for a TL_IGNORE; + This means that we are requesting the same lock as last time and this + should also be ignored. (This may happen when someone does a flush + table when we have opened a part of the tables, in which case mysqld + closes and reopens the tables and tries to get the same locks at last + time). In the future we will probably try to remove this. + + Called from lock.cc by get_lock_data(). +*/ THR_LOCK_DATA **ha_example::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) @@ -267,6 +590,16 @@ THR_LOCK_DATA **ha_example::store_lock(THD *thd, return to; } +/* + Used to delete a table. By the time delete_table() has been called all + opened references to this table will have been closed (and your globally + shared references released. The variable name will just be the name of + the table. You will need to remove any files you have created at this point. + + Called from handler.cc by delete_table and ha_create_table(). Only used + during create if the table_flag HA_DROP_BEFORE_CREATE was specified for + the storage engine. +*/ int ha_example::delete_table(const char *name) { DBUG_ENTER("ha_example::delete_table"); @@ -274,12 +607,24 @@ int ha_example::delete_table(const char *name) DBUG_RETURN(0); } +/* + Renames a table from one name to another from alter table call. + + Called from sql_table.cc by mysql_rename_table(). +*/ int ha_example::rename_table(const char * from, const char * to) { DBUG_ENTER("ha_example::rename_table "); DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); } +/* + Given a starting key, and an ending key estimate the number of rows that + will exist between the two. end_key may be empty which in case determine + if start_key matches any rows. + + Called from opt_range.cc by check_quick_keys(). +*/ ha_rows ha_example::records_in_range(int inx, const byte *start_key,uint start_key_len, enum ha_rkey_function start_search_flag, @@ -287,11 +632,22 @@ ha_rows ha_example::records_in_range(int inx, enum ha_rkey_function end_search_flag) { DBUG_ENTER("ha_example::records_in_range "); - DBUG_RETURN(records); // HA_ERR_NOT_IMPLEMENTED + DBUG_RETURN(records); } -int ha_example::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) +/* + create() is called to create a database. The variable name will have the name + of the table. When create() is called you do not need to worry about opening + the table. Also, the FRM file will have already been created so adjusting + create_info will not do you any good. You can overwrite the frm file at this + point if you wish to change the table definition, but there are no methods + currently provided for doing that. + + Called from handle.cc by ha_create_table(). +*/ +int ha_example::create(const char *name, TABLE *table_arg, + HA_CREATE_INFO *create_info) { DBUG_ENTER("ha_example::create"); /* This is not implemented but we want someone to be able that it works. */ diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index 466632a1795..ffc4f5b941c 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -14,6 +14,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + Please read ha_exmple.cc before reading this file. + Please keep in mind that the example storage engine implements all methods + that are required to be implemented. handler.h has a full list of methods + that you can implement. +*/ + +/* + EXAMPLE_SHARE is a structure that will be shared amoung all open handlers + The example implements the minimum of what you will probably need. +*/ typedef struct st_example_share { char *table_name; uint table_name_length,use_count; @@ -21,6 +32,9 @@ typedef struct st_example_share { THR_LOCK lock; } EXAMPLE_SHARE; +/* + Class definition for the storage engine +*/ class ha_example: public handler { THR_LOCK_DATA lock; /* MySQL lock */ @@ -33,17 +47,34 @@ public: ~ha_example() { } - const char *table_type() const { return "EXAMPLE"; } + /* The name that will be used for display purposes */ + const char *table_type() const { return "EXAMPLE"; } + /* The name of the index type that will be used for display */ const char *index_type(uint inx) { return "NONE"; } const char **bas_ext() const; + /* + This is a list of flags that says what the storage engine + implements. The current table flags are documented in + table_flags. + */ ulong table_flags() const { return 0; } + /* + This is a list of flags that says how the storage engine + implements indexes. The current index flags are documented in + handler.h. If you do not implement indexes, just return zero + here. + */ ulong index_flags(uint inx) const { return 0; } + /* + unireg.cc will call the following to make sure that the storage engine can + handle the data it is about to send. + */ uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return 0; } uint max_key_parts() const { return 0; } @@ -52,10 +83,15 @@ public: Called in test_quick_select to determine if indexes should be used. */ virtual double scan_time() { return (double) (records+deleted) / 20.0+10; } - /* The next method will never be called */ + /* + The next method will never be called if you do not implement indexes. + */ virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; } virtual bool fast_key_read() { return 1;} + /* + Everything below are methods that we implment in ha_example.cc. + */ int open(const char *name, int mode, uint test_if_locked); int close(void); int write_row(byte * buf); diff --git a/sql/field.cc b/sql/field.cc index fdf314972c8..edaa29dbaa0 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2307,7 +2307,8 @@ int Field_float::store(double nr) } else { - max_value= (log_10[field_length]-1)/log_10[dec]; + uint tmp=min(field_length,array_elements(log_10)-1); + max_value= (log_10[tmp]-1)/log_10[dec]; /* The following comparison is needed to not get an overflow if nr is close to FLT_MAX @@ -2607,7 +2608,8 @@ int Field_double::store(double nr) } else { - max_value= (log_10[field_length]-1)/log_10[dec]; + uint tmp=min(field_length,array_elements(log_10)-1); + max_value= (log_10[tmp]-1)/log_10[dec]; if (fabs(nr) < DBL_MAX/10.0e+32) nr= floor(nr*log_10[dec]+0.5)/log_10[dec]; } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index afbf0b7163e..446d72ac143 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -221,6 +221,7 @@ void Item_bool_func2::fix_length_and_dec() { conv= new Item_func_conv_charset(args[weak],args[strong]->collation.collation); conv->collation.set(args[weak]->collation.derivation); + conv->fix_fields(current_thd, 0, &conv); } args[weak]= conv ? conv : args[weak]; } diff --git a/sql/item_func.cc b/sql/item_func.cc index d7e778171a0..aaea676fee1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2376,7 +2376,10 @@ longlong user_var_entry::val_int(my_bool *null_value) case INT_RESULT: return *(longlong*) value; case STRING_RESULT: - return strtoull(value,NULL,10); // String is null terminated + { + int error; + return my_strtoll10(value, (char**) 0, &error);// String is null terminated + } case ROW_RESULT: DBUG_ASSERT(1); // Impossible break; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index f254ffb3df3..2a5381ae478 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -915,12 +915,14 @@ int load_master_data(THD* thd) setting active_mi, because init_master_info() sets active_mi with defaults. */ + int error; + if (init_master_info(active_mi, master_info_file, relay_log_info_file, 0)) send_error(thd, ER_MASTER_INFO); strmake(active_mi->master_log_name, row[0], sizeof(active_mi->master_log_name)); - active_mi->master_log_pos = strtoull(row[1], (char**) 0, 10); + active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error); /* at least in recent versions, the condition below should be false */ if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE) active_mi->master_log_pos = BIN_LOG_HEADER_SIZE; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index b2d030b523d..9c7fe3e2993 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1918,7 +1918,8 @@ static int replace_column_table(GRANT_TABLE *g_t, ulong privileges = xx->rights; bool old_row_exists=0; key_restore(table,key,0,key_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(),&my_charset_latin1); + table->field[4]->store(xx->column.ptr(),xx->column.length(), + &my_charset_latin1); if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr, 0, HA_READ_KEY_EXACT)) @@ -1931,9 +1932,10 @@ static int replace_column_table(GRANT_TABLE *g_t, continue; /* purecov: inspected */ } old_row_exists = 0; - restore_record(table,default_values); // Get empty record + restore_record(table,default_values); // Get empty record key_restore(table,key,0,key_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(), &my_charset_latin1); + table->field[4]->store(xx->column.ptr(),xx->column.length(), + &my_charset_latin1); } else { diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 3c9563165fe..68f7d45e81c 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -187,7 +187,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) } if (str == end && info->integers) { - info->ullval = (ulonglong) strtoull(begin ,NULL, 10); + char *endpos= (char*) end; + int error; + info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); if (info->integers == 1) return 0; // a single number can't be zerofill info->maybe_zerofill = 1; @@ -199,7 +201,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) return 0; if ((str + 1) == end) // number was something like '123[.eE]' { - info->ullval = (ulonglong) strtoull(begin, NULL, 10); + char *endpos= (char*) str; + int error; + info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); return 1; } if (*str == 'e' || *str == 'E') // number may be something like '1e+50' @@ -218,7 +222,9 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end if (str == end) // number was something like '123.000' { - info->ullval = (ulonglong) strtoull(begin, NULL, 10); + char *endpos= (char*) str; + int error; + info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error); return 1; } for (; str != end && my_isdigit(system_charset_info,*str); str++) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index f297ddf2917..03d67c4f300 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -84,26 +84,71 @@ bool key_part_spec::operator==(const key_part_spec& other) const return length == other.length && !strcmp(field_name, other.field_name); } -/* Equality comparison of keys (ignoring name) */ -bool Key::operator==(Key& other) + +/* + Test if a foreign key is a prefix of the given key + (ignoring key name, key type and order of columns) + + NOTES: + This is only used to test if an index for a FOREIGN KEY exists + + IMPLEMENTATION + We only compare field names + + RETURN + 0 Generated key is a prefix of other key + 1 Not equal +*/ + +bool foreign_key_prefix(Key *a, Key *b) { - if (type == other.type && - algorithm == other.algorithm && - columns.elements == other.columns.elements) + /* Ensure that 'a' is the generated key */ + if (a->generated) { - List_iterator col_it1(columns); - List_iterator col_it2(other.columns); - const key_part_spec *col1, *col2; - while ((col1 = col_it1++)) - { - col2 = col_it2++; - DBUG_ASSERT(col2 != NULL); - if (!(*col1 == *col2)) - return false; - } - return true; + if (b->generated && a->columns.elements > b->columns.elements) + swap(Key*, a, b); // Put shorter key in 'a' } - return false; + else + { + if (!b->generated) + return TRUE; // No foreign key + swap(Key*, a, b); // Put generated key in 'a' + } + + /* Test if 'a' is a prefix of 'b' */ + if (a->columns.elements > b->columns.elements) + return TRUE; // Can't be prefix + + List_iterator col_it1(a->columns); + List_iterator col_it2(b->columns); + const key_part_spec *col1, *col2; + +#ifdef ENABLE_WHEN_INNODB_CAN_HANDLE_SWAPED_FOREIGN_KEY_COLUMNS + while ((col1= col_it1++)) + { + bool found= 0; + col_it2.rewind(); + while ((col2= col_it2++)) + { + if (*col1 == *col2) + { + found= TRUE; + break; + } + } + if (!found) + return TRUE; // Error + } + return FALSE; // Is prefix +#else + while ((col1= col_it1++)) + { + col2= col_it2++; + if (!(*col1 == *col2)) + return TRUE; + } + return FALSE; // Is prefix +#endif } diff --git a/sql/sql_class.h b/sql/sql_class.h index a2094d8fe7c..e602b7d6d5f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -240,14 +240,16 @@ public: enum ha_key_alg algorithm; List columns; const char *name; + bool generated; Key(enum Keytype type_par, const char *name_arg, enum ha_key_alg alg_par, - List &cols) - :type(type_par), algorithm(alg_par), columns(cols), name(name_arg) + bool generated_arg, List &cols) + :type(type_par), algorithm(alg_par), columns(cols), name(name_arg), + generated(generated_arg) {} ~Key() {} /* Equality comparison of keys (ignoring name) */ - bool operator==(Key& other); + friend bool foreign_key_prefix(Key *a, Key *b); }; class Table_ident; @@ -265,7 +267,7 @@ public: foreign_key(const char *name_arg, List &cols, Table_ident *table, List &ref_cols, uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg) - :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, cols), + :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols), ref_table(table), ref_columns(cols), delete_opt(delete_opt_arg), update_opt(update_opt_arg), match_opt(match_opt_arg) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 98f6a12ec64..e949d40625d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3958,13 +3958,13 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, { lex->col_list.push_back(new key_part_spec(field_name,0)); lex->key_list.push_back(new Key(Key::PRIMARY, NullS, HA_KEY_ALG_UNDEF, - lex->col_list)); + 0, lex->col_list)); lex->col_list.empty(); } if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG)) { lex->col_list.push_back(new key_part_spec(field_name,0)); - lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF, + lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF, 0, lex->col_list)); lex->col_list.empty(); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5db4a0042ea..c330d1e6b54 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -367,7 +367,7 @@ JOIN::prepare(Item ***rref_pointer_array, { if (item->with_sum_func) flag|=1; - else if (!(flag & 2) && !item->const_item()) + else if (!(flag & 2) && !item->const_during_execution()) flag|=2; } if (flag == 3) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9521e1d909b..edcc77d11f4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -679,14 +679,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(-1); } key_iterator2.rewind (); - while ((key2 = key_iterator2++) != key) + if (key->type != Key::FOREIGN_KEY) { - if (*key == *key2) + while ((key2 = key_iterator2++) != key) { - /* TO DO: issue warning message */ - /* mark that the key should be ignored */ - key->name=ignore_key; - break; + if ((key2->type != Key::FOREIGN_KEY && !foreign_key_prefix(key, key2))) + { + /* TO DO: issue warning message */ + /* mark that the generated key should be ignored */ + if (!key2->generated || + (key->generated && key->columns.elements < + key2->columns.elements)) + key->name= ignore_key; + else + { + /* Remove the previous, generated key */ + key2->name= ignore_key; + key_parts-= key2->columns.elements; + (*key_count)--; + } + break; + } } } if (key->name != ignore_key) @@ -731,14 +744,14 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, switch(key->type){ case Key::MULTIPLE: - key_info->flags = 0; + key_info->flags= 0; break; case Key::FULLTEXT: - key_info->flags = HA_FULLTEXT; + key_info->flags= HA_FULLTEXT; break; case Key::SPATIAL: #ifdef HAVE_SPATIAL - key_info->flags = HA_SPATIAL; + key_info->flags= HA_SPATIAL; break; #else my_printf_error(ER_FEATURE_DISABLED,ER(ER_FEATURE_DISABLED),MYF(0), @@ -749,8 +762,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, key_number--; // Skip this key continue; default: - key_info->flags = HA_NOSAME; + key_info->flags = HA_NOSAME; + break; } + if (key->generated) + key_info->flags|= HA_GENERATED_KEY; key_info->key_parts=(uint8) key->columns.elements; key_info->key_part=key_part_info; @@ -774,7 +790,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, */ /* TODO: Add proper checks if handler supports key_type and algorithm */ - if (key_info->flags == HA_SPATIAL) + if (key_info->flags & HA_SPATIAL) { if (key_info->key_parts != 1) { @@ -2824,6 +2840,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, Key::FULLTEXT : Key::MULTIPLE)), key_name, key_info->algorithm, + test(key_info->flags & HA_GENERATED_KEY), key_parts)); } { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0693d33c781..0f29289ac25 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -955,7 +955,7 @@ create: { LEX *lex=Lex; - lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list)); + lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list)); lex->col_list.empty(); } | CREATE DATABASE opt_if_not_exists ident @@ -1187,14 +1187,15 @@ key_def: key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; - lex->key_list.push_back(new Key($1,$2, $3, lex->col_list)); + lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; const char *key_name= $3 ? $3:$1; - lex->key_list.push_back(new Key($2, key_name, $4, lex->col_list)); + lex->key_list.push_back(new Key($2, key_name, $4, 0, + lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references @@ -1206,8 +1207,9 @@ key_def: lex->fk_delete_opt, lex->fk_update_opt, lex->fk_match_option)); - lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4:$1, - HA_KEY_ALG_UNDEF, lex->col_list)); + lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1, + HA_KEY_ALG_UNDEF, 1, + lex->col_list)); lex->col_list.empty(); /* Alloced by sql_alloc */ } | constraint opt_check_constraint @@ -3634,18 +3636,20 @@ delete_limit_clause: }; ULONG_NUM: - NUM { $$= strtoul($1.str,NULL,10); } - | LONG_NUM { $$= (ulong) strtoll($1.str,NULL,10); } - | ULONGLONG_NUM { $$= (ulong) strtoull($1.str,NULL,10); } - | REAL_NUM { $$= strtoul($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoul($1.str,NULL,10); }; + NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | REAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + ; ulonglong_num: - NUM { $$= (ulonglong) strtoul($1.str,NULL,10); } - | ULONGLONG_NUM { $$= strtoull($1.str,NULL,10); } - | LONG_NUM { $$= (ulonglong) strtoll($1.str,NULL,10); } - | REAL_NUM { $$= strtoull($1.str,NULL,10); } - | FLOAT_NUM { $$= strtoull($1.str,NULL,10); }; + NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | REAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + ; procedure_clause: /* empty */ diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 7a010c3bef8..520fec676b1 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -18,60 +18,6 @@ #include "m_string.h" #include "m_ctype.h" - -static uint16 latin1_uni[256]={ - 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, -0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, -0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, -0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, -0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, -0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, -0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, -0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, -0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, -0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, -0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, -0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, -0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, -0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, -0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, -0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 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, -0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, -0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, -0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, -0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, -0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, -0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, -0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, -0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, -0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, -0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, -0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, -0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF -}; - -static uchar uni_latin1[]={ -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, -0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, -0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, -0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, -0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, -0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, -0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, -0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, -0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, -0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}; - static uchar ctype_latin1[] = { 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, @@ -149,29 +95,287 @@ static uchar sort_order_latin1[] = { 68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255 }; +/* + WL#1494 notes: + + We'll use cp1252 instead of iso-8859-1. + cp1252 contains printable characters in the range 0x80-0x9F. + In ISO 8859-1, these code points have no associated printable + characters. Therefore, by converting from CP1252 to ISO 8859-1, + one would lose the euro (for instance). Since most people are + unaware of the difference, and since we don't really want a + "Windows ANSI" to differ from a "Unix ANSI", we will: + + - continue to pretend the latin1 character set is ISO 8859-1 + - actually allow the storage of euro etc. so it's actually cp1252 +*/ + +unsigned short cs_to_uni[256]={ +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x0000,0x017D,0x0000, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x0000,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; +unsigned char pl00[256]={ +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, +0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, +0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, +0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, +0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, +0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, +0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, +0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, +0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, +0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, +0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, +0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, +0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, +0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, +0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; +unsigned char pl01[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x8C,0x9C,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x8A,0x9A,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x9F,0x00,0x00,0x00,0x00,0x8E,0x9E,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x83,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +unsigned char pl02[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +unsigned char pl20[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x96,0x97,0x00,0x00,0x00, +0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00, +0x86,0x87,0x95,0x00,0x00,0x00,0x85,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +unsigned char pl21[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x99,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +unsigned char *uni_to_cs[256]={ +pl00,pl01,pl02,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +pl20,pl21,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL +}; static -int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), - my_wc_t *wc, - const unsigned char *str, - const unsigned char *end) +int my_mb_wc_latin1(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); - return ((wc[0]= latin1_uni[*str]) || (!str[0])) ? 1 : MY_CS_ILSEQ; + *wc=cs_to_uni[*str]; + return (!wc[0] && str[0]) ? MY_CS_ILSEQ : 1; } static -int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), - my_wc_t wc, - unsigned char *str, - unsigned char *end) +int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, + unsigned char *str, + unsigned char *end __attribute__((unused))) { + unsigned char *pl; + if (str >= end) return MY_CS_TOOSMALL; - - return ((wc < 256) && ((str[0]=uni_latin1[wc]) || (!wc))) ? 1 : MY_CS_ILUNI; + + pl= uni_to_cs[(wc>>8) & 0xFF]; + str[0]= pl ? pl[wc & 0xFF] : '\0'; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; } static MY_CHARSET_HANDLER my_charset_handler= @@ -212,7 +416,7 @@ CHARSET_INFO my_charset_latin1= to_lower_latin1, to_upper_latin1, sort_order_latin1, - latin1_uni, /* tab_to_uni */ + cs_to_uni, /* tab_to_uni */ NULL, /* tab_from_uni */ "","", 1, /* strxfrm_multiply */ @@ -489,7 +693,7 @@ CHARSET_INFO my_charset_latin1_german2_ci= to_lower_latin1, to_upper_latin1, sort_order_latin1_de, - latin1_uni, /* tab_to_uni */ + cs_to_uni, /* tab_to_uni */ NULL, /* tab_from_uni */ "","", 2, /* strxfrm_multiply */ @@ -513,7 +717,7 @@ CHARSET_INFO my_charset_latin1_bin= to_lower_latin1, to_upper_latin1, sort_order_latin1_de, - latin1_uni, /* tab_to_uni */ + cs_to_uni, /* tab_to_uni */ NULL, /* tab_from_uni */ "", "", diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 68cd77f96fc..5f413305c88 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4474,6 +4474,11 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), if ((int) wc < 0x80) { + if (wc == 0x5c) + { + code= 0x815f; + goto mb; + } s[0]= (uchar) wc; return 1; } @@ -4486,7 +4491,8 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), s[0]= code; return 1; } - + +mb: if (s+2>e) return MY_CS_TOOSMALL; diff --git a/strings/dump_map.c b/strings/dump_map.c index f999160d0d4..708d9139f3c 100644 --- a/strings/dump_map.c +++ b/strings/dump_map.c @@ -1,13 +1,15 @@ #include #include -static void print_short_array(unsigned short *a) +static void print_short_array(unsigned short *a, size_t width) { int i; printf("{\n"); for (i=0; i<=0xFF; i++) { - printf("0x%04X%s%s",(int)a[i],i<0xFF?",":"",(i+1) % 8 ? "" :"\n"); + const char *fmt= (width==4) ? "0x%04X" : "0x%02X"; + printf(fmt,(int)a[i]); + printf("%s%s",i<0xFF?",":"",(i+1) % 8 ? "" :"\n"); } printf("};\n"); @@ -41,7 +43,7 @@ int main(void) } printf("unsigned short cs_to_uni[256]="); - print_short_array(touni); + print_short_array(touni, 4); for (i=0;i<=0xFF;i++) { @@ -53,7 +55,7 @@ int main(void) if (fromstat[i]) { printf("unsigned char pl%02X[256]=",i); - print_short_array(fromuni+i*256); + print_short_array(fromuni+i*256, 2); } } diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 6319fbb4d9f..349350c6c7a 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -196,15 +196,15 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error) 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)) + 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; + return negative ? LONGLONG_MIN : (longlong) ULONGLONG_MAX; end_i: *endptr= (char*) s; diff --git a/strings/strings-x86.s b/strings/strings-x86.s index d316c34febb..30a7517a372 100644 --- a/strings/strings-x86.s +++ b/strings/strings-x86.s @@ -43,7 +43,9 @@ bmove_align: .ba_20: pop %esi movl %edx,%edi ret - .size bmove_align,.end-bmove_align + +.bmove_align_end: + .size bmove_align,.bmove_align_end-bmove_align # Move a string from higher to lower # Arg from_end+1,to_end+1,length diff --git a/support-files/MacOSX/StartupItem.Description.plist b/support-files/MacOSX/StartupItem.Description.plist index 1f0023bde0d..e8ceb1ee062 100644 --- a/support-files/MacOSX/StartupItem.Description.plist +++ b/support-files/MacOSX/StartupItem.Description.plist @@ -10,6 +10,6 @@ IFPkgDescriptionTitle MySQL Startup Item IFPkgDescriptionVersion - 1.0 + 1.1 diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index ba92856df0e..5fdde0d2963 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -31,6 +31,7 @@ max_allowed_packet = 1M table_cache = 512 sort_buffer_size = 2M read_buffer_size = 2M +read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache = 8 query_cache_size = 32M diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index ba865a5bfd0..a17ec7b5227 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -31,6 +31,7 @@ max_allowed_packet = 1M table_cache = 256 sort_buffer_size = 1M read_buffer_size = 1M +read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M thread_cache = 8 query_cache_size= 16M diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 4650ed06dc1..d50d0717c17 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -32,6 +32,8 @@ max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K +read_buffer_size = 256K +read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # Don't listen on a TCP/IP port at all. This can be a security enhancement, diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index ca26a10a397..2ae62fb48f1 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -31,6 +31,8 @@ key_buffer = 16K max_allowed_packet = 1M table_cache = 4 sort_buffer_size = 64K +read_buffer_size = 256K +read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 64K diff --git a/tests/client_test.c b/tests/client_test.c index d382377fe49..ba70bcd7fa7 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -9453,7 +9453,6 @@ select col1 FROM t1 where col1=2"); myquery(rc); } - /* This tests for various mysql_send_long_data bugs described in #1664 */ @@ -9595,6 +9594,51 @@ static void test_bug1664() myquery(rc); } + +static void test_order_param() +{ + MYSQL_STMT *stmt; + int rc; + + myheader("test_order_param"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql,"CREATE TABLE t1(a INT, b char(10))"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, + "select sum(a) + 200, 1 from t1 \ +union distinct \ +select sum(a) + 200, 1 from t1 \ +group by b "); + check_stmt(stmt); + + mysql_stmt_close(stmt); + + stmt= mysql_simple_prepare(mysql, + "select sum(a) + 200, ? from t1 \ +group by b \ +union distinct \ +select sum(a) + 200, 1 from t1 \ +group by b "); + check_stmt(stmt); + + stmt= mysql_simple_prepare(mysql, + "select sum(a) + 200, ? from t1 \ +union distinct \ +select sum(a) + 200, 1 from t1 \ +group by b "); + check_stmt(stmt); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE t1"); + myquery(rc); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -9877,6 +9921,8 @@ int main(int argc, char **argv) test_union2(); /* repeatable execution of union (Bug #3577) */ test_bug1664(); /* test for bugs in mysql_stmt_send_long_data() call (Bug #1664) */ + test_order_param(); /* ORDER BY with parameters in select list + (Bug #3686 */ end_time= time((time_t *)0); total_time+= difftime(end_time, start_time);