From edf2a160492093a89d77f8f674ee8bb59717f3e7 Mon Sep 17 00:00:00 2001 From: "Sinisa@sinisa.nasamreza.org" <> Date: Tue, 26 Apr 2005 21:27:06 +0300 Subject: [PATCH 01/78] union.result: Results for the above test case union.test: A test case for bug #10032 involving UNION's and ORDER BY clause sql_yacc.yy: Fix for a bug #10032 involving a parser bug with UNION's and ORDER BY --- mysql-test/r/union.result | 19 +++++++++++++++++++ mysql-test/t/union.test | 11 +++++++++++ sql/sql_yacc.yy | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c140ecd26e1..b315ae9a3f5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1235,3 +1235,22 @@ show columns from t2; Field Type Null Key Default Extra a varchar(3) YES NULL drop table t2, t1; +create table t1 ( id int not null auto_increment, primary key (id), col1 int); +insert into t1 (col1) values (2),(3),(4),(5),(6); +select 99 union all select id from t1 order by 1; +99 +1 +2 +3 +4 +5 +99 +select id from t1 union all select 99 order by 1; +id +1 +2 +3 +4 +5 +99 +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index b0446e1ea4a..ecd98428b5a 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -742,3 +742,14 @@ create table t2 select a from t1 union select c from t1; create table t2 select a from t1 union select b from t1; show columns from t2; drop table t2, t1; + + +# +# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM +# + +create table t1 ( id int not null auto_increment, primary key (id), col1 int); +insert into t1 (col1) values (2),(3),(4),(5),(6); +select 99 union all select id from t1 order by 1; +select id from t1 union all select 99 order by 1; +drop table t1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 594077dd4f3..8c9c845bbbd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2449,7 +2449,7 @@ select_part2: select_into select_lock_type; select_into: - opt_limit_clause {} + opt_order_clause opt_limit_clause {} | into | select_from | into select_from From d37ca8bfa723c83fd10d87f399cc3259977bc9c8 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 17 May 2005 21:14:01 +0200 Subject: [PATCH 02/78] BUG#9879 delimiter command discrepancy (4.1 vs. 5.0, mysql vs. mysqltest) - Added testcases to test delimiters in 5.0 - In 5.0 it's allowed to have a up to 16 byte string as delimiter, everything after the delimiter token will be treated as the delimiter. It's even allowed to set delimiter to 'delimiter', ':;' or'MySQL' --- mysql-test/r/mysql.result | 50 ++++++++++++++++++++++++++++++++ mysql-test/t/mysql.test | 34 ++++++++++++++++++++++ mysql-test/t/mysql_delimiter.sql | 48 ++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 mysql-test/r/mysql.result create mode 100644 mysql-test/t/mysql.test create mode 100644 mysql-test/t/mysql_delimiter.sql diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result new file mode 100644 index 00000000000..feb0b2348cd --- /dev/null +++ b/mysql-test/r/mysql.result @@ -0,0 +1,50 @@ +drop table if exists t1; +create table t1(a int); +insert into t1 values(1); + +Test default delimiter ; +a +1 + +Test delimiter without arg + +Test delimiter : +a +1 + +Test delimiter : +a +1 + +Test delimiter :; +a +1 + +Test delimiter // +a +1 + +Test delimiter MySQL +a +1 + +Test delimiter delimiter +a +1 + +Test delimiter : from command line +a +1 + +Test delimiter :; from command line +a +1 + +Test 'go' command(vertical output) G +*************************** 1. row *************************** +a: 1 + +Test 'go' command g +a +1 +drop table t1; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test new file mode 100644 index 00000000000..d30e5b65d8e --- /dev/null +++ b/mysql-test/t/mysql.test @@ -0,0 +1,34 @@ +# +# Testing the MySQL command line client(mysql) +# + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Test the "delimiter" functionality +# Bug#9879 +# +create table t1(a int); +insert into t1 values(1); + +# Test delimiters +--exec $MYSQL test < "./t/mysql_delimiter.sql" + +--disable_query_log +# Test delimiter : supplied on the command line +select "Test delimiter : from command line" as " "; +--exec $MYSQL test --delimiter=':' -e 'select * from t1:' +# Test delimiter :; supplied on the command line +select "Test delimiter :; from command line" as " "; +--exec $MYSQL test --delimiter=':;' -e 'select * from t1:;' +# Test 'go' command (vertical output) \G +select "Test 'go' command(vertical output) \G" as " "; +--exec $MYSQL test -e 'select * from t1\G' +# Test 'go' command \g +select "Test 'go' command \g" as " "; +--exec $MYSQL test -e 'select * from t1\g' +--enable_query_log + +drop table t1; diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql new file mode 100644 index 00000000000..4ea481a84e2 --- /dev/null +++ b/mysql-test/t/mysql_delimiter.sql @@ -0,0 +1,48 @@ + +# Test default delimiter ; +select "Test default delimiter ;" as " "; +select * from t1; + +# Test delimiter without argument +select "Test delimiter without arg" as " "; +# Nothing should be displayed, error is returned +delimiter +delimiter ; # Reset delimiter + +# Test delimiter : +select "Test delimiter :" as " "; +delimiter : +select * from t1: +delimiter ; # Reset delimiter + +# Test delimiter ':' +select "Test delimiter :" as " "; +delimiter ':' +select * from t1: +delimiter ; # Reset delimiter + +# Test delimiter :; +select "Test delimiter :;" as " "; +delimiter :; +select * from t1 :; +delimiter ; # Reset delimiter + +## Test delimiter // +select "Test delimiter //" as " "; +delimiter // +select * from t1// +delimiter ; # Reset delimiter + +# Test delimiter 'MySQL' +select "Test delimiter MySQL" as " "; +delimiter 'MySQL' +select * from t1MySQL +delimiter ; # Reset delimiter + +# Test delimiter 'delimiter'(should be allowed according to the code) +select "Test delimiter delimiter" as " "; +delimiter delimiter +select * from t1 delimiter +delimiter ; # Reset delimiter + + From b6179919f3fbdc82e3bb7eb22ee639f2b7c6053c Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Wed, 18 May 2005 05:39:10 +0200 Subject: [PATCH 03/78] Change Last_query_cost status variable from global to thread-local. --- sql/mysql_priv.h | 1 - sql/mysqld.cc | 3 +-- sql/sql_class.cc | 1 + sql/sql_class.h | 2 ++ sql/sql_select.cc | 3 +-- sql/sql_show.cc | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 36fc315c3c0..312f665e22f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1048,7 +1048,6 @@ extern char language[FN_REFLEN], reg_ext[FN_EXTLEN]; extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file; extern char log_error_file[FN_REFLEN], *opt_tc_log_file; -extern double last_query_cost; extern double log_10[32]; extern ulonglong log_10_int[20]; extern ulonglong keybuff_size; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 90d4f9b9a99..e45a61b0c04 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -345,7 +345,6 @@ ulong expire_logs_days = 0; ulong rpl_recovery_rank=0; ulong my_bind_addr; /* the address we bind to */ volatile ulong cached_thread_count= 0; -double last_query_cost= -1; /* -1 denotes that no query was compiled yet */ double log_10[32]; /* 10 potences */ time_t start_time; @@ -5714,7 +5713,7 @@ struct show_var_st status_vars[]= { {"Key_reads", (char*) &dflt_key_cache_var.global_cache_read, SHOW_KEY_CACHE_LONG}, {"Key_write_requests", (char*) &dflt_key_cache_var.global_cache_w_requests, SHOW_KEY_CACHE_LONG}, {"Key_writes", (char*) &dflt_key_cache_var.global_cache_write, SHOW_KEY_CACHE_LONG}, - {"Last_query_cost", (char*) &last_query_cost, SHOW_DOUBLE}, + {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, #ifdef HAVE_NDBCLUSTER_DB {"Ndb_", (char*) &ndb_status_variables, SHOW_VARS}, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index a6a1f4d60ef..8a43d80ba52 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -444,6 +444,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) while (to != end) *(to++)+= *(from++); + /* it doesn't make sense to add last_query_cost values */ } diff --git a/sql/sql_class.h b/sql/sql_class.h index 4393da6df2a..f1f0cc2bde5 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -635,6 +635,8 @@ typedef struct system_status_var ulong filesort_range_count; ulong filesort_rows; ulong filesort_scan_count; + + double last_query_cost; } STATUS_VAR; /* diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 25bd99ee194..7ccb67be9d3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3739,8 +3739,7 @@ choose_plan(JOIN *join, table_map join_tables) Don't update last_query_cost for 'show status' command */ if (join->thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS) - last_query_cost= join->best_read; - + join->thd->status_var.last_query_cost= join->best_read; DBUG_VOID_RETURN; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 9e3f82f9fd6..a5d12dffc4b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1358,6 +1358,7 @@ static bool show_status_array(THD *thd, const char *wild, } case SHOW_DOUBLE: { + value= ((char *) status_var + (ulong) value); end= buff + sprintf(buff, "%f", *(double*) value); break; } From 60021dbe02f0ea191c54da007b99d8f56647fd2a Mon Sep 17 00:00:00 2001 From: "lars@mysql.com" <> Date: Thu, 19 May 2005 12:34:15 +0200 Subject: [PATCH 04/78] CSC#4944: Adding File_size to output of SHOW BINARY lOGS --- mysql-test/r/rpl_log.result | 12 +++++------ mysql-test/r/rpl_rotate_logs.result | 30 +++++++++++++------------- sql/sql_repl.cc | 33 ++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index 2f8a54369c9..7813d4d779d 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -67,14 +67,14 @@ master-bin.000002 110 Query 1 110 use `test`; create table t1 (n int) master-bin.000002 168 Query 1 168 use `test`; insert into t1 values (1) master-bin.000002 228 Query 1 228 use `test`; drop table t1 show binary logs; -Log_name -master-bin.000001 -master-bin.000002 +Log_name File_size +master-bin.000001 0 +master-bin.000002 276 start slave; show binary logs; -Log_name -slave-bin.000001 -slave-bin.000002 +Log_name File_size +slave-bin.000001 0 +slave-bin.000002 170 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id Orig_log_pos Info slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3 diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 62e5522fad9..66eef482a63 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -26,10 +26,10 @@ create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; show binary logs; -Log_name -master-bin.000001 -master-bin.000002 -master-bin.000003 +Log_name File_size +master-bin.000001 0 +master-bin.000002 0 +master-bin.000003 4 create table t3 select * from temp_table; select * from t3; a @@ -42,18 +42,18 @@ set global sql_slave_skip_counter=1; start slave; purge master logs to 'master-bin.000002'; show master logs; -Log_name -master-bin.000002 -master-bin.000003 +Log_name File_size +master-bin.000002 0 +master-bin.000003 229 purge binary logs to 'master-bin.000002'; show binary logs; -Log_name -master-bin.000002 -master-bin.000003 +Log_name File_size +master-bin.000002 0 +master-bin.000003 229 purge master logs before now(); show binary logs; -Log_name -master-bin.000003 +Log_name File_size +master-bin.000003 229 insert into t2 values (65); show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master @@ -73,9 +73,9 @@ count(*) 100 create table t4 select * from temp_table; show binary logs; -Log_name -master-bin.000003 -master-bin.000004 +Log_name File_size +master-bin.000003 0 +master-bin.000004 2886 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000004 2886 diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index d02bb5ff0a3..24b78bc9a3d 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1337,6 +1337,11 @@ int show_binlog_info(THD* thd) int show_binlogs(THD* thd) { IO_CACHE *index_file; + LOG_INFO cur; + IO_CACHE log; + File file; + const char *errmsg= 0; + MY_STAT stat_area; char fname[FN_REFLEN]; List field_list; uint length; @@ -1351,20 +1356,42 @@ int show_binlogs(THD* thd) } field_list.push_back(new Item_empty_string("Log_name", 255)); + field_list.push_back(new Item_return_int("File_size", 20, + MYSQL_TYPE_LONGLONG)); if (protocol->send_fields(&field_list, 1)) DBUG_RETURN(1); mysql_bin_log.lock_index(); index_file=mysql_bin_log.get_index_file(); - + + mysql_bin_log.get_current_log(&cur); + int cur_dir_len = dirname_length(cur.log_file_name); + reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0); /* The file ends with EOF or empty line */ while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1) { + fname[--length] = '\0'; /* remove the newline */ + protocol->prepare_for_resend(); int dir_len = dirname_length(fname); - /* The -1 is for removing newline from fname */ - protocol->store(fname + dir_len, length-1-dir_len, &my_charset_bin); + protocol->store(fname + dir_len, length-dir_len, &my_charset_bin); + if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len))) + { + /* this is the active log, use the active position */ + protocol->store((ulonglong) cur.pos); + } else { + /* this is an old log, open it and find the size */ + if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0) + { + protocol->store((ulonglong) my_b_filelength(&log)); + end_io_cache(&log); + my_close(file, MYF(0)); + } else { + /* the file wasn't openable, but 0 is an invalid value anyway */ + protocol->store((ulonglong) 0); + } + } if (protocol->write()) goto err; } From 0e8e44e70dd13ef8c0f011ed2a9002102547692a Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Thu, 19 May 2005 16:02:14 -0500 Subject: [PATCH 05/78] BUG# 10687 - MERGE engine fails under Windows This patch was submitted by Ingo and it appears to work correctly. --- sql/ha_myisammrg.cc | 5 +++-- strings/my_vsnprintf.c | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 7a5d4fcf0a1..1bf2f8a31ad 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,8 +406,8 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home, - tables->db, tables->real_name); + uint length= my_snprintf(buff, FN_REFLEN, "%s%c%s/%s", mysql_data_home, + FN_LIBCHAR, tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table, we use the table name without a path. This means that the @@ -422,6 +422,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, } else table_name=(*tbl)->path; + DBUG_PRINT("info",("MyISAM table_name: '%s'", table_name)); *pos++= table_name; } *pos=0; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 268f7d18f2a..d92b291321b 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -28,7 +28,8 @@ %#[l]u %#[l]x %#.#s Note first # is ignored - + %c + RETURN length of result string */ @@ -120,6 +121,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) to+= res_length; continue; } + else if (*fmt == 'c') + { + *(to++)= (char) va_arg(ap, int); + continue; + } /* We come here on '%%', unknown code or too long parameter */ if (to == end) break; From 94142fa0d04a19d3e62a89ad168f1d20b803738d Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 20 May 2005 15:17:13 +0200 Subject: [PATCH 06/78] my_vsnprintf.c, sql_select.cc, sql_delete.cc, field_conv.cc, rt_split.c: Fixes for valgrind errors and compatiblity issues by Monty --- myisam/rt_split.c | 17 ++++++++--------- sql/field_conv.cc | 6 +++++- sql/sql_delete.cc | 2 +- sql/sql_select.cc | 4 ++-- strings/my_vsnprintf.c | 10 ++++++++++ 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/myisam/rt_split.c b/myisam/rt_split.c index 005e86805bb..7dc8576cada 100644 --- a/myisam/rt_split.c +++ b/myisam/rt_split.c @@ -257,18 +257,17 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, int n_dim; uchar *source_cur, *cur1, *cur2; uchar *new_page; - int err_code = 0; - - uint nod_flag = mi_test_if_nod(page); - uint full_length = key_length + (nod_flag ? nod_flag : - info->s->base.rec_reflength); - - int max_keys = (mi_getint(page)-2) / (full_length); + int err_code= 0; + uint nod_flag= mi_test_if_nod(page); + uint full_length= key_length + (nod_flag ? nod_flag : + info->s->base.rec_reflength); + int max_keys= (mi_getint(page)-2) / (full_length); n_dim = keyinfo->keysegs / 2; - if (!(coord_buf= my_alloca(n_dim * 2 * sizeof(double) * (max_keys + 1 + 4) + - sizeof(SplitStruct) * (max_keys + 1)))) + if (!(coord_buf= (double*) my_alloca(n_dim * 2 * sizeof(double) * + (max_keys + 1 + 4) + + sizeof(SplitStruct) * (max_keys + 1)))) return -1; task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4)); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index ae784ae0293..15598e59bb9 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -605,7 +605,11 @@ void field_conv(Field *to,Field *from) to->type() != FIELD_TYPE_DATE && to->type() != FIELD_TYPE_DATETIME)) { // Identical fields - memcpy(to->ptr,from->ptr,to->pack_length()); +#ifdef HAVE_purify + /* This may happen if one does 'UPDATE ... SET x=x' */ + if (to->ptr != from->ptr) +#endif + memcpy(to->ptr,from->ptr,to->pack_length()); return; } } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index cded9e2a13e..ca7bf174abf 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -48,7 +48,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, { my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), table_list->view_db.str, table_list->view_name.str); - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); thd->proc_info="init"; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 99373276410..71414f8cc76 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12655,8 +12655,10 @@ static bool setup_sum_funcs(THD *thd, Item_sum **func_ptr) Item_sum *func; DBUG_ENTER("setup_sum_funcs"); while ((func= *(func_ptr++))) + { if (func->setup(thd)) DBUG_RETURN(TRUE); + } DBUG_RETURN(FALSE); } @@ -12943,8 +12945,6 @@ bool JOIN::rollup_make_fields(List &fields_arg, List &sel_fields, */ item= item->copy_or_same(thd); ((Item_sum*) item)->make_unique(); - if (((Item_sum*) item)->setup(thd)) - return 1; *(*func)= (Item_sum*) item; (*func)++; } diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 4d7c17e977c..935cc2d380d 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -135,6 +135,16 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) to+= res_length; continue; } + else if (*fmt == 'c') /* Character parameter */ + { + register int larg; + if (to == end) + break; + larg = va_arg(ap, int); + *to++= (char) larg; + continue; + } + /* We come here on '%%', unknown code or too long parameter */ if (to == end) break; From 6182241268c5c53b1bcef47dc4cfd168a45f7b1e Mon Sep 17 00:00:00 2001 From: "brian@zim.(none)" <> Date: Fri, 20 May 2005 06:56:02 -0700 Subject: [PATCH 07/78] Additions for --add-drop-database --- client/client_priv.h | 2 +- client/mysqldump.c | 19 ++++++++++++++---- mysql-test/r/mysqldump.result | 38 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 9 +++++++++ 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 45806349d7d..5085c03e84f 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING #endif - ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE + ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_DROP_DATABASE }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 493ef57a73b..7b18b1d92da 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -85,7 +85,7 @@ static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0, - opt_complete_insert= 0; + opt_complete_insert= 0, opt_drop_database= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static my_bool insert_pat_inited=0; @@ -159,6 +159,9 @@ static struct my_option my_long_options[] = "Dump all the databases. This will be same as --databases with all databases selected.", (gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"add-drop-database", OPT_DROP_DATABASE, "Add a 'DROP DATABASE' before each create.", + (gptr*) &opt_drop_database, (gptr*) &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, {"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.", (gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -1119,9 +1122,9 @@ static uint getTableStructure(char *table, char* db) else dynstr_set(&insert_pat, ""); - insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " : - opt_delayed ? " DELAYED " : - opt_ignore ? " IGNORE " : ""; + insert_option= ((opt_delayed && opt_ignore) ? " DELAYED IGNORE " : + opt_delayed ? " DELAYED " : + opt_ignore ? " IGNORE " : ""); if (verbose) fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); @@ -2043,12 +2046,20 @@ static int init_dumping(char *database) if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) { /* Old server version, dump generic CREATE DATABASE */ + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s;*/\n", + qdatabase); fprintf(md_result_file, "\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", qdatabase); } else { + if (opt_drop_database) + fprintf(md_result_file, + "\n/*!40000 DROP DATABASE IF EXISTS %s*/;\n", + qdatabase); row = mysql_fetch_row(dbinfo); if (row[1]) { diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 493c6d6404a..845b0d1da45 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1311,3 +1311,41 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +/*!40000 DROP DATABASE IF EXISTS `test`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT INTO `t1` VALUES (1),(2),(3); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 2681e690ff5..9f3b412b814 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -534,3 +534,12 @@ create table t1 ( insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); --exec $MYSQL_DUMP --skip-comments -c test drop table t1; + +# +# Test for --add-drop-database +# + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); +--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test +DROP TABLE t1; From d8859b2ee287cf080441efed74d93d60e4c9088f Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 20 May 2005 18:35:49 +0400 Subject: [PATCH 08/78] Fixes for numerous compatibility problems in yaSSL. --- extra/yassl/include/openssl/ssl.h | 10 +++++----- extra/yassl/include/yassl_error.hpp | 2 +- extra/yassl/include/yassl_types.hpp | 4 ++-- extra/yassl/mySTL/helpers.hpp | 16 ++++++++++++++-- extra/yassl/src/dummy.cpp | 4 ++++ extra/yassl/taocrypt/include/asn.hpp | 4 ++-- vio/Makefile.am | 8 +++++--- 7 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 extra/yassl/src/dummy.cpp diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 361918846fc..85f0771ca85 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -149,7 +149,7 @@ enum { /* X509 Constants */ X509_V_ERR_CRL_SIGNATURE_FAILURE = 10, X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 11, X509_V_ERR_CRL_HAS_EXPIRED = 12, - X509_V_ERR_CERT_REVOKED = 13, + X509_V_ERR_CERT_REVOKED = 13 }; @@ -166,7 +166,7 @@ int ERR_GET_REASON(int); enum { /* ERR Constants */ ERR_TXT_STRING = 1, - EVP_R_BAD_DECRYPT = 2, + EVP_R_BAD_DECRYPT = 2 }; @@ -263,8 +263,8 @@ enum { /* ssl Constants */ SSL_UNKNOWN = -2, SSL_FATAL_ERROR = -1, SSL_NORMAL_SHUTDOWN = 0, - SSL_ERROR_NONE = 0, // for most functions - SSL_FAILURE = 0, // for some functions + SSL_ERROR_NONE = 0, /* for most functions */ + SSL_FAILURE = 0, /* for some functions */ SSL_SUCCESS = 1, SSL_FILETYPE_ASN1 = 10, @@ -320,7 +320,7 @@ enum { /* ssl Constants */ SSL_ST_ACCEPT = 94, SSL_CB_ALERT = 95, SSL_CB_READ = 96, - SSL_CB_HANDSHAKE_DONE = 97, + SSL_CB_HANDSHAKE_DONE = 97 }; diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp index 4165eb24b66..0b06a37a635 100644 --- a/extra/yassl/include/yassl_error.hpp +++ b/extra/yassl/include/yassl_error.hpp @@ -51,7 +51,7 @@ enum YasslError { verify_error = 112, send_error = 113, receive_error = 114, - certificate_error = 115, + certificate_error = 115 // 1000+ from TaoCrypt error.hpp diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp index 70888f35c81..6359ad54aab 100644 --- a/extra/yassl/include/yassl_types.hpp +++ b/extra/yassl/include/yassl_types.hpp @@ -129,7 +129,7 @@ enum PublicValueEncoding { implicit_encoding, explicit_encoding }; enum ConnectionEnd { server_end, client_end }; -enum AlertLevel { warning = 1, fatal = 2, }; +enum AlertLevel { warning = 1, fatal = 2 }; @@ -381,7 +381,7 @@ const char* const cipher_names[128] = "DES-CBC3-RMD", // TLS_RSA_WITH_3DES_EDE_CBC_RMD160 = 124 "AES128-RMD", // TLS_RSA_WITH_AES_128_CBC_RMD160 = 125 "AES256-RMD", // TLS_RSA_WITH_AES_256_CBC_RMD160 = 126 - null_str, // 127 + null_str // 127 }; // fill with MD5 pad size since biggest required diff --git a/extra/yassl/mySTL/helpers.hpp b/extra/yassl/mySTL/helpers.hpp index 1b62d60cd2e..fdb856d4db1 100644 --- a/extra/yassl/mySTL/helpers.hpp +++ b/extra/yassl/mySTL/helpers.hpp @@ -27,16 +27,28 @@ #ifndef mySTL_HELPERS_HPP #define mySTL_HELPERS_HPP -#include +#include +#ifdef __IBMCPP__ +/* + Workaround the lack of operator new(size_t, void*) + in IBM VA CPP 6.0 +*/ +struct Dummy {}; +inline void *operator new(size_t size, Dummy *d) { return (void*) d; } +typedef Dummy *yassl_pointer; +#else +typedef void *yassl_pointer; +#endif + namespace mySTL { template inline void construct(T* p, const T2& value) { - new (static_cast(p)) T(value); + new ((yassl_pointer) p) T(value); } diff --git a/extra/yassl/src/dummy.cpp b/extra/yassl/src/dummy.cpp new file mode 100644 index 00000000000..19b7fe887cd --- /dev/null +++ b/extra/yassl/src/dummy.cpp @@ -0,0 +1,4 @@ +/* + To make libtool always use a C++ linker when compiling with yaSSL we need + to add a dummy C++ file to the source list. +*/ diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp index 71633339a40..974bbf4c86f 100644 --- a/extra/yassl/taocrypt/include/asn.hpp +++ b/extra/yassl/taocrypt/include/asn.hpp @@ -79,7 +79,7 @@ enum ASNIdFlag enum DNTags { - COMMON_NAME = 0x03, + COMMON_NAME = 0x03 }; @@ -92,7 +92,7 @@ enum Constants MAX_SEQ_SZ = 5, // enum(seq|con) + length(4) MAX_ALGO_SIZE = 9, MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4) - DSA_SIG_SZ = 40, + DSA_SIG_SZ = 40 }; diff --git a/vio/Makefile.am b/vio/Makefile.am index 9c961025080..22e706efe4c 100644 --- a/vio/Makefile.am +++ b/vio/Makefile.am @@ -19,15 +19,17 @@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) pkglib_LIBRARIES= libvio.a noinst_PROGRAMS = test-ssl test-sslserver test-sslclient noinst_HEADERS= vio_priv.h -test_ssl_SOURCES= test-ssl.c +test_ssl_SOURCES= test-ssl.c $(top_srcdir)/extra/yassl/src/dummy.cpp test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ ../mysys/libmysys.a ../strings/libmystrings.a \ $(openssl_libs) -test_sslserver_SOURCES= test-sslserver.c +test_sslserver_SOURCES= test-sslserver.c \ + $(top_srcdir)/extra/yassl/src/dummy.cpp test_sslserver_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ ../mysys/libmysys.a ../strings/libmystrings.a \ $(openssl_libs) -test_sslclient_SOURCES= test-sslclient.c +test_sslclient_SOURCES= test-sslclient.c \ + $(top_srcdir)/extra/yassl/src/dummy.cpp test_sslclient_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ ../mysys/libmysys.a ../strings/libmystrings.a \ $(openssl_libs) From b6c93da24c25ff57abd4d818c523a7b5a15147d9 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Fri, 20 May 2005 22:52:41 +0400 Subject: [PATCH 09/78] yaSSL fixes for Sun Forte 7 --- extra/yassl/include/yassl_types.hpp | 2 +- extra/yassl/mySTL/helpers.hpp | 4 ++-- extra/yassl/mySTL/list.hpp | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp index 6359ad54aab..1ad4998bade 100644 --- a/extra/yassl/include/yassl_types.hpp +++ b/extra/yassl/include/yassl_types.hpp @@ -27,7 +27,7 @@ #ifndef yaSSL_TYPES_HPP #define yaSSL_TYPES_HPP -#include +#include namespace yaSSL { diff --git a/extra/yassl/mySTL/helpers.hpp b/extra/yassl/mySTL/helpers.hpp index fdb856d4db1..779389e322a 100644 --- a/extra/yassl/mySTL/helpers.hpp +++ b/extra/yassl/mySTL/helpers.hpp @@ -32,8 +32,8 @@ #ifdef __IBMCPP__ /* - Workaround the lack of operator new(size_t, void*) - in IBM VA CPP 6.0 + Workaround for the lack of operator new(size_t, void*) + in IBM VA C++ 6.0 */ struct Dummy {}; inline void *operator new(size_t size, Dummy *d) { return (void*) d; } diff --git a/extra/yassl/mySTL/list.hpp b/extra/yassl/mySTL/list.hpp index 5bbec6ab7c6..be149b1a984 100644 --- a/extra/yassl/mySTL/list.hpp +++ b/extra/yassl/mySTL/list.hpp @@ -38,6 +38,13 @@ namespace mySTL { template class list { +#ifdef __SUNPRO_CC +/* + Sun Forte 7 C++ v. 5.4 needs class 'node' be public to be visible to + the nested class 'iterator' (a non-standard behaviour). +*/ +public: +#endif struct node { node(T t) : prev_(0), next_(0), value_(t) {} From 78b40d0a0ff0771842af25e08d3672c8b5836588 Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Sat, 21 May 2005 12:31:58 -0500 Subject: [PATCH 10/78] BUG# 9148: Denial of service This is a second patch needing another review. The first patch didn't solve the entire problem. open and fopen on Windows will still open files like "com1.sym" when they shouldn't. This patch checks that the file exists before trying to open it. --- mysys/my_fopen.c | 18 +++++++++++++++--- mysys/my_open.c | 6 ++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index e918b7b0de2..208e7e80fd8 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -33,9 +33,21 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) DBUG_ENTER("my_fopen"); DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); - - make_ftype(type,Flags); - if ((fd = fopen(FileName, type)) != 0) + /* + * if we are not creating, then we need to use my_access to make sure + * the file exists since Windows doesn't handle files like "com1.sym" very well + */ +#ifdef __WIN__ + if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) + fd=0; + else +#endif + { + make_ftype(type,Flags); + fd = fopen(FileName, type); + } + + if (fd != 0) { /* The test works if MY_NFILE < 128. The problem is that fileno() is char diff --git a/mysys/my_open.c b/mysys/my_open.c index ca5c0d8683f..1f3bb95b5a2 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -46,6 +46,12 @@ File my_open(const char *FileName, int Flags, myf MyFlags) DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) + /* if we are not creating, then we need to use my_access to make + * sure the file exists since Windows doesn't handle files like + * "com1.sym" very well + */ + if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) + return -1; if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); From 363fd14115622b3f97e2cbc26d5c13a6d176ce51 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sat, 21 May 2005 23:23:39 +0200 Subject: [PATCH 11/78] default_modify.c: Use MY_STAT to declare argument to my_fstat() des_key_file.cc: Use local seach path for "mysql_priv.h" mysys.dsp, libmysqld.dsp, libmysql.dsp: New file needed, "../mysys/default_modify.c" --- VC++Files/libmysql/libmysql.dsp | 4 ++++ VC++Files/libmysqld/libmysqld.dsp | 4 ++++ VC++Files/mysys/mysys.dsp | 4 ++++ mysys/default_modify.c | 2 +- sql/des_key_file.cc | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index b94aaf07bed..1db5ed538a4 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -219,6 +219,10 @@ SOURCE=..\mysys\default.c # End Source File # Begin Source File +SOURCE=..\mysys\default_modify.c +# End Source File +# Begin Source File + SOURCE=.\dll.c # End Source File # Begin Source File diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp index c5c40b07dfd..a82538c91dd 100644 --- a/VC++Files/libmysqld/libmysqld.dsp +++ b/VC++Files/libmysqld/libmysqld.dsp @@ -180,6 +180,10 @@ SOURCE=..\mysys\default.c # End Source File # Begin Source File +SOURCE=..\mysys\default_modify.c +# End Source File +# Begin Source File + SOURCE=..\sql\derror.cpp # End Source File # Begin Source File diff --git a/VC++Files/mysys/mysys.dsp b/VC++Files/mysys/mysys.dsp index 64c4378b678..2da8fee4aa3 100644 --- a/VC++Files/mysys/mysys.dsp +++ b/VC++Files/mysys/mysys.dsp @@ -204,6 +204,10 @@ SOURCE=.\default.c # End Source File # Begin Source File +SOURCE=.\default_modify.c +# End Source File +# Begin Source File + SOURCE=.\errors.c # End Source File # Begin Source File diff --git a/mysys/default_modify.c b/mysys/default_modify.c index 3476b8628cf..add4317bb56 100644 --- a/mysys/default_modify.c +++ b/mysys/default_modify.c @@ -42,7 +42,7 @@ int modify_defaults_file(const char *file_location, const char *option, const char *section_name, int remove_option) { FILE *cnf_file; - struct stat file_stat; + MY_STAT file_stat; char linebuff[BUFF_SIZE], tmp[BUFF_SIZE], *tmp_ptr, *src_ptr, *dst_ptr, *file_buffer; uint optlen, optval_len, sect_len; diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index c6b4c5f2c34..a5a3e78d70f 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -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 "mysql_priv.h" #include #ifdef HAVE_OPENSSL From 99f9ff6755ff4c426bf70cd604b0b49ce6ea2e45 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Sun, 22 May 2005 04:19:54 +0200 Subject: [PATCH 12/78] misc.hpp: Check _LONGLONG_TYPE as well, to define 'word64', to make it work on Solaris 10 x86_64. Can't assume all x86_64 share the same assembler syntax. For now disabled assembler for x86_64 and Solaris. --- extra/yassl/taocrypt/include/misc.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index b9cc9a6fe71..b5b0a4575fc 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -59,7 +59,7 @@ typedef unsigned char byte; typedef unsigned short word16; typedef unsigned int word32; -#if defined(__GNUC__) || defined(__MWERKS__) +#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE) #define WORD64_AVAILABLE typedef unsigned long long word64; #define W64LIT(x) x##LL @@ -79,8 +79,10 @@ typedef unsigned int word32; typedef word32 lword; #endif +// FIXME the !defined(__sun) is a temporarely solution until asm for +// __x86_64__ and Solaris is written #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \ - defined(__x86_64__) || defined(__mips64) + defined(__mips64) || (defined(__x86_64__) && !defined(__sun)) // These platforms have 64-bit CPU registers. Unfortunately most C++ compilers // don't allow any way to access the 64-bit by 64-bit multiply instruction // without using assembly, so in order to use word64 as word, the assembly From cfb1b9000534c3a80fb45ddb9f97778abd67a481 Mon Sep 17 00:00:00 2001 From: "pekka@mysql.com" <> Date: Sun, 22 May 2005 20:47:08 +0200 Subject: [PATCH 13/78] ndb - NdbDictionaryImpl.cpp: fix access to freed memory --- ndb/src/ndbapi/NdbDictionaryImpl.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index fe2df815f1f..baf5c7e5c83 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -2049,12 +2049,22 @@ NdbDictionaryImpl::getIndexImpl(const char * externalName, return 0; } + /* + * internalName may be pointer to m_ndb.theImpl->m_internalname.c_str() + * and may get deallocated in next call. + * + * Passing around pointers to volatile internal members may not be + * optimal. Suggest use BaseString instances passed by value. + */ + + BaseString save_me(internalName); NdbTableImpl* prim = getTable(tab->m_primaryTable.c_str()); if(prim == 0){ m_error.code = 4243; return 0; } - + internalName = save_me.c_str(); + /** * Create index impl */ From 3973e55f498299c3c88c2f20df369f8646a63c9c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 23 May 2005 15:02:02 +0200 Subject: [PATCH 14/78] Build fix --- ndb/src/cw/cpcd/Process.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index cfffec7d0ce..431c96e3320 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -223,11 +223,8 @@ set_ulimit(const BaseString & pair){ if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } -#if defined(__INTEL_COMPILER) - struct rlimit64 rlp; -#else + struct rlimit rlp; -#endif #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} if(list[0].trim() == "c"){ From 9d0e3521f0ea05862c80498621a374ff7a74c2cb Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 23 May 2005 15:13:21 +0200 Subject: [PATCH 15/78] Build fix --- include/my_global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/my_global.h b/include/my_global.h index 5448aa3e871..f82c758d17a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -44,7 +44,7 @@ #endif /* __CYGWIN__ */ /* Determine when to use "#pragma interface" */ -#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3) +#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3) #define USE_PRAGMA_INTERFACE #endif From 83994a4d4c0d7fadf33648a05722ed57e0c3a75f Mon Sep 17 00:00:00 2001 From: "gbichot@quadita2.mysql.com" <> Date: Mon, 23 May 2005 16:50:20 +0200 Subject: [PATCH 16/78] Removing mysqlshutdown and mysqlwatch from the Windows packages, removing their sources. They were both undocumented and not much useful. Removal has been agreed with Mark, Miguel and MikeZ. Removing winmysqladmin from the source (it was not included anymore in no Windows package). I'll do a test Windows noinstall.zip build before push. MikeZ just removed mysqlshutdown and mysqlwatch from the installer scripts. --- VC++Files/mysql.dsw | 24 - VC++Files/mysql_ia64.dsw | 24 - VC++Files/mysqlshutdown/myshutdown.dsp | 101 - VC++Files/mysqlshutdown/myshutdown_ia64.dsp | 101 - VC++Files/mysqlshutdown/mysql.ico | Bin 318 -> 0 bytes VC++Files/mysqlshutdown/mysqlshutdown.c | 198 -- VC++Files/mysqlshutdown/mysqlshutdown.dsp | 119 - VC++Files/mysqlshutdown/mysqlshutdown.rc | 2 - .../mysqlshutdown/mysqlshutdown_ia64.dsp | 119 - VC++Files/mysqlwatch/mysqlwatch.c | 745 ----- VC++Files/mysqlwatch/mysqlwatch.dsp | 70 - VC++Files/mysqlwatch/mysqlwatch_ia64.dsp | 71 - VC++Files/winmysqladmin/db.cpp | 80 - VC++Files/winmysqladmin/db.h | 32 - VC++Files/winmysqladmin/images/Goahead.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/HELP.ICO | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/INFO.ICO | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/Info.bmp | Bin 644 -> 0 bytes VC++Files/winmysqladmin/images/MYINI.ICO | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/Myini.bmp | Bin 644 -> 0 bytes VC++Files/winmysqladmin/images/Noentry.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/SETUP.BMP | Bin 86878 -> 0 bytes VC++Files/winmysqladmin/images/Setup 16.bmp | Bin 86880 -> 0 bytes VC++Files/winmysqladmin/images/Table.ico | Bin 1078 -> 0 bytes VC++Files/winmysqladmin/images/Working.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/database.ico | Bin 1078 -> 0 bytes VC++Files/winmysqladmin/images/find.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/green.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/help.bmp | Bin 644 -> 0 bytes VC++Files/winmysqladmin/images/initsetup.cpp | 42 - VC++Files/winmysqladmin/images/killdb.ico | Bin 1078 -> 0 bytes VC++Files/winmysqladmin/images/logo.ico | Bin 2022 -> 0 bytes VC++Files/winmysqladmin/images/multitrg.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/mysql-07.bmp | Bin 9618 -> 0 bytes VC++Files/winmysqladmin/images/mysql-17.bmp | Bin 3806 -> 0 bytes VC++Files/winmysqladmin/images/mysql.BMP | Bin 8760 -> 0 bytes VC++Files/winmysqladmin/images/red.ico | Bin 766 -> 0 bytes VC++Files/winmysqladmin/images/red22.BMP | Bin 2104 -> 0 bytes VC++Files/winmysqladmin/images/see.bmp | Bin 644 -> 0 bytes VC++Files/winmysqladmin/initsetup.cpp | 40 - VC++Files/winmysqladmin/initsetup.h | 38 - VC++Files/winmysqladmin/main.cpp | 2531 ----------------- VC++Files/winmysqladmin/main.h | 314 -- VC++Files/winmysqladmin/mysql.h | 295 -- VC++Files/winmysqladmin/mysql_com.h | 275 -- VC++Files/winmysqladmin/mysql_version.h | 20 - VC++Files/winmysqladmin/winmysqladmin.cpp | 36 - 47 files changed, 5277 deletions(-) delete mode 100644 VC++Files/mysqlshutdown/myshutdown.dsp delete mode 100644 VC++Files/mysqlshutdown/myshutdown_ia64.dsp delete mode 100644 VC++Files/mysqlshutdown/mysql.ico delete mode 100644 VC++Files/mysqlshutdown/mysqlshutdown.c delete mode 100644 VC++Files/mysqlshutdown/mysqlshutdown.dsp delete mode 100644 VC++Files/mysqlshutdown/mysqlshutdown.rc delete mode 100644 VC++Files/mysqlshutdown/mysqlshutdown_ia64.dsp delete mode 100644 VC++Files/mysqlwatch/mysqlwatch.c delete mode 100644 VC++Files/mysqlwatch/mysqlwatch.dsp delete mode 100644 VC++Files/mysqlwatch/mysqlwatch_ia64.dsp delete mode 100644 VC++Files/winmysqladmin/db.cpp delete mode 100644 VC++Files/winmysqladmin/db.h delete mode 100644 VC++Files/winmysqladmin/images/Goahead.ico delete mode 100644 VC++Files/winmysqladmin/images/HELP.ICO delete mode 100644 VC++Files/winmysqladmin/images/INFO.ICO delete mode 100644 VC++Files/winmysqladmin/images/Info.bmp delete mode 100644 VC++Files/winmysqladmin/images/MYINI.ICO delete mode 100644 VC++Files/winmysqladmin/images/Myini.bmp delete mode 100644 VC++Files/winmysqladmin/images/Noentry.ico delete mode 100644 VC++Files/winmysqladmin/images/SETUP.BMP delete mode 100644 VC++Files/winmysqladmin/images/Setup 16.bmp delete mode 100644 VC++Files/winmysqladmin/images/Table.ico delete mode 100644 VC++Files/winmysqladmin/images/Working.ico delete mode 100644 VC++Files/winmysqladmin/images/database.ico delete mode 100644 VC++Files/winmysqladmin/images/find.ico delete mode 100644 VC++Files/winmysqladmin/images/green.ico delete mode 100644 VC++Files/winmysqladmin/images/help.bmp delete mode 100644 VC++Files/winmysqladmin/images/initsetup.cpp delete mode 100644 VC++Files/winmysqladmin/images/killdb.ico delete mode 100644 VC++Files/winmysqladmin/images/logo.ico delete mode 100644 VC++Files/winmysqladmin/images/multitrg.ico delete mode 100644 VC++Files/winmysqladmin/images/mysql-07.bmp delete mode 100644 VC++Files/winmysqladmin/images/mysql-17.bmp delete mode 100644 VC++Files/winmysqladmin/images/mysql.BMP delete mode 100644 VC++Files/winmysqladmin/images/red.ico delete mode 100644 VC++Files/winmysqladmin/images/red22.BMP delete mode 100644 VC++Files/winmysqladmin/images/see.bmp delete mode 100644 VC++Files/winmysqladmin/initsetup.cpp delete mode 100644 VC++Files/winmysqladmin/initsetup.h delete mode 100644 VC++Files/winmysqladmin/main.cpp delete mode 100644 VC++Files/winmysqladmin/main.h delete mode 100644 VC++Files/winmysqladmin/mysql.h delete mode 100644 VC++Files/winmysqladmin/mysql_com.h delete mode 100644 VC++Files/winmysqladmin/mysql_version.h delete mode 100644 VC++Files/winmysqladmin/winmysqladmin.cpp diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw index 73db9d095cb..25bcab8338b 100644 --- a/VC++Files/mysql.dsw +++ b/VC++Files/mysql.dsw @@ -537,30 +537,6 @@ Package=<4> ############################################################################### -Project: "mysqlshutdown"=".\mysqlshutdown\mysqlshutdown.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "mysqlwatch"=".\mysqlwatch\mysqlwatch.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "mysys"=".\mysys\mysys.dsp" - Package Owner=<4> Package=<5> diff --git a/VC++Files/mysql_ia64.dsw b/VC++Files/mysql_ia64.dsw index dd86d498afe..3b588deee61 100644 --- a/VC++Files/mysql_ia64.dsw +++ b/VC++Files/mysql_ia64.dsw @@ -640,30 +640,6 @@ Package=<4> ############################################################################### -Project: "mysqlshutdown"=".\mysqlshutdown\mysqlshutdown_ia64.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "mysqlwatch"=".\mysqlwatch\mysqlwatch_ia64.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "pack_isam"=".\pack_isam\pack_isam_ia64.dsp" - Package Owner=<4> Package=<5> diff --git a/VC++Files/mysqlshutdown/myshutdown.dsp b/VC++Files/mysqlshutdown/myshutdown.dsp deleted file mode 100644 index 0119df3cd59..00000000000 --- a/VC++Files/mysqlshutdown/myshutdown.dsp +++ /dev/null @@ -1,101 +0,0 @@ -# Microsoft Developer Studio Project File - Name="myshutdown" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=myshutdown - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "myshutdown.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "myshutdown.mak" CFG="myshutdown - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "myshutdown - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "myshutdown - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "myshutdown - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "myshutdown - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "myshutdown - Win32 Release" -# Name "myshutdown - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/VC++Files/mysqlshutdown/myshutdown_ia64.dsp b/VC++Files/mysqlshutdown/myshutdown_ia64.dsp deleted file mode 100644 index 1cee7987d5e..00000000000 --- a/VC++Files/mysqlshutdown/myshutdown_ia64.dsp +++ /dev/null @@ -1,101 +0,0 @@ -# Microsoft Developer Studio Project File - Name="myshutdown" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=myshutdown - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "myshutdown.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "myshutdown.mak" CFG="myshutdown - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "myshutdown - WinIA64 Release" (based on "Win32 (x86) Application") -!MESSAGE "myshutdown - WinIA64 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "myshutdown - WinIA64 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /D"WIN64" /D"NDEBUG" /D"_WINDOWS" /D"_MBCS" /YX /FD /c /O2 /G2 /EHsc /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600 -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:IA64 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:IA64 /incremental:no - -!ELSEIF "$(CFG)" == "myshutdown - WinIA64 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN64" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /D"WIN64" /D"_DEBUG" /D"_WINDOWS" /D"_MBCS" /YX /FD /GZ /c /Od /G2 /EHsc /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600 -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win64 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win64 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:IA64 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:IA64 /incremental:no - -!ENDIF - -# Begin Target - -# Name "myshutdown - WinIA64 Release" -# Name "myshutdown - WinIA64 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/VC++Files/mysqlshutdown/mysql.ico b/VC++Files/mysqlshutdown/mysql.ico deleted file mode 100644 index 1fe0b7115bbe95b1108cd2ef025f539cad262181..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmZvUD-Hrd5JcZ5m~pGnNG`<*&;-dE{Mfn8Bxu&55QK0D6ltnvMWz)B3Y@jseC!89!*R!Xf^>Or(1!kHj<%hW7GDWsB>AX214Q+0Zs``j1a z(@j@PPTpHIC8_LJ_1=$lliIOY^&;L8mot10@Dd)vQ+0fVtLJb(3VXP9%sZG*+7-U9 Cr%L_+ diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.c b/VC++Files/mysqlshutdown/mysqlshutdown.c deleted file mode 100644 index ccaf4a00eda..00000000000 --- a/VC++Files/mysqlshutdown/mysqlshutdown.c +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** - MySqlShutdown - shutdown MySQL on system shutdown (Win95/98) - ---------------------------------------------------------------------------- - Revision History : - Version Author Date Description - 001.00 Irena 21-12-99 -*****************************************************************************/ -#include - -//----------------------------------------------------------------------- -// Local data -//----------------------------------------------------------------------- -static char szAppName[] = "MySqlShutdown"; -static HINSTANCE hInstance; - -#define MYWM_NOTIFYICON (WM_APP+100) - -//----------------------------------------------------------------------- -// Exported functions -//----------------------------------------------------------------------- -LRESULT CALLBACK MainWindowProc (HWND, UINT, WPARAM, LPARAM); - -//----------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------- -static BOOL InitAppClass (HINSTANCE hInstance); - -BOOL TrayMessageAdd(HWND hWnd, DWORD dwMessage) -{ - BOOL res; - HICON hIcon =LoadIcon (hInstance, "MySql"); - char *szTip="MySql Shutdown"; - NOTIFYICONDATA tnd; - - tnd.cbSize = sizeof(NOTIFYICONDATA); - tnd.hWnd = hWnd; - tnd.uID = 101; - - tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFYICON; - tnd.hIcon = hIcon; - strcpy(tnd.szTip, szTip); - res = Shell_NotifyIcon(dwMessage, &tnd); - - if (hIcon) DestroyIcon(hIcon); - - return res; -} - -//----------------------------------------------------------------------- -// Name: WinMain -// Purpose: Main application entry point -//----------------------------------------------------------------------- - -int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) -{ HWND hWnd; - MSG Msg; - - hInstance=hInst; - // Register application class if needed - if (InitAppClass (hInstance) == FALSE) return (0); - - - hWnd = CreateWindow (szAppName, "MySql", - WS_OVERLAPPEDWINDOW|WS_MINIMIZE, - 0, 0, - GetSystemMetrics(SM_CXSCREEN)/4, - GetSystemMetrics(SM_CYSCREEN)/4, - 0, 0, hInstance, NULL); - - if(!hWnd) - { - return (0); - } - ShowWindow (hWnd, SW_HIDE); - UpdateWindow (hWnd); - while (GetMessage (&Msg, 0, 0, 0)) - { TranslateMessage (&Msg); - DispatchMessage (&Msg); - } - return ((int) (Msg.wParam)); -} - -//----------------------------------------------------------------------- -// Name: InitAppClass -// Purpose: Register the main application window class -//----------------------------------------------------------------------- -static BOOL InitAppClass (HINSTANCE hInstance) -{ - WNDCLASS cls; - - if (GetClassInfo (hInstance, szAppName, &cls) == 0) - { - cls.style = CS_HREDRAW | CS_VREDRAW ;; - cls.lpfnWndProc = (WNDPROC) MainWindowProc; - cls.cbClsExtra = 0; - cls.cbWndExtra = sizeof(HWND); - cls.hInstance = hInstance; - cls.hIcon = LoadIcon (hInstance, "MySql"); - cls.hCursor = LoadCursor (NULL, IDC_ARROW); - cls.hbrBackground = GetStockObject (WHITE_BRUSH) ; - cls.lpszMenuName = 0; //szAppName; - cls.lpszClassName = szAppName; - return RegisterClass (&cls); - } - return (TRUE); -} -//----------------------------------------------------------------------- -// Name: MainWindowProc -// Purpose: Window procedure for main application window. -//----------------------------------------------------------------------- -LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT Msg,WPARAM wParam, LPARAM lParam) -{ - static RECT rect ; - HDC hdc ; - PAINTSTRUCT ps ; - static BOOL bShutdown=FALSE; - - switch (Msg) - { - case WM_CREATE: - TrayMessageAdd(hWnd, NIM_ADD); - return TRUE; -/*************** - case WM_SYSCOMMAND: - if(wParam==SC_CLOSE) - { HANDLE hEventShutdown; - - bShutdown=TRUE; - InvalidateRect(hWnd,NULL,TRUE); - ShowWindow (hWnd, SW_NORMAL); - UpdateWindow(hWnd); - hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); - if(hEventShutdown) - { - SetEvent(hEventShutdown); - CloseHandle(hEventShutdown); - Sleep(1000); - MessageBox(hWnd,"Shutdown", "MySql", MB_OK); - } - TrayMessageAdd(hWnd, NIM_DELETE); - } - break; -**************/ - case WM_DESTROY: - TrayMessageAdd(hWnd, NIM_DELETE); - PostQuitMessage (0); - return 0; - case WM_SIZE: - GetClientRect (hWnd, &rect) ; - return 0 ; - - case WM_PAINT: - hdc = BeginPaint (hWnd, &ps) ; - if(bShutdown) - DrawText (hdc, "MySql shutdown in progress...", - -1, &rect, DT_WORDBREAK) ; - EndPaint (hWnd, &ps) ; - return 0 ; - case WM_QUERYENDSESSION: //Shutdown MySql - { HANDLE hEventShutdown; - - bShutdown=TRUE; - InvalidateRect(hWnd,NULL,TRUE); - ShowWindow (hWnd, SW_NORMAL); - UpdateWindow(hWnd); - hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); - if(hEventShutdown) - { - SetEvent(hEventShutdown); - CloseHandle(hEventShutdown); - Sleep(1000); - MessageBox(hWnd,"Shutdown", "MySql", MB_OK); - } - } - return 1; - - case MYWM_NOTIFYICON: - switch (lParam) - { - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - ShowWindow(hWnd, SW_SHOWNORMAL); - SetForegroundWindow(hWnd); // make us come to the front - break; - default: - break; - } - break; - - } - return DefWindowProc (hWnd, Msg, wParam, lParam); -} - - -// ----------------------- The end ------------------------------------------ - - diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.dsp b/VC++Files/mysqlshutdown/mysqlshutdown.dsp deleted file mode 100644 index b7802240d42..00000000000 --- a/VC++Files/mysqlshutdown/mysqlshutdown.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysqlshutdown" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=mysqlshutdown - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysqlshutdown.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysqlshutdown.mak" CFG="mysqlshutdown - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysqlshutdown - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "mysqlshutdown - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mysqlshutdown - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /W3 /O2 /D "_WINDOWS" /D "_MBCS" /D "NDEBUG" /FD /c -# SUBTRACT CPP /WX /Fr /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_release/mysqlshutdown.exe" - -!ELSEIF "$(CFG)" == "mysqlshutdown - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mysqlshutdown___Win32_Debug" -# PROP BASE Intermediate_Dir "mysqlshutdown___Win32_Debug" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /G6 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /W3 /Z7 /Od /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# SUBTRACT CPP /Fr /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_release/mysqlshutdown.exe" -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"../client_debug/mysqlshutdown.exe" - -!ENDIF - -# Begin Target - -# Name "mysqlshutdown - Win32 Release" -# Name "mysqlshutdown - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mysqlshutdown.c -# End Source File -# Begin Source File - -SOURCE=.\mysqlshutdown.rc -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\mysql.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.rc b/VC++Files/mysqlshutdown/mysqlshutdown.rc deleted file mode 100644 index 6837f863a81..00000000000 --- a/VC++Files/mysqlshutdown/mysqlshutdown.rc +++ /dev/null @@ -1,2 +0,0 @@ -MySql ICON DISCARDABLE "MYSQL.ICO" - diff --git a/VC++Files/mysqlshutdown/mysqlshutdown_ia64.dsp b/VC++Files/mysqlshutdown/mysqlshutdown_ia64.dsp deleted file mode 100644 index 2549606bf60..00000000000 --- a/VC++Files/mysqlshutdown/mysqlshutdown_ia64.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysqlshutdown" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=mysqlshutdown - WinIA64 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysqlshutdown_ia64.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysqlshutdown_ia64.mak" CFG="mysqlshutdown - WinIA64 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysqlshutdown - WinIA64 Release" (based on "Win32 (x86) Application") -!MESSAGE "mysqlshutdown - WinIA64 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mysqlshutdown - WinIA64 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Zi /O2 /D "_WINDOWS" /D "_MBCS" /D "NDEBUG" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c -# SUBTRACT CPP /WX /Fr /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:IA64 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib /nologo /subsystem:windows /out:"../client_release/mysqlshutdown.exe" /machine:IA64 - -!ELSEIF "$(CFG)" == "mysqlshutdown - WinIA64 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mysqlshutdown___Win64_Debug" -# PROP BASE Intermediate_Dir "mysqlshutdown___Win64_Debug" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "debug" -# PROP Intermediate_Dir "debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /G6 /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /W3 /Zi /Od /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c -# SUBTRACT CPP /Fr /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win64 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /out:"../client_release/mysqlshutdown.exe" /machine:IA64 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib /nologo /subsystem:windows /out:"../client_debug/mysqlshutdown.exe" /machine:IA64 - -!ENDIF - -# Begin Target - -# Name "mysqlshutdown - WinIA64 Release" -# Name "mysqlshutdown - WinIA64 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mysqlshutdown.c -# End Source File -# Begin Source File - -SOURCE=.\mysqlshutdown.rc -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\mysql.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/VC++Files/mysqlwatch/mysqlwatch.c b/VC++Files/mysqlwatch/mysqlwatch.c deleted file mode 100644 index 2a1f62b4394..00000000000 --- a/VC++Files/mysqlwatch/mysqlwatch.c +++ /dev/null @@ -1,745 +0,0 @@ -/**************************************************************************** - MySqlWatch - WinNT service program MySQL - - Re-start MySql server in case of failure -*****************************************************************************/ -#include -#include -#include -#include -#include - - -// name of the executable -#define SZAPPNAME "mysqlwatch" -// internal name of the service -#define SZSERVICENAME "MySqlWatch" -// displayed name of the service -#define SZSERVICEDISPLAYNAME "MySqlWatch" -// list of service dependencies - "dep1\0dep2\0\0" -#define SZDEPENDENCIES "" - - - -VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv); -VOID ServiceStop(void); -BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint); -void AddToMessageLog(LPTSTR lpszMsg); - -// internal variables -SERVICE_STATUS ssStatus; // current status of the service -SERVICE_STATUS_HANDLE sshStatusHandle; -DWORD dwErr = 0; -BOOL bDebug = FALSE; -TCHAR szErr[256]; - -// internal function prototypes -void WINAPI service_ctrl(DWORD dwCtrlCode); -void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv); -void CmdInstallService(void); -void CmdRemoveService(void); -void CmdDebugService(int argc, char **argv); -BOOL WINAPI ControlHandler ( DWORD dwCtrlType ); -LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ); - -// -// FUNCTION: main -// -// PURPOSE: entrypoint for service -// -// PARAMETERS: -// argc - number of command line arguments -// argv - array of command line arguments -// -// RETURN VALUE: -// none -// -// COMMENTS: -// main() either performs the command line task, or -// call StartServiceCtrlDispatcher to register the -// main service thread. When the this call returns, -// the service has stopped, so exit. -// -void main(int argc, char **argv) -{ - SERVICE_TABLE_ENTRY dispatchTable[] = - { - { TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main }, - { NULL, NULL } - }; - - if ( (argc > 1) && - ((*argv[1] == '-') || (*argv[1] == '/')) ) - { - if ( stricmp( "install", argv[1]+1 ) == 0 ) - { - CmdInstallService(); - } - else if ( stricmp( "remove", argv[1]+1 ) == 0 ) - { - CmdRemoveService(); - } - else if ( stricmp( "debug", argv[1]+1 ) == 0 ) - { - bDebug = TRUE; - CmdDebugService(argc, argv); - } - else - { - goto dispatch; - } - exit(0); - } - - // if it doesn't match any of the above parameters - // the service control manager may be starting the service - // so we must call StartServiceCtrlDispatcher - dispatch: - // this is just to be friendly - printf( "%s -install to install the service\n", SZAPPNAME ); - printf( "%s -remove to remove the service\n", SZAPPNAME ); - printf( "%s -debug to run as a console app for debugging\n", SZAPPNAME ); - printf( "\nStartServiceCtrlDispatcher being called.\n" ); - printf( "This may take several seconds. Please wait.\n" ); - - if (!StartServiceCtrlDispatcher(dispatchTable)) - AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed.")); -} - - - -// -// FUNCTION: service_main -// -// PURPOSE: To perform actual initialization of the service -// -// PARAMETERS: -// dwArgc - number of command line arguments -// lpszArgv - array of command line arguments -// -// RETURN VALUE: -// none -// -// COMMENTS: -// This routine performs the service initialization and then calls -// the user defined ServiceStart() routine to perform majority -// of the work. -// -void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv) -{ - - // register our service control handler: - // - sshStatusHandle = RegisterServiceCtrlHandler( TEXT(SZSERVICENAME), service_ctrl); - - if (!sshStatusHandle) - goto cleanup; - - // SERVICE_STATUS members that don't change in example - // - ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - ssStatus.dwServiceSpecificExitCode = 0; - - - // report the status to the service control manager. - // - if (!ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000)) // wait hint - goto cleanup; - - - ServiceStart( dwArgc, lpszArgv ); - -cleanup: - - // try to report the stopped status to the service control manager. - // - if (sshStatusHandle) - ReportStatusToSCMgr( - SERVICE_STOPPED, - dwErr, - 0); - - return; -} - - - -// -// FUNCTION: service_ctrl -// -// PURPOSE: This function is called by the SCM whenever -// ControlService() is called on this service. -// -// PARAMETERS: -// dwCtrlCode - type of control requested -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void WINAPI service_ctrl(DWORD dwCtrlCode) -{ - // Handle the requested control code. - // - switch(dwCtrlCode) - { - // Stop the service. - // - case SERVICE_CONTROL_STOP: - ssStatus.dwCurrentState = SERVICE_STOP_PENDING; - ServiceStop(); - break; - - // Update the service status. - // - case SERVICE_CONTROL_INTERROGATE: - break; - - // invalid control code - // - default: - break; - - } - - ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0); - -} - - - -// -// FUNCTION: ReportStatusToSCMgr() -// -// PURPOSE: Sets the current status of the service and -// reports it to the Service Control Manager -// -// PARAMETERS: -// dwCurrentState - the state of the service -// dwWin32ExitCode - error code to report -// dwWaitHint - worst case estimate to next checkpoint -// -// RETURN VALUE: -// TRUE - success -// FALSE - failure -// -// COMMENTS: -// -BOOL ReportStatusToSCMgr(DWORD dwCurrentState, - DWORD dwWin32ExitCode, - DWORD dwWaitHint) -{ - static DWORD dwCheckPoint = 1; - BOOL fResult = TRUE; - - - if ( !bDebug ) // when debugging we don't report to the SCM - { - if (dwCurrentState == SERVICE_START_PENDING) - ssStatus.dwControlsAccepted = 0; - else - ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - - ssStatus.dwCurrentState = dwCurrentState; - ssStatus.dwWin32ExitCode = dwWin32ExitCode; - ssStatus.dwWaitHint = dwWaitHint; - - if ( ( dwCurrentState == SERVICE_RUNNING ) || - ( dwCurrentState == SERVICE_STOPPED ) ) - ssStatus.dwCheckPoint = 0; - else - ssStatus.dwCheckPoint = dwCheckPoint++; - - - // Report the status of the service to the service control manager. - // - if (!(fResult = SetServiceStatus( sshStatusHandle, &ssStatus))) { - AddToMessageLog(TEXT("SetServiceStatus")); - } - } - return fResult; -} - - - -// -// FUNCTION: AddToMessageLog(LPTSTR lpszMsg) -// -// PURPOSE: Allows any thread to log an error message -// -// PARAMETERS: -// lpszMsg - text for message -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void AddToMessageLog(LPTSTR lpszMsg) -{ - TCHAR szMsg[256]; - HANDLE hEventSource; - LPTSTR lpszStrings[2]; - - - if ( !bDebug ) - { - dwErr = GetLastError(); - - // Use event logging to log the error. - // - hEventSource = RegisterEventSource(NULL, TEXT(SZSERVICENAME)); - - _stprintf(szMsg, TEXT("%s error: %d"), TEXT(SZSERVICENAME), dwErr); - lpszStrings[0] = szMsg; - lpszStrings[1] = lpszMsg; - - if (hEventSource != NULL) { - ReportEvent(hEventSource, // handle of event source - EVENTLOG_ERROR_TYPE, // event type - 0, // event category - 0, // event ID - NULL, // current user's SID - 2, // strings in lpszStrings - 0, // no bytes of raw data - lpszStrings, // array of error strings - NULL); // no raw data - - DeregisterEventSource(hEventSource); - } - } -} - - - - -/////////////////////////////////////////////////////////////////// -// -// The following code handles service installation and removal -// - - -// -// FUNCTION: CmdInstallService() -// -// PURPOSE: Installs the service -// -// PARAMETERS: -// none -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void CmdInstallService() -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - - TCHAR szPath[512]; - - if ( GetModuleFileName( NULL, szPath, 512 ) == 0 ) - { - _tprintf(TEXT("Unable to install %s - %s\n"), TEXT(SZSERVICEDISPLAYNAME), GetLastErrorText(szErr, 256)); - return; - } - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if ( schSCManager ) - { - schService = CreateService( - schSCManager, // SCManager database - TEXT(SZSERVICENAME), // name of service - TEXT(SZSERVICEDISPLAYNAME), // name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_WIN32_OWN_PROCESS, // service type - SERVICE_DEMAND_START, // start type - SERVICE_ERROR_NORMAL, // error control type - szPath, // service's binary - NULL, // no load ordering group - NULL, // no tag identifier - TEXT(SZDEPENDENCIES), // dependencies - NULL, // LocalSystem account - NULL); // no password - - if ( schService ) - { - _tprintf(TEXT("%s installed.\n"), TEXT(SZSERVICEDISPLAYNAME) ); - CloseServiceHandle(schService); - } - else - { - _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256)); - } - - CloseServiceHandle(schSCManager); - } - else - _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); -} - - - -// -// FUNCTION: CmdRemoveService() -// -// PURPOSE: Stops and removes the service -// -// PARAMETERS: -// none -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void CmdRemoveService() -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if ( schSCManager ) - { - schService = OpenService(schSCManager, TEXT(SZSERVICENAME), SERVICE_ALL_ACCESS); - - if (schService) - { - // try to stop the service - if ( ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus ) ) - { - _tprintf(TEXT("Stopping %s."), TEXT(SZSERVICEDISPLAYNAME)); - Sleep( 1000 ); - - while( QueryServiceStatus( schService, &ssStatus ) ) - { - if ( ssStatus.dwCurrentState == SERVICE_STOP_PENDING ) - { - _tprintf(TEXT(".")); - Sleep( 1000 ); - } - else - break; - } - - if ( ssStatus.dwCurrentState == SERVICE_STOPPED ) - _tprintf(TEXT("\n%s stopped.\n"), TEXT(SZSERVICEDISPLAYNAME) ); - else - _tprintf(TEXT("\n%s failed to stop.\n"), TEXT(SZSERVICEDISPLAYNAME) ); - - } - - // now remove the service - if( DeleteService(schService) ) - _tprintf(TEXT("%s removed.\n"), TEXT(SZSERVICEDISPLAYNAME) ); - else - _tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256)); - - - CloseServiceHandle(schService); - } - else - _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256)); - - CloseServiceHandle(schSCManager); - } - else - _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); -} - - - - - -// -// FUNCTION: CmdRestartService() -// -// PURPOSE: Stops and removes the service -// -// PARAMETERS: -// none -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void CmdRestartService(char *szServiceName) -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - - schSCManager = OpenSCManager( - NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if ( schSCManager ) - { - schService = OpenService(schSCManager, TEXT(szServiceName), SERVICE_ALL_ACCESS); - if (schService) - { - if(! ControlService( schService, SERVICE_CONTROL_INTERROGATE, &ssStatus ) ) - //if(QueryServiceStatus( schService, &ssStatus )==0) - { - if(GetLastError()==ERROR_SERVICE_NOT_ACTIVE) - { - - //AddToMessageLog(TEXT("Start service...")); - StartService( schService, 0,NULL); - } - else - { ; - //AddToMessageLog(TEXT("QueryService...")); - //AddToMessageLog(TEXT(GetLastErrorText(szErr,256))); - } - } - CloseServiceHandle(schService); - } - else - { _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256)); - AddToMessageLog(TEXT("OpenService...")); - AddToMessageLog(TEXT(GetLastErrorText(szErr,256))); - - } - CloseServiceHandle(schSCManager); - } - else - { _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); - AddToMessageLog(TEXT("OpenSCMManager..")); - - } -} - - - - -/////////////////////////////////////////////////////////////////// -// -// The following code is for running the service as a console app -// - - -// -// FUNCTION: CmdDebugService(int argc, char ** argv) -// -// PURPOSE: Runs the service as a console application -// -// PARAMETERS: -// argc - number of command line arguments -// argv - array of command line arguments -// -// RETURN VALUE: -// none -// -// COMMENTS: -// -void CmdDebugService(int argc, char ** argv) -{ - DWORD dwArgc; - LPTSTR *lpszArgv; - -#ifdef UNICODE - lpszArgv = CommandLineToArgvW(GetCommandLineW(), &(dwArgc) ); -#else - dwArgc = (DWORD) argc; - lpszArgv = argv; -#endif - - _tprintf(TEXT("Debugging %s.\n"), TEXT(SZSERVICEDISPLAYNAME)); - - SetConsoleCtrlHandler( ControlHandler, TRUE ); - - ServiceStart( dwArgc, lpszArgv ); -} - - -// -// FUNCTION: ControlHandler ( DWORD dwCtrlType ) -// -// PURPOSE: Handled console control events -// -// PARAMETERS: -// dwCtrlType - type of control event -// -// RETURN VALUE: -// True - handled -// False - unhandled -// -// COMMENTS: -// -BOOL WINAPI ControlHandler ( DWORD dwCtrlType ) -{ - switch( dwCtrlType ) - { - case CTRL_BREAK_EVENT: // use Ctrl+C or Ctrl+Break to simulate - case CTRL_C_EVENT: // SERVICE_CONTROL_STOP in debug mode - _tprintf(TEXT("Stopping %s.\n"), TEXT(SZSERVICEDISPLAYNAME)); - ServiceStop(); - return TRUE; - break; - - } - return FALSE; -} - -// -// FUNCTION: GetLastErrorText -// -// PURPOSE: copies error message text to string -// -// PARAMETERS: -// lpszBuf - destination buffer -// dwSize - size of buffer -// -// RETURN VALUE: -// destination buffer -// -// COMMENTS: -// -LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ) -{ - DWORD dwRet; - LPTSTR lpszTemp = NULL; - - dwRet = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY, - NULL, - GetLastError(), - LANG_NEUTRAL, - (LPTSTR)&lpszTemp, - 0, - NULL ); - - // supplied buffer is not long enough - if ( !dwRet || ( (long)dwSize < (long)dwRet+14 ) ) - lpszBuf[0] = TEXT('\0'); - else - { - lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character - _stprintf( lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() ); - } - - if ( lpszTemp ) - LocalFree((HLOCAL) lpszTemp ); - - return lpszBuf; -} - -//------------------------------------------------- -// this event is signalled when the -// service should end -//------------------------------------------------- -HANDLE hServerStopEvent = NULL; - - -//------------------------------------------------- -// FUNCTION: ServiceStart -// -// PURPOSE: Actual code of the service -// that does the work. -//------------------------------------------------- -void ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv) -{ - DWORD dwWait,dwTimeout=1000*60*1; - - if (!ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000)) // wait hint - goto cleanup; - - // create the event object. The control handler function signals - // this event when it receives the "stop" control code. - // - hServerStopEvent = CreateEvent( - NULL, // no security attributes - TRUE, // manual reset event - FALSE, // not-signalled - NULL); // no name - - if ( hServerStopEvent == NULL) goto cleanup; - - - // report the status to the service control manager. - // - if (!ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000)) // wait hint - goto cleanup; - - - - // report the status to the service control manager. - // - if (!ReportStatusToSCMgr( - SERVICE_START_PENDING, // service state - NO_ERROR, // exit code - 3000)) // wait hint - goto cleanup; - - - - // report the status to the service control manager. - // - if (!ReportStatusToSCMgr( - SERVICE_RUNNING, // service state - NO_ERROR, // exit code - 0)) // wait hint - goto cleanup; - - // - // End of initialization - // Service is now running, perform work until shutdown - // - - while ( 1 ) - { - - dwWait = WaitForSingleObject( hServerStopEvent, dwTimeout); - if(dwWait==WAIT_FAILED) - { - AddToMessageLog(TEXT("Error in WaitForSingleObject")); - break; - } - else if(dwWait==WAIT_TIMEOUT) - { - CmdRestartService("MySql"); - } - else - { break; //shutdown - } - - } - - cleanup: - - if (hServerStopEvent) - CloseHandle(hServerStopEvent); - -} - - -//------------------------------------------------- -// FUNCTION: ServiceStop -// -// PURPOSE: Stops the service -//------------------------------------------------- -void ServiceStop() -{ - if ( hServerStopEvent ) - SetEvent(hServerStopEvent); -} -//-the end ---------------------------------------- diff --git a/VC++Files/mysqlwatch/mysqlwatch.dsp b/VC++Files/mysqlwatch/mysqlwatch.dsp deleted file mode 100644 index ee683c60351..00000000000 --- a/VC++Files/mysqlwatch/mysqlwatch.dsp +++ /dev/null @@ -1,70 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysqlwatch" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mysqlwatch - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysqlwatch.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysqlwatch.mak" CFG="mysqlwatch - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysqlwatch - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /W3 /O2 /D "_WINDOWS" /D "_MBCS" /D "NDEBUG" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlwatch.exe" -# Begin Target - -# Name "mysqlwatch - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mysqlwatch.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/VC++Files/mysqlwatch/mysqlwatch_ia64.dsp b/VC++Files/mysqlwatch/mysqlwatch_ia64.dsp deleted file mode 100644 index eb17b6991f8..00000000000 --- a/VC++Files/mysqlwatch/mysqlwatch_ia64.dsp +++ /dev/null @@ -1,71 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mysqlwatch" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mysqlwatch - WinIA64 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mysqlwatch_ia64.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mysqlwatch_ia64.mak" CFG="mysqlwatch - WinIA64 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mysqlwatch - WinIA64 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "release" -# PROP Intermediate_Dir "release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Zi /O2 /D "_WINDOWS" /D "_MBCS" /D "NDEBUG" /D "_IA64_" /D "WIN64" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /G2 /EHsc /Wp64 /Zm600 /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:IA64 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib bufferoverflowU.lib /nologo /subsystem:console /out:"../client_release/mysqlwatch.exe" /machine:IA64 -# Begin Target - -# Name "mysqlwatch - WinIA64 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mysqlwatch.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/VC++Files/winmysqladmin/db.cpp b/VC++Files/winmysqladmin/db.cpp deleted file mode 100644 index 6e796856a7e..00000000000 --- a/VC++Files/winmysqladmin/db.cpp +++ /dev/null @@ -1,80 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop - -#include "db.h" -#include "main.h" -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -Tdbfrm *dbfrm; -//--------------------------------------------------------------------------- -__fastcall Tdbfrm::Tdbfrm(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -void __fastcall Tdbfrm::SpeedButton2Click(TObject *Sender) -{ - Close(); -} -//--------------------------------------------------------------------------- -void __fastcall Tdbfrm::SpeedButton1Click(TObject *Sender) -{ - if (VerDBName()) - { - if (!Form1->CreatingDB()) - { - Form1->OutRefresh(); - Edit1->Text = ""; - Application->MessageBox("The database was created", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - } - } - - - - - -} -//--------------------------------------------------------------------------- -bool __fastcall Tdbfrm::VerDBName() -{ - String temp = Edit1->Text; - if (Edit1->Text.IsEmpty()) - { - Application->MessageBox("The name of the Database is Empty", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - - if (temp.Length() > 64) - { - Application->MessageBox("The name of the Database can't have more than 64 characters ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - - for (int j = 1; j <= temp.Length(); j++) - { - if (temp[j] == ' ') - { - Application->MessageBox("The name of the Database can't have blank spaces ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - else if (temp[j] == '/') - { - Application->MessageBox("The name of the Database can't have frontslash (/)", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - else if (temp[j] == '\\') - { - Application->MessageBox("The name of the Database can't have backslash (\\)", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - else if (temp[j] == '.') - { - Application->MessageBox("The name of the Database can't have periods", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - return false; - } - } - return true; -} -//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/db.h b/VC++Files/winmysqladmin/db.h deleted file mode 100644 index f7ab87351ea..00000000000 --- a/VC++Files/winmysqladmin/db.h +++ /dev/null @@ -1,32 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef dbH -#define dbH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -class Tdbfrm : public TForm -{ -__published: // IDE-managed Components - TImage *Image1; - TLabel *Label1; - TLabel *Label2; - TEdit *Edit1; - TSpeedButton *SpeedButton1; - TSpeedButton *SpeedButton2; - void __fastcall SpeedButton2Click(TObject *Sender); - void __fastcall SpeedButton1Click(TObject *Sender); -private: // User declarations - bool __fastcall VerDBName(); -public: // User declarations - __fastcall Tdbfrm(TComponent* Owner); -}; -//--------------------------------------------------------------------------- -extern PACKAGE Tdbfrm *dbfrm; -//--------------------------------------------------------------------------- -#endif diff --git a/VC++Files/winmysqladmin/images/Goahead.ico b/VC++Files/winmysqladmin/images/Goahead.ico deleted file mode 100644 index 8241c90e2a20f50b923ce020a2607f1e90030b94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmb_aF%p6>5M0z58)mSwmC|46)AF=DfEm6(X-R3pOx(RofI`v23zy5@Zte&Ks5sj8 z1leN;oEfk5mVT#KIB*66x%U=Gk_o{BXD$(AWE7F?K}uTDIh4}$lXbL3SPOPtEE$Kh zqQIP}7i>F(**P&77M-zr)N4$^H!S(Qp9TJa^)@n=vU(Z(jFP}!B3fZG$ej6fqFfMW#q Z#RIS7mKUAkz`do8YO1zfJM~ge+6yHyON{^k diff --git a/VC++Files/winmysqladmin/images/HELP.ICO b/VC++Files/winmysqladmin/images/HELP.ICO deleted file mode 100644 index d0cd6d68cce7ad691f9cb56393dd3c3b495cd7d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmc(d!41MN3`JeU0Gv4Y$QX>)(KAs%f7RobL#he=Jq@r zQr~lS5I?lwh2**W))3!E{Ef4J)c{eP#}>4423D?s1C=a!9JmD0pnSa$1xn!Sg>hdX Q@2kI0sTf$r`aAp;Z$@n8>i_@% diff --git a/VC++Files/winmysqladmin/images/INFO.ICO b/VC++Files/winmysqladmin/images/INFO.ICO deleted file mode 100644 index e3afa8cf52c556f048918aa5a290c2fc2b9e730e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmcgqyN&`e44gfXXjX!XmM!lu;Lk3f<`0O(FHllaQmimDPORmm6LjaSGZ}mAJhZ^T zF-<$ju3x~O_)VYaC;EUj=XX{Beki2@XD(r8L?t{vxNAk{P)O6CR%uIO6s^^IWDK?h zYCW@)``k*HP97B$CYOL|8s!2CM&Sz&nw$k6`1m_-|H9)wv9ZPZ7M|yAr_v+ls^N0q zUf%A{2D1WsFrl7PNE(99l@3AYK_zJQ*0=&HPs(Wa>Vg;W+t$4d{s4Yv;CKfPH(+}K eHU_NZg}-1rK3M96*6T0qrJm}oJ+znh)ZS0XHe=BM diff --git a/VC++Files/winmysqladmin/images/Info.bmp b/VC++Files/winmysqladmin/images/Info.bmp deleted file mode 100644 index 58f729fb1fd1460f8edc18164815bee6b77b58fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmchTJr2S!424|^TLwl(M$W*p)>J3y_APoPvTxU9n*>8h&uv=JhXZ_pu+Vov(A8*H6Vq49~USx3&BI uvBAOsAB@W9qynv=G1FGi*pLO@ug(mxJrL2@s}-zd80GOiOmZ40d0#&j#!93B diff --git a/VC++Files/winmysqladmin/images/MYINI.ICO b/VC++Files/winmysqladmin/images/MYINI.ICO deleted file mode 100644 index 428ed8e92b022e3cdb815530788da671ca44b14a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmbV~F>b^l5JkU3q|j}uZP#T=OB`TxvmMI~x5!m2rN~us3+IjPI6$#dcHqzO`S6(n zsblp0t31A+q%-vm^xz$IdM4islbABw3Yn$md8WFstW(S4E5PtAPi^E}?L@_j>z~{d za~a$(Y5ka#LkQ_FhFr2Vz#F}34obhffmZi}57GRzb4o~?ymFMZ%YGz9JLH|0GI}NB zSIJ7XOh1LW`~SY}=0qdow|2gXonT!Yve0g W2LgBjCvX8*a08f+z#sVlMf?D!QHp^8 diff --git a/VC++Files/winmysqladmin/images/Myini.bmp b/VC++Files/winmysqladmin/images/Myini.bmp deleted file mode 100644 index e743a1b9b321cf7c6de28f506baf3ab4c9d413fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmbV`F%Ci@5JU&Dp!5iqmL#-RCN?G(-o^Zyl4E!jZicgf$kOTlzsn8}hP~Xk9cpZ> zC+4xI!JeItgOU;8j~Ls+$`(0it^!K^QHpd-ezGNHjg-`mgHswm>Ij$S;Qd+Z$ADz5 z4d3u-R>4y*d>M|C^L7JN_o2Oua#}PO8yc>fBy=oCf{O!pJ!5i(>8CJ)#++v|7yr-O eV$N7F{p#cmvg+I1(0H8tqj?y-&bZ;pyqY)EvqPl- diff --git a/VC++Files/winmysqladmin/images/Noentry.ico b/VC++Files/winmysqladmin/images/Noentry.ico deleted file mode 100644 index 27f2211f56c524448b7cec644eb1b58680fcf6e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmcIiF%H5o47>soVk#3W9r*=3El*(0#8>i^j*J~aLJD_j+=dFZEI4(Xvwe2!2B^52 zW)I1I1srHk)P{PYR@iU{9An?bG02E>z2VLyLI|`9#PlFWov2)LY5Pe$WlY=&dVe)f z4~Gnc*^#pc#uSg~iBN=7izQsrRlwi)Sy`U{z#k2PrT3f0QSvpxA|Xw5iVH#>xK*(E zXU6b9I0TAC=WUu)SI6k8bR}NE`2id|pq944HUMi=$Llz!mM7biYjsppwbQjzFZHCn E0T5dk!2kdN diff --git a/VC++Files/winmysqladmin/images/SETUP.BMP b/VC++Files/winmysqladmin/images/SETUP.BMP deleted file mode 100644 index c5794e5ac002c08a15e69c14b7bad84579791535..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86878 zcmeHwOPCzRnQd0T-`!Q+RsAkne((^sY{?$mFtY5ygE3%R82tEb%U}<1nHkWSk%56L zdyKDOumNF=)nx_MAuz+U3Ak;H$}JJdTaE9AN(M?^Ugb?d+)tB z`q|HZ79Bl$G@^;Y!u+iyqj zyz@@FpYI|L z^U2@dM!Yllo%wtVahR9)@Y}m6uM>!O0dd|zoEm}MHqKhJ*=+i#<;mhjsJY`=y5HLPF6KK}kT zwl84&Eo|4Y&T}*V1=R5wY`=y2Uc&Z8Y}fG3?K4=v04ywFy@vIR_~!N*d|$+O4Om&i z_XT{P!S_Xc*MOlVd|$x#8T{9Pt0jD2!1o#a*MPMp{GY*p4cJ@4{~7$(fW;H|U&8+x zVDkk2m+*fESUrLNB|!LT{G(2B{X1cOCGbE0^FQl5@PGSJRa_wct69NaJEQD`of60@ zfoe8#3{3>qPS`1dbO``5q?{z-%va}K@OyWllP^m#{ydu2}%_dlKI&cSj};IWSTT zhMAdJems6;zAW~ovRlZo0@c^nestPI(f#jV^~lM%QsK#J0!w3@7&gF6DgZxov(P_| zdX#QPq95?CkWtI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||LFS&JVU zu+ff6wq2#Dh6SLu%BDIyRT}Kh z)8gF&qve?Z9K+1Ym5x_7_<&Ipxv8BiImqkwGuPG?>_l2?33w9Fajeexv(}{eo`tD# zyi2k-a8Oro@8C$Og8q1lD(oC zP6_Okz)lJ5l)z32?3BPx3G9@>P6_Okz)lJ5l)z32?3BPx3G9@>P6_Okz~4j({D1r6 BW8we+ diff --git a/VC++Files/winmysqladmin/images/Setup 16.bmp b/VC++Files/winmysqladmin/images/Setup 16.bmp deleted file mode 100644 index e17b06155fb278d7705ec06eb6dd882fc150a353..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86880 zcmeHwU6>?AnRQnG|94k)S5^NOJ^p|U>*$QG3OkN2E+U`~f37a~BO)`aGP|pP=xLXZ?#jx{ zij0hmIC0(+Z$xHZ`?Vk5T8J1v(-TD>!}m2^QS^I!7oq{~RwxZe5kEfs#gYR zx8IK5dFP$z-FM%O-h1!8=+A%tGuGe3`k%4>7sPuD@!m$fcM$Jg9DfmM)sYs{c@yV2 zfpaY59A|LOr*Q0_aqM4k%sV*dT^#cs(sFXGrYam-sd{sQ9H@!Owq{4$O|gShYE z_!Efx4vu{n@!m#!#=VGR-$eWi*#92l))D7j9CrqB-oY`;i1#+)y@~5)UYIZD^Bu%t zKKa{Qh<66RGoNoF4)gLZetQSybpr7&AkN!}Q^)Ub;diEW2K$)CMZ{UgZ_M-CC}W=E zE&N``Z_F3d;I&`Ge*V6U-!9;{x3IsC{VXHy=lL&U`z_SfGJd;&?KiQ%j`fS!$KT(= z_62OeiS0Vpd2YtPfI2>d?Ke^1%heFp0nfQ4nO*Rg&P-`qZf?~C}Z11rn; zzJTvD_`ZnmIxw`1?+f@ogHIi}TE_PUe4oLm4y-NXa|WL}u(yoQ8GP!%;t70~@i_x* zp1@}rpEJPf34E3T->2|Fo#Og;!^TSBfBxrxHg@3u_M>XJKzwRh!CgC}?1tSE$SQ$a zHgXJ21lDfYErE0i05YVUB;hR77F_UqccGImw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q$P`nv~wph_Sh(QK4M<_D?>b}x3f1a?bcw*+=eV7CNz zOJKJIc1vKl1a?bcw*+=eV7CNzOJKJIc1vKl1a?bcw*+=eV7CNzOJKJI{z^*V{{!e; BW2FE9 diff --git a/VC++Files/winmysqladmin/images/Table.ico b/VC++Files/winmysqladmin/images/Table.ico deleted file mode 100644 index 4469a915b7fac90084a940b1056385f84afb2839..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmb_byH3ME5FCd{(8Yg%E0mrBIw)N8GZaB-xQ-JIzvNGGNqG`TSa*__**zb!qL7G) z_07J5= zb|9i2!ADc7id=Z_ia(A4E0NHn#|i zvfVu9gz@q!ar0D4Xy2Iruose~kYr$)x1N&NKMm1)`O<=k_e@%xc`HiF?~079A7u=L za+7OGjgRsA&Rlly%k$Wf_Sqfd=e^Xo{p6)YjVG7$#oSN#dw|!P(?!4LBK#?&M@8V7 OxFar!^Z!P)czKGHAr0bh(jCilN(l4Np@#KQox&POGM&n&&ktgH&jY=zBM z0@5pi;6l*og`gBH+b5Ky_I-p27szGghz)%Nm%>JuK$L>T>M0{7ftUh`L!@HhU|5|o zh3y1ZC>0s~k%}5L({Z4)r@3##)UrfDLku&H;}f?pdC?L?t#4@4I#BMjdyRs=jI4=E zd;fn=j(5QQadp3+-ESxNY42Wl?s?1GG59a9$pg6Ff%6SGO~Aeay9{jEWautjS)a&D UC%yJ*zxuR(>Z|^mqj{YB2VRrFssI20 diff --git a/VC++Files/winmysqladmin/images/database.ico b/VC++Files/winmysqladmin/images/database.ico deleted file mode 100644 index 9689aa883610764ff753ffbde688c53f44170847..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmd5*J8r`;41JDUL_mNdH;AVqV|FdQNw49p+?3-K&{Dude3XpcGa88co@B!Ynj#%K zls3PQqGXWSJ!DT+-CP;@y#2dBx-F8Q2&{jhxGlTE61Dzv46ScEwuTX4-?ZPj1N5 zocFYElZ}Vtd^17PX#8rOLZ=aawPueEP9u1&9yt=3wSnBSpWb4 diff --git a/VC++Files/winmysqladmin/images/find.ico b/VC++Files/winmysqladmin/images/find.ico deleted file mode 100644 index 2e0f96c52f996b34e252db181bafa0de1f9fbd09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmaKoJyOF!429*8iB&K$6&-_1-+>|=B^9R3r0`G~;Ua8Bj=)jk18|7#?1~AUX}mni zo`lRmw0_!^Kk500D8fq9E7E8uMAz6eD248!h^ELy0`_<8h;Y$vH*Cl_QeD?1A^^cI z3PDd0mfq5IHWGh|`_nr4#bVz{UJHZkncLaNh?B zf#+qpt{C&Ob>g9(G3GGe$#LCOmtW$NQF_6^GCCTTjb<1}%c z|BwC06*(}5;l%nNKX)QeBJ#oY5nieqIf(=_27Sk_OL#dl1GA9=jm zEb>@(Wrb9c0+Ypd1l4iWP7u4Le71HVqSu_hwWc8VEvKB$wFaq=g!xiy;2Q23pm&^_ zv#QuNk;evg}_-b7bFodqhJO*EH;2PfaYD~mdAOI>ks$cf7&nGIuX_Y diff --git a/VC++Files/winmysqladmin/images/help.bmp b/VC++Files/winmysqladmin/images/help.bmp deleted file mode 100644 index 76c6a90d2d8bcedc5bd20b82e47c8e3cd9662ec8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmZ`$!41MN3^a%VU;~~!n1CnGO03ftkBq{HJvu;??tv;#P^sM6aZw}THqM=WcANPA z==WmQ!(Xt@b?xK;w6)`gCK0@nl5g;UG7JNDCKh{TS%|RkFhp*aVUFnMtgt-R$Xrw> zt{NcBncf7m23Hdxq3p*nn_&-5K_T~g6Exi9NLW~Ptei!(%A;P#!syyB>ehVp@&Ebt zZFv-gzU4fDeW=jGg2(A=f&CxxKhE -#pragma hdrstop - -#include "initsetup.h" -#include "main.h" -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -TForm2 *Form2; -//--------------------------------------------------------------------------- -__fastcall TForm2::TForm2(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::BitBtn1Click(TObject *Sender) -{ -if ((Edit1->Text).IsEmpty() || (Edit2->Text).IsEmpty()) - Application->MessageBox("Fill the User name and Password text boxs ", "Winmysqladmin 1.0", MB_OK |MB_ICONINFORMATION); - else - { - if(Form1->ForceConnection()) - if(Form1->ForceMySQLInit()) - { - Form1->CreateMyIniFile(); - Form1->CreatingShortCut(); - } - Close(); - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::BitBtn2Click(TObject *Sender) -{ - Close(); -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::SpeedButton1Click(TObject *Sender) -{ - Application->HelpCommand(HELP_FINDER,0); -} -//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/images/killdb.ico b/VC++Files/winmysqladmin/images/killdb.ico deleted file mode 100644 index 9689aa883610764ff753ffbde688c53f44170847..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmd5*J8r`;41JDUL_mNdH;AVqV|FdQNw49p+?3-K&{Dude3XpcGa88co@B!Ynj#%K zls3PQqGXWSJ!DT+-CP;@y#2dBx-F8Q2&{jhxGlTE61Dzv46ScEwuTX4-?ZPj1N5 zocFYElZ}Vtd^17PX#8rOLZ=aawPueEP9u1&9yt=3wSnBSpWb4 diff --git a/VC++Files/winmysqladmin/images/logo.ico b/VC++Files/winmysqladmin/images/logo.ico deleted file mode 100644 index 9409cad72b69aae2caa27261e26384eec06d679d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2022 zcmcIldpy=x82_qQUiB)M!mH#m3z0%fZn<<5pzb_j^C*{LXp4&pGEg-|zGMUOsCQePY+U3Nf3+0(AL(5rluy8m6f5Sqy$ApMKH#YoSclnz(Blu^$LxR zjqvvN#>dlzM8WiT@{gTKE&;^X5H6%~ch&`|8$ zxd&_3tU+yUEmBfakd%~!qeqXTtE&sPwzlx~^+iBH0J5{Q(b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yanR9$_|z+(oqoJ|SI+Q=C&zcb7{1PTphMUnW$M3U z^vegG7gI*(5BqT-&iRU`XRrQssCY-@SJ&=*oA+;==klo?tp}4D*Q?(e_8)Mc>1#d} hKV1(V9`^y9%*#*mE#Yk+#tGTC|2^FQFZ%!Ye**{&x=a87 diff --git a/VC++Files/winmysqladmin/images/multitrg.ico b/VC++Files/winmysqladmin/images/multitrg.ico deleted file mode 100644 index 76ffbe29c77156ae50e3d648e74bf7220459ce59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmaKqy=ucS6h?3Af)+zMbxp>O2Catlk-TNBA5EZD&{xRVF=K}i^?X-$yoAcRvd;ba zt|H59$8$Wsna0nH**otK?1+70J9}j|n~6OiGeIKr++NHqvDs2e1gih6R;@4|xiqzL zKA)#`Z5BYr>IhoNw>TzMUhPq`2W!3I@Pxj6gQb+vG+C9bY4C*3d6d(IjHy3}gJ1wC{Q=$+90 NLZ4n8_vhfd{sV;I4oCn1 diff --git a/VC++Files/winmysqladmin/images/mysql-07.bmp b/VC++Files/winmysqladmin/images/mysql-07.bmp deleted file mode 100644 index dcae23b88137e076df1fc6e0894475932ca867d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9618 zcmeHNUu+b|86P)2#cm*RP-9wK=W4EA2z9zVXN-kM#G=?48fX zvP~65dFa62&V2LD%x}Jb^UcEc*DtSQqCEd&#-2s(Lp-f`>R7#?9}I|>{HYTi9-*Gq z*Aq`8-i@rWu@QAY>VDMy%f2G@j{0`CefxH_+t6-9yAAC&*49S#2>@?=yA~FpvOUvvv@oX{!Y+3(e6aMlXZ4>g6|aCr_ery_9=Gi)G6?EV_Y}r z-Jo}a-VJ&;>+U9cA837`^?}w0S|97{>w_G0tgB;;4!RDy4!X{CT}NLEGD<-XDaa*- z{ilF41^yH;rGO!YHB*>3g?UpLpTgJ_#->;*MdQ*Km&Uj>#-%YXjd5v=OJiIbYo;+a zjj?HrOJiIb< zc(dT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h7APKuK>{5uhNTQsIp*4?3h#nr>=3Frf-r~` zbzLDd>Cte2RuYpPlu_XO3w=S*^;e}%eS4)}k(bNetOZVTw)vkD=lb*UejWTcNNlm?Tf;BxAv>a0b6>k+|EVp%^(g8*f&SQeLy zYafeV0T#r-voIg$q}Zu1QYaR(t9+=e`prLFyQMtiv5y6I*wVk3IvtHbX zChhrOSQph1#+xK681Z}bb|cbASFCwb+A$)WK!T8;6W1Z;YuX)4#9pl&p}sfhg5uqX zEs^Chw#oanHcu=|$VC9a&(-~3%c}OcG=l2y3*;U`*j7mHy4rOM zuq-gkcSHI=mWAc`{m5ln?HFBn{aWhxgT)!`idJ2*cKJE=(pMfEFVkBo2{%ydwJ4Eb`y0* z`5D(8;T>vx!j4}8Dz2Ue+Ys;Sh^n;iG~ahx<cyLU#C4ONTyVBtRBZ^Ah>Mp8!Ge@Z9d&zE$DQEmG9MXG`FK}y znkP%8=p{Q2j9qG}bVj|!0iesnGC;5#!0AQ*;)VSOe->x)dP{tubY1244W1rP@|!pK z#3<+P749VCr4c@A$N76BBmDX(PXov32=}mXR4+~Q0qB&Bd$GcPiPLH^hH9U%-62dk zqVld$cc9lTtC!rH>UcRBRfin=^u?|-&OjUza&MlFCRGnhvMZV_m(+1^FQp{$kNDN~ z7ORwax-_bCIJPrA?`WGANdb~2II##L&h)IkpuWt)?%_WcEQ_}UbKy%HU}dg~?G9B4 lOTQVrSNS)aC7A6Alx6SHy(L`Od4LhPs{zXorSv|={tNl@jd}n8 diff --git a/VC++Files/winmysqladmin/images/mysql-17.bmp b/VC++Files/winmysqladmin/images/mysql-17.bmp deleted file mode 100644 index 0291c804006fe21b4a643c42d9a8c537eb0efb78..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3806 zcmeH~yK>_;6o$e34TMCK5(!DB2$2>^Q8uL%nUtPX+oX5ta!Z$6x^%gv$}Ls8beYm+ zN>>>_Lf*jnLCM#dWY&}2nG}0wAc7$9orC`zz~f(k`;(E*e%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aA0z4iJL#d!_9?xtx=bl zTksg7NbtE;ew+X5_T$^?vc9YDzA^LB`}(Jiu`ka|V@+HP|MBk!UsDKfvFEpV4T1xc z+br3MfiGu0SP)6hwI~^{hu>TOOi_oH(V3}c>#MeY*t|S_b?#iVab;1@JkqnlAE&P@ zjzf((1KYa~R(;>#+mf|G5Dzu7GiKPyBD^2%;~x@v@zAkn%;-BxUDbN-?bBa8oV%{n zIlVac<~RCJSH2wi{IkIL(E}eYRlFr9d4PCC*5!W1S2(xQKm|X$P(>O z`+NBEGS!|tr^XiaH>cIxTAypaujf9SKXqn)BEVK94xpar2#{?~*Nl;DnSsbM z1?^Fh1|Rx|eEr~sL&rgQ)tb6@T5|E2YR$AKPpVJ#g8ra3eaSb$&)Oz0;210{)8W##=hNurCPA){CxYoYTW<5PHm?7k z@Yq&)7UFpz>+)xe%gF}=`GB~Wh%|Av?32&jfR|1qtF}%i$rHSlpLAyd3xnh^d+mWA6vfv(AIxb zYOKA0{}O02rw-Q4*{Oz)p$NbB>ygCT?fpW45KK6^SJ^n53 zN>+6isy6zL$vWII43vC?wh?*BVGxQ)JZ%U;L!ne0#d$)SGNH|X$+(n2oaO9E+mh@H5A&Sa3Y%n1N#kjv4s>Vc@^> CzIb;4 diff --git a/VC++Files/winmysqladmin/images/red.ico b/VC++Files/winmysqladmin/images/red.ico deleted file mode 100644 index b28288d576e1416391102cc7333a4eece5c65a2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmc(cF;c`Z3`NB*Gp2)zI^zaPW?ay6B+b%Ly4!FAa+@57GB?OR*;ed=9wl;YKUw-# zMDBQ|>51`PeorFLBJzq)_y=zLW*PRkWgsNy`e9^>XIa-3u$Nc%-DWtCZP~imCh}Nk zbtI^fiWM6If>{p`)fiQMLnNGHd5cmJGMrBs=gXC>zOCV|$GPh{c+(TkDZL}h^(X<{|Iib{ zJcm%STS?KcWyxcIzL(`^=nt5HuIItl*RIF8>p6JSqn2;%4*}QS9|X*^YPr3)z<)SJ G{?%^KRSu>A diff --git a/VC++Files/winmysqladmin/images/red22.BMP b/VC++Files/winmysqladmin/images/red22.BMP deleted file mode 100644 index a35052afa012614102a613e2d516d1ae6b4a13c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2104 zcmY*Y2Yiip8$H&I;Apai%w(XQq5`kZ{;y|=cQBP0=PYAt- zmM(;jfuA>#a5f>fts{E3C3?0Y@@5jP!-y9v5`I7N(LCaM0nxb*ap@d!@pt0FS>l(& z#K|9tlmz1Nx5Tu8#MJ)84||FH9Yn*T#CKbXCMAfBmxwK^h)v6h^j5^cjzkqGW-Y?- z5sx1ew{IwKsN%&DFV`gIjV9tt6G^JCyL?V4SKBJYlzzm)T|`bMk=>j4W)m^eEl%}* zwv>1-ocQETqE!g7bQaO546$S?u_%Y|HYMhaAl?{7%ot2Ws)p>ILJwkmIx*C)I2BZ1 z2V%f0MB+0e^=N%qbLguO1&P5o%2T=CBmb#)&rR1@k5wS^d=o=`)mDntu4 zg<8UICy18vi_&@JLiKzaF@HR<{B7dO1>(^|V%AXN%+JK#Tg1IP#JSVN^P0<=cZt*% z;)fBlWwUDo@$dn$bq#S@zW47E%jOVQFB8WO5;KR$X9=-k8S(XMV#Na0T}hgx?dCNi zE{K@ei}>{@k*k<@ZW2ci$p4b~tI{vsJ3c2?E5?EC%5k39ypmWjK`}ohHhxU>YfogV zXIWi|8wHwUgyN{~vnQq7LYzNC_#P1riW8GFh(Vn+&qKr{&F{Q)y;_}^(1+N+jp!Of z?DQ=+7ltU;=1+B2uH({qEMHpHkA~)~f;D$x#e6|M zJt93v_G?!Z&lW44!-)dvE4Zk7r7^8Jaq1_{K)G^9YL-Qac2?rnb>iA(V(u8CzV5cK zC)U1Cj7=j(dx(8oh@GnS;eFK=NxUQfESq*+{aHAPIDK6EP?T7gr@c?qUUebG_P8u8mnoK zv$SW*u~U1{DpcR{TB4Hn>ib>9-mmlx8=6l$*}o?Zy00!Y5Xb=ZFn`16g$)jRB|0di z!KyNaH&6ecJssyVl5IYp&26|W%R-;#$o?5$8cv`8$WQ2E#Gv1`ltMbmrl-vlVF@=6F3Yn4gUk@C(`I@krMEW>$K}(z ztA58y>Z{zRbmwOy1jz6;iJU{Qb6|1L2_zvszuTw)j2|J1M^_x*ywG zXBG0k8R4nD_?)qEWdHTvL#)5R>&+g^&kMu{do)kqjDhYBW8e9qEUU-3Tn$J4>)_+1 zTsI-5_%j@7h_?mpayxA;bJ`Z~awo~=S)UW!ds|DpJEHM_Ux+fbB>(as!|zM>7@n0S z91(uI!|HXoQm=gfyvJkjDBe*n-)^prdn=c_28}TyBAhb6o#iqwl|DIgVvt>j)GDFl zqvkA3J~P^4cin4|8EBLyI&c(~!0&ek^(!}~Hj72_weH1AH|8PpQmqan)1no?xA(&q z!N1n;F|66PjB4*6o&H83tMd1btkerQD* zbabb>zPkU>(AVFcofyOZM}I%z^Lt`Pm^=sUOEHt#CT;b!?$aS*MAwtdYu7a?rAc6L zGI;%l*(-mN+ZVnswI-+hRC4asaHDSdfOjCmn}(@UCU&1Yzo_@?yN0*e-`=LdCwsa% z0wqhTCCZUE{?*!t|M3nSCJ*`4ZY1k7NJ_D~S0AtQ|E&2|YS@s$apB>XkeijZ|BnU! E0u5V*i2wiq diff --git a/VC++Files/winmysqladmin/images/see.bmp b/VC++Files/winmysqladmin/images/see.bmp deleted file mode 100644 index 72fb2c50ec6d22e11180b3158e3da7551b754659..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmaKoF>ZuF3`M;t+I0~@jzBqQNSSh_++nMbCen&xlnPlCo2iy7`|OKXeCp-0zk)dgxxkD$mcMDU;l+Gc@WE_tm$u&Xla-dZC=RD*CzO)u zcitaQb^Y6W@Zg*y>WvqnI@XA#-}<+qSDuG4;8f{rHFGgP-VMVrGI&2liILN)Dr?5P zG(ke6e8enx{LW?$2!RAB8Ybl~x9`ROW-8SH$D=G5XNNaH0cbp_&n8f+^8^9h;XQMr iq$-7t8YhjJs=vkU#}fbavr6*|(Ys6b -#pragma hdrstop - -#include "initsetup.h" -#include "main.h" -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -TForm2 *Form2; -//--------------------------------------------------------------------------- -__fastcall TForm2::TForm2(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::BitBtn1Click(TObject *Sender) -{ - if ((Edit1->Text).IsEmpty() || (Edit2->Text).IsEmpty()) - Application->MessageBox("Fill the User name and Password text boxs ", "Winmysqladmin 1.0", MB_OK |MB_ICONINFORMATION); - else - { - Form1->GetServerFile(); - Form1->CreateMyIniFile(); - Form1->CreatingShortCut(); - - Close(); - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::BitBtn2Click(TObject *Sender) -{ - Close(); -} -//--------------------------------------------------------------------------- -void __fastcall TForm2::SpeedButton1Click(TObject *Sender) -{ - Application->HelpCommand(HELP_FINDER,0); -} -//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/initsetup.h b/VC++Files/winmysqladmin/initsetup.h deleted file mode 100644 index 28f575198e3..00000000000 --- a/VC++Files/winmysqladmin/initsetup.h +++ /dev/null @@ -1,38 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef initsetupH -#define initsetupH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -class TForm2 : public TForm -{ -__published: // IDE-managed Components - TImage *Image1; - TLabel *Label1; - TLabel *Label4; - TPanel *Panel1; - TLabel *Label5; - TLabel *Label6; - TLabel *Label2; - TEdit *Edit1; - TEdit *Edit2; - TBitBtn *BitBtn1; - TSpeedButton *SpeedButton1; - TBitBtn *BitBtn2; - void __fastcall BitBtn1Click(TObject *Sender); - void __fastcall BitBtn2Click(TObject *Sender); - void __fastcall SpeedButton1Click(TObject *Sender); -private: // User declarations -public: // User declarations - __fastcall TForm2(TComponent* Owner); -}; -//--------------------------------------------------------------------------- -extern PACKAGE TForm2 *Form2; -//--------------------------------------------------------------------------- -#endif diff --git a/VC++Files/winmysqladmin/main.cpp b/VC++Files/winmysqladmin/main.cpp deleted file mode 100644 index 150bc669c74..00000000000 --- a/VC++Files/winmysqladmin/main.cpp +++ /dev/null @@ -1,2531 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop - -#include "main.h" -#include "initsetup.h" -#include "db.h" - -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql.h" -#include - -TForm1 *Form1; -bool i_start, NT; -bool IsForce = false; -bool IsVariables = false; -bool IsProcess = false ; -bool IsDatabases = false; -bool new_line = 0; -bool ya = true; -bool yy = true; -bool rinit = false; -AnsiString vpath; -AnsiString vip; -MYSQL_RES *res_1; -static unsigned long q = 0; -bool preport = false; -bool treport = false; -bool ereport = false; -AnsiString mainroot; -bool IsMySQLNode = false; -MYSQL *MySQL; -//--------------------------------------------------------------------------- -__fastcall TForm1::TForm1(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::FormCreate(TObject *Sender) -{ - i_start = true; - IsConnect = false; - if (ParamCount() > 0){ - if (ParamStr(1) == "-h" || ParamStr(1) == "h" ) { - ShowHelp(); Application->Terminate(); } - else if (ParamStr(1) == "-w" || ParamStr(1) == "w") { - i_start = false; ContinueLoad(); } - } - else { - ContinueLoad(); Hide(); GetServerOptions(); } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::DrawItem(TMessage& Msg) -{ - IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam); - TForm::Dispatch(&Msg); -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::MyNotify(TMessage& Msg) -{ - POINT MousePos; - - switch(Msg.LParam) { - case WM_RBUTTONUP: - if (GetCursorPos(&MousePos)){ - PopupMenu1->PopupComponent = Form1; SetForegroundWindow(Handle); - PopupMenu1->Popup(MousePos.x, MousePos.y);} - else Show(); - break; - case WM_LBUTTONUP: - if (GetCursorPos(&MousePos)){ - PopupMenu1->PopupComponent = Form1; SetForegroundWindow(Handle); - PopupMenu1->Popup(MousePos.x, MousePos.y); } - - ToggleState(); - break; - default: - break; } - - TForm::Dispatch(&Msg); -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TrayMessage(DWORD dwMessage) -{ - NOTIFYICONDATA tnd; - PSTR pszTip; - - pszTip = TipText(); - - tnd.cbSize = sizeof(NOTIFYICONDATA); - tnd.hWnd = Handle; - tnd.uID = IDC_MYICON; - tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFY; - - if (dwMessage == NIM_MODIFY){ - tnd.hIcon = IconHandle(); - if (pszTip)lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip)); - else tnd.szTip[0] = '\0'; } - else { tnd.hIcon = NULL; tnd.szTip[0] = '\0'; } - - return (Shell_NotifyIcon(dwMessage, &tnd)); -} -//--------------------------------------------------------------------------- -HANDLE __fastcall TForm1::IconHandle(void) -{ - - if (!NT){ - if (MySQLSignal()){Image3->Visible = false; Image2->Visible = true; - return (Image2->Picture->Icon->Handle); } - else {Image2->Visible = false; Image3->Visible = true; - return (Image3->Picture->Icon->Handle); } - } - else { - if (TheServiceStatus()){Image3->Visible = false; Image2->Visible = true; - return (Image2->Picture->Icon->Handle); } - - else if (MySQLSignal()){Image3->Visible = false; Image2->Visible = true; - return (Image2->Picture->Icon->Handle); } - else {Image2->Visible = false; Image3->Visible = true; - return (Image3->Picture->Icon->Handle); } - } - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::ToggleState(void) -{ - - TrayMessage(NIM_MODIFY); - if (!NT){ - if (MySQLSignal()){SSW9->Caption = "ShutDown the Server"; - Image3->Visible = false; Image2->Visible = true; } - else {SSW9->Caption = "Start the Server"; - Image2->Visible = false; Image3->Visible = true; } - } - else { - if (TheServiceStart()) { - Standa->Enabled = false; - if (TheServiceStatus()) {RService->Enabled = false; - StopS->Enabled = true; - StopS->Caption = "Stop the Service"; - Image3->Visible = false; - Image2->Visible = true; } - else {RService->Enabled = true; - StopS->Enabled = true; - RService->Caption = "Remove the Service"; - StopS->Caption = "Start the Service"; - Image2->Visible = false; - Image3->Visible = true; } - } - else { - Standa->Enabled = true; - StopS->Enabled = false; - if (MySQLSignal()) { - RService->Enabled = false; - Standa->Caption = "ShutDown the Server Standalone"; - Image3->Visible = false; - Image2->Visible = true; } - - else { - RService->Enabled = true; - RService->Caption = "Install the Service"; - Standa->Caption = "Start the Server Standalone"; - Image2->Visible = false; - Image3->Visible = true; } - - } - - - } - -} -//--------------------------------------------------------------------------- -PSTR __fastcall TForm1::TipText(void) -{ - char* status = StatusLine->SimpleText.c_str(); - return status; - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::WMQueryEndSession(TWMQueryEndSession &msg) -{ - - - if (!NT) { - - if (MySQLSignal()){ - StatusLine->SimpleText = "Shutdown in progress....."; - Show(); Shutd(); msg.Result = 1; } - else { - StatusLine->SimpleText = "The Server already is down......"; - Show(); msg.Result = 1; Close(); } - } - else { - - Show(); - if (!TheServiceStart()) { if (MySQLSignal()) Shutd(); } - msg.Result = 1; - } - -} - -//--------------------------------------------------------------------------- -LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi) -{ - HICON hIcon; - - hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON, - 16, 16, 0); - if (!hIcon) - return(false); - - DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon, - 16, 16, 0, NULL, DI_NORMAL); - - return(true); -} -//--------------------------------------------------------------------------- -AnsiString __fastcall TForm1::TheComputer() -{ - AnsiString theword; - DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; - char szBuf[MAX_COMPUTERNAME_LENGTH + 1]; - szBuf[0] = '\0'; - - GetComputerName(szBuf, &dwSize); - theword = (AnsiString) szBuf; - delete [] szBuf; - return theword; - -} -//--------------------------------------------------------------------------- -AnsiString __fastcall TForm1::TheOS() -{ - AnsiString theword; - OSVERSIONINFO info; - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&info); - - switch (info.dwPlatformId) - { - case VER_PLATFORM_WIN32s: - NT = false; - theword = "Win32s detected"; - break; - case VER_PLATFORM_WIN32_WINDOWS: - NT = false; - theword = "Win 95 or Win 98 detected"; - break; - case VER_PLATFORM_WIN32_NT: - NT = true; - theword = "Windows NT detected"; - break; - } - return theword; -} -///--------------------------------------------------------------------------- -AnsiString __fastcall TForm1::TheUser() -{ - AnsiString theword; - DWORD dwSize = 0; - - GetUserName(NULL, &dwSize); - - char *szBuf = new char[dwSize]; - szBuf[0] = '\0'; - - GetUserName(szBuf, &dwSize); - theword = (AnsiString) szBuf; - delete [] szBuf; - return theword; - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::TakeIP(void) -{ - WORD wVersionRequested; - WSADATA WSAData; - wVersionRequested = MAKEWORD(1,1); - WSAStartup(wVersionRequested,&WSAData); - - hostent *P; - char s[128]; - in_addr in; - char *P2; - gethostname(s, 128); - P = gethostbyname(s); - - Memo2->Lines->Clear(); - Memo2->Lines->Add((AnsiString)P->h_name); - mainroot = P->h_name; - in.S_un.S_un_b.s_b1 = P->h_addr_list[0][0]; - in.S_un.S_un_b.s_b2 = P->h_addr_list[0][1]; - in.S_un.S_un_b.s_b3 = P->h_addr_list[0][2]; - in.S_un.S_un_b.s_b4 = P->h_addr_list[0][3]; - P2 = inet_ntoa(in); - vip = P2; - mainroot += " ( " + (AnsiString)P2 + " )"; - Memo2->Lines->Add(P2); - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetmemStatus(void) -{ - MEMORYSTATUS ms; - ms.dwLength = sizeof(MEMORYSTATUS); - GlobalMemoryStatus(&ms); - - Edit2->Text = AnsiString((double)ms.dwTotalPhys / 1024000.0) + " MB RAM"; -} - -//--------------------------------------------------------------------------- -void __fastcall TForm1::ShowHelp(void) -{ - Application->MessageBox("Usage: WinMySQLadmin.EXE [OPTIONS]\n\n-w Run the tool without start the Server.\n-h Shows this message and exit ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::ContinueLoad(void) -{ - OS->Text = TheOS(); - Localhost->Text = TheComputer(); - Localuser->Text = TheUser(); - GetmemStatus(); - ClearBox(); - TakeIP(); - MyODBC(); - - - IsMyIniUp(); - - if (!NT) { WinNT->Enabled = false; NtVer->Enabled = false; Win9->Enabled = true; } - else { WinNT->Enabled = true; Win9->Enabled = false; } - - if (i_start) - { - // NT never is started from the prompt - if ((!NT) && (!MySQLSignal())) mysqldstart(); - { - TrayMessage(NIM_MODIFY); - SeekErrFile(); - } - } - Hide(); - -} - -//--------------------------------------------------------------------------- -void __fastcall TForm1::MyODBC(void) -{ - - TRegistry *Registry = new TRegistry(); - Memo3->Lines->Clear(); - - try - { - Registry->RootKey = HKEY_LOCAL_MACHINE; - // the basic data of myodbc - if (Registry->OpenKey("Software\\ODBC\\ODBCINST.INI\\MySQL", false)) - { - Memo3->Lines->Add("Driver Version\t" + Registry->ReadString("DriverODBCVer")); - Memo3->Lines->Add("Driver\t\t" + Registry->ReadString("Driver")); - Memo3->Lines->Add("API Level\t\t" + Registry->ReadString("APILevel")); - Memo3->Lines->Add("Setup\t\t" + Registry->ReadString("Setup")); - Memo3->Lines->Add("SQL Level\t" + Registry->ReadString("SQLLevel")); - } - else - Memo3->Lines->Add("Not Found"); - - } - catch (...) - { - delete Registry; - } - Memo3->Enabled = false; -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::IsMyIniUp(void) -{ - // we see if the my.ini is Up - AnsiString asFileName = FileSearch("my.ini", TheWinDir()); - if (asFileName.IsEmpty()) - { - IsForce = true; - i_start = false; - QuickSearch(); - } - else - { - Memo1->Enabled = true; - Memo1->Lines->Clear(); - FillMyIni(); - GetBaseDir(); - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::QuickSearch(void) -{ - AnsiString asFileName = FileSearch("mysql.exe", "c:/mysql/bin"); - if (!asFileName.IsEmpty()) - BaseDir->Text = "c:/mysql"; -} -//--------------------------------------------------------------------------- -AnsiString __fastcall TForm1::TheWinDir() -{ - AnsiString WinDir; - UINT BufferSize = GetWindowsDirectory(NULL,0); - WinDir.SetLength(BufferSize+1); - GetWindowsDirectory(WinDir.c_str(),BufferSize); - char* dirw = WinDir.c_str(); - return dirw ; - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::FillMyIni(void) -{ - Memo1->Lines->LoadFromFile(TheWinDir() + "\\my.ini"); - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetBaseDir(void) -{ - - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char file[_MAX_FNAME]; - char ext[_MAX_EXT]; - - - TIniFile *pIniFile = new - TIniFile(TheWinDir() + "\\my.ini"); - - BaseDir->Text = pIniFile->ReadString("mysqld","basedir","") ; - AnsiString lx = pIniFile->ReadString("WinMySQLadmin","Server","") ; - _splitpath((lx).c_str(),drive,dir,file,ext); - AnsiString lw = (AnsiString) file + ext; - - if ( lw == "mysqld-shareware.exe") {ShareVer->Checked = true;} - if ( lw == "mysqld.exe") {MysqldVer->Checked = true;} - if ( lw == "mysqld-opt.exe") {OptVer->Checked = true;} - if ( lw == "mysqld-nt.exe") {NtVer->Checked = true;} - - delete pIniFile; - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::Showme1Click(TObject *Sender) -{ - if(Showme1->Caption == "Show me") { TrayMessage(NIM_DELETE); - Showme1->Caption = "Hide me"; Show(); } - else { TrayMessage(NIM_ADD); TrayMessage(NIM_MODIFY); - Showme1->Caption = "Show me"; Hide(); } -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::MySQLSignal() -{ - HANDLE hEventShutdown; - hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); - - if(hEventShutdown) - { - CloseHandle(hEventShutdown); - return true; - } - else - { - CloseHandle(hEventShutdown); - return false; - } - -} - -//--------------------------------------------------------------------------- -bool __fastcall TForm1::mysqldstart() -{ - memset(&pi, 0, sizeof(pi)); - memset(&si, 0, sizeof(si)); - si.cb = sizeof(si); - si.dwFlags |= STARTF_USESHOWWINDOW; - si.wShowWindow |= SW_SHOWNORMAL; - - - TIniFile *pIniFile = new - TIniFile(TheWinDir() + "\\my.ini"); - - if (NT) - vpath = pIniFile->ReadString("WinMySQLadmin","Server","") + " --standalone\0" ; - else - vpath = pIniFile->ReadString("WinMySQLadmin","Server","") + "\0" ; - - if ( ! CreateProcess(0,vpath.c_str(), 0, 0, 0, 0, 0, 0, &si,&pi)) - { - TrayMessage(NIM_MODIFY); - return false; - } - else - { - TrayMessage(NIM_MODIFY); - return true; - - } - -} - -//--------------------------------------------------------------------------- -bool __fastcall TForm1::SeekErrFile() -{ - Memo4->Enabled = true; - Memo4->Lines->Clear(); - AnsiString asFileName = FileSearch("mysql.err", BaseDir->Text + "/data"); - if (!asFileName.IsEmpty()) - { - FName = BaseDir->Text + "/data/mysql.err"; - ifstream in((FName).c_str()); - in.seekg(0, ios::end); - string s, line; - deque v; - deque lines; - streampos sp = in.tellg(); - if (sp <= 1000) - in.seekg(0, ios::beg); - else - { - in.seekg(0, ios::beg); - in.seekg((sp - 1000)); - } - - do { - lines.push_back(line); - }while (getline(in, line)); - - - if( lines.size() <= 15) - { - deque::reverse_iterator r; - for(r = lines.rbegin(); r != lines.rend() ; r++) - { - if (ereport) - Memo5->Lines->Add((*r).c_str()); - Memo4->Lines->Add((*r).c_str()); - - } - } - else - { - int k = 0; - deque::reverse_iterator r; - for(r = lines.rbegin(); r != lines.rend(); r++) - { - if (ereport) - Memo5->Lines->Add((*r).c_str()); - Memo4->Lines->Add((*r).c_str()); - if (++k >= 15) { break;} - } - } - in.close(); - return true; - } - else - return false; - -} - -//--------------------------------------------------------------------------- -void __fastcall TForm1::Timer1Timer(TObject *Sender) -{ - Showme1->Caption = "Show me"; - TrayMessage(NIM_ADD); - TrayMessage(NIM_MODIFY); - Hide(); - if (IsForce) {Form2->Show();} - Timer1->Enabled = false; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetServerFile() -{ - - AnsiString FileName; - - if(!NT) { - FileName = FileSearch("mysqld-opt.exe", ExtractFilePath(Application->ExeName)); - if (FileName.IsEmpty()) FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); - if (FileName.IsEmpty()) FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); - - if (!FileName.IsEmpty()){ - if ( FileName == "mysqld-opt.exe") {OptVer->Checked = true;} - if ( FileName == "mysqld.exe") {MysqldVer->Checked= true;} - if ( FileName == "mysqld-shareware.exe") {ShareVer->Checked= true;} } - - } - else { - - FileName = FileSearch("mysqld-nt.exe", ExtractFilePath(Application->ExeName)); - if (FileName.IsEmpty()) FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); - if (FileName.IsEmpty()) FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); - - if (!FileName.IsEmpty()) { - if ( FileName == "mysqld-nt.exe") {NtVer->Checked = true;} - if ( FileName == "mysqld.exe") {MysqldVer->Checked= true;} - if ( FileName == "mysqld-shareware.exe") {ShareVer->Checked= true;} } - - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::CreateMyIniFile(void) -{ - char szFileName[6]; - int iFileHandle; - AnsiString jk; - - Memo1->Enabled = true; - Memo1->Lines->Clear(); - strcpy(szFileName,"\\my.ini"); - iFileHandle = FileCreate(TheWinDir() + szFileName ); - - jk = "#This File was made using the WinMySQLadmin 1.0 Tool\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#" + Now() + "\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#Uncomment or Add only the keys that you know how works.\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#Read the MySQL Manual for instructions\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - - jk = "[mysqld]\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "basedir=" + TheDir() + "\n"; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#bind-address=" + vip + "\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#datadir=" + TheDir() + "/data\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#language=" + TheDir() + "/share/your language directory\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#delay-key-write-for-all-tables\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#log-long-format\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#slow query log=#\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#tmpdir=#\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#ansi\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#new\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#port=3306\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#safe\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#skip-name-resolve\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#skip-networking\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#skip-new\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#skip-host-cache\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable = key_buffer=16M\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable = max_allowed_packet=1M\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable = thread_stack=128K\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable = flush_time=1800\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "[mysqldump]\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#quick\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable = max_allowed_packet=16M\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "[mysql]\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#no-auto-rehash\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "[isamchk]\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "#set-variable= key=16M\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "[WinMySQLadmin]\n\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - - if (ShareVer->Checked) { jk = "Server=" + TheDir() + "/bin/mysqld-shareware.exe\n\n";} - if (MysqldVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld.exe\n\n";} - if (OptVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld-opt.exe\n\n";} - if (NtVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld-nt.exe\n\n";} - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "user=" + Form2->Edit1->Text + "\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - jk = "password=" + Form2->Edit2->Text + "\n" ; - FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); - - FileClose(iFileHandle); - FillMyIni(); - -} - -//--------------------------------------------------------------------------- -bool __fastcall TForm1::CreatingShortCut() -{ - // Where is The Start Menu in this Machine ? - LPITEMIDLIST pidl; - LPMALLOC pShellMalloc; - char szDir[MAX_PATH + 16]; - AnsiString file; - AnsiString jk = "\\WinMySQLadmin.lnk" ; - - if(SUCCEEDED(SHGetMalloc(&pShellMalloc))) - { - if(SUCCEEDED(SHGetSpecialFolderLocation(NULL, - CSIDL_STARTUP, &pidl))) - { - if(!SHGetPathFromIDList(pidl, szDir)) - { - pShellMalloc->Release(); - pShellMalloc->Free(pidl); - return false; - } - - pShellMalloc->Free(pidl); - } - - pShellMalloc->Release(); - StrCat(szDir, jk.c_str()); - } - - // the create - - IShellLink* pLink; - IPersistFile* pPersistFile; - - if(SUCCEEDED(CoInitialize(NULL))) - { - if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, - CLSCTX_INPROC_SERVER, - IID_IShellLink, (void **) &pLink))) - { - - pLink->SetPath((ExtractFilePath(Application->ExeName) + "WinMySQLadmin.exe").c_str()); - pLink->SetDescription("WinMySQLadmin Tool"); - pLink->SetShowCmd(SW_SHOW); - - if(SUCCEEDED(pLink->QueryInterface(IID_IPersistFile, - (void **)&pPersistFile))) - { - - WideString strShortCutLocation(szDir); - pPersistFile->Save(strShortCutLocation.c_bstr(), TRUE); - pPersistFile->Release(); - } - pLink->Release(); - } - - CoUninitialize(); - } - - - return true; -} - -//--------------------------------------------------------------------------- -AnsiString __fastcall TForm1::TheDir() -{ - AnsiString buffer; - char s[_MAX_PATH + 1]; - - StrCopy(s, ( BaseDir->Text).c_str()) ; - - for (int i = 0; s[i] != NULL; i++) - if (s[i] != '\\') - buffer += s[i]; - else - buffer += "/"; - - return buffer; - -} - -//--------------------------------------------------------------------------- -void __fastcall TForm1::SpeedButton1Click(TObject *Sender) -{ - Application->HelpCommand(HELP_FINDER,0); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Timer2Timer(TObject *Sender) -{ - ToggleState(); - -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServiceStart() -{ - bool thatok; - char *SERVICE_NAME = "MySql"; - SC_HANDLE myService, scm; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS | GENERIC_WRITE); - if (scm) - { - myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); - if (myService) - thatok = true; - else - thatok = false; - } - CloseServiceHandle(myService); - CloseServiceHandle(scm); - return thatok; -} - -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServicePause() -{ - - bool thatok; - char *SERVICE_NAME = "MySql"; - SC_HANDLE myService, scm; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); - - if (scm) - { - myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); - if (myService) - { - // stop the service - if (IsConnect) - { - mysql_kill(MySQL,mysql_thread_id(MySQL)); - StatusLine->SimpleText = ""; - q = 0; - } - - - SERVICE_STATUS ss; - thatok = ControlService(myService, - SERVICE_CONTROL_STOP, - &ss); - - } - else - thatok = false; - } - else - thatok = false; - - CloseServiceHandle(myService); - CloseServiceHandle(scm); - return thatok; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServiceResume() -{ - - bool thatok; - char *SERVICE_NAME = "MySql"; - SC_HANDLE myService, scm; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); - - if (scm) - { - myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); - if (myService) - { - // start the service - - thatok = StartService(myService, 0, NULL); - } - else - thatok = false; - } - else - thatok = false; - - CloseServiceHandle(myService); - CloseServiceHandle(scm); - return thatok; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServiceStatus() -{ - bool thatok; - bool k; - char *SERVICE_NAME = "MySql"; - SC_HANDLE myService, scm; - SERVICE_STATUS ss; - DWORD dwState = 0xFFFFFFFF; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); - - if (scm) - { - myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); - if (myService) - { - memset(&ss, 0, sizeof(ss)); - k = QueryServiceStatus(myService,&ss); - if (k) - { - dwState = ss.dwCurrentState; - if (dwState == SERVICE_RUNNING) - thatok = true; - } - else - thatok = false; - } - else - thatok = false; - } - else - thatok = false; - - CloseServiceHandle(myService); - CloseServiceHandle(scm); - return thatok; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServiceCreate() - -{ - bool thatok; - char *SERVICE_NAME = "MySql"; - char *szFullPath = vpath.c_str(); - SC_HANDLE myService, scm; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); - - if (scm) - { myService = CreateService( - scm, - SERVICE_NAME, - SERVICE_NAME, - SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, - SERVICE_AUTO_START , - SERVICE_ERROR_NORMAL, - szFullPath, - NULL, - NULL, - NULL, - NULL, - NULL); - - if (myService) - thatok = true; - else - thatok = false; - - } - - CloseServiceHandle(myService); - CloseServiceHandle(scm); - return thatok; - -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Swin9Click(TObject *Sender) -{ - if(Application->MessageBox("Shutdown this tool", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - Close(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SSW9Click(TObject *Sender) -{ - if (MySQLSignal()) - { - if(Application->MessageBox("Shutdown the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - - if (Shutd()) - { - IsConnect = false; - IsVariables = false; - IsProcess = false; - IsDatabases = false; - ya = false; - ClearBox(); - Sleep(500); - TrayMessage(NIM_MODIFY); - - } - else - Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } - else - { - if(Application->MessageBox("Start the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (mysqldstart()) - { - TrayMessage(NIM_MODIFY); - ya = true; - } - else - Application->MessageBox("Fails to Start the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - - } - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::ShutDownBoth1Click(TObject *Sender) -{ - if (MySQLSignal()) - { - if(Application->MessageBox("Shutdown the MySQL Server and this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - - if (Shutd()) - Close(); - else - { - Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - - } - } - } - else - if(Application->MessageBox("Shutdown this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - Close(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::ShutDownthisTool1Click(TObject *Sender) -{ - if(Application->MessageBox("Shutdown this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - Close(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::StopSClick(TObject *Sender) -{ - AnsiString theWarning; - theWarning = "Are you sure to stop the Service ?\n\nAll the connections will be loss !" ; - if (TheServiceStatus()) - { - if(Application->MessageBox(theWarning.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (TheServicePause()) - { - TrayMessage(NIM_MODIFY); - IsConnect = false; - IsVariables = false; - IsProcess = false; - IsDatabases = false; - ya = false; - ClearBox(); - - } - else - Application->MessageBox("Fails to stop the Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - - } - } - else - { - if(Application->MessageBox("Start the Service Manager for the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (TheServiceResume()) - { - ya = true; - TrayMessage(NIM_MODIFY); - } - else - Application->MessageBox("Fails to start the Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::RServiceClick(TObject *Sender) -{ - if (TheServiceStart()) - { - if(Application->MessageBox("Remove the MySQL Server service ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (!TheServiceRemove()) - Application->MessageBox("Fails to Remove The MySQL Server Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } - else - { - if(Application->MessageBox("Install the MySQL Server service ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (!TheServerPath()) - Application->MessageBox("Please create first the my.ini setup", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - else - { - if (!TheServiceCreate()) - Application->MessageBox("Fails to Install The MySQL Server Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - - } - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::StandaClick(TObject *Sender) -{ - if (MySQLSignal()) - { - if(Application->MessageBox("Shutdown the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (Shutd()) - { - IsConnect = false; - IsVariables = false; - IsProcess = false; - IsDatabases = false; - ya = false; - ClearBox(); - Sleep(500); - TrayMessage(NIM_MODIFY); - - } - else - Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } - else - { - if(Application->MessageBox("Start the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (mysqldstart()) - { - StatusLine->SimpleText = ""; - TrayMessage(NIM_MODIFY); - - } - else - Application->MessageBox("Fails to Start the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::Shutd() -{ - // from Irena - HANDLE hEventShutdown; - hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); - - if (IsConnect) - { - mysql_kill(MySQL,mysql_thread_id(MySQL)); - mysql_shutdown(MySQL, SHUTDOWN_DEFAULT); - StatusLine->SimpleText = ""; - - } - - q = 0; - - - if(hEventShutdown) - { - SetEvent(hEventShutdown); - CloseHandle(hEventShutdown); - TrayMessage(NIM_MODIFY); - IsConnect = false; - return true; - } - else - { - TrayMessage(NIM_MODIFY); - return false; - } - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::ClearBox(void) -{ - - st22->Text = ""; - st23->Text = ""; - st24->Text = ""; - st25->Text = ""; - st26->Text = ""; - st27->Text = ""; - st28->Text = ""; - st29->Text = ""; - Edit3->Text = ""; - Edit4->Text = ""; - Edit5->Text = ""; - Edit6->Text = ""; - -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServiceRemove() -{ - bool thatok; - char *SERVICE_NAME = "MySql"; - SC_HANDLE myService, scm; - scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); - if (scm) - { - myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); - if (myService) - { - if(DeleteService(myService)) - { - CloseServiceHandle(myService); - CloseServiceHandle(scm); - thatok = true; - } - else - { - CloseServiceHandle(myService); - CloseServiceHandle(scm); - thatok = false; - } - - } - else - { - CloseServiceHandle(myService); - CloseServiceHandle(scm); - thatok = false; - } - } - else - { - thatok = false; - CloseServiceHandle(scm); - } - - return thatok; - -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::TheServerPath() -{ - - TIniFile *pIniFile = new - TIniFile(TheWinDir() + "\\my.ini"); - - vpath = pIniFile->ReadString("WinMySQLadmin","Server","") ; - delete pIniFile; - if (vpath.IsEmpty()) - return false; - else - return true; - -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button5Click(TObject *Sender) -{ - if (!SeekErrFile()) - Application->MessageBox("Fails to find mysql.err", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::IsMySQLInit(void) -{ - AnsiString theCommand; - char *host = NULL,*password=0,*user=0 ; - TIniFile *pIniFile = new - TIniFile(TheWinDir() + "\\my.ini"); - - AnsiString MyUser = pIniFile->ReadString("WinMySQLadmin","user","") ; - AnsiString MyPass = pIniFile->ReadString("WinMySQLadmin","password","") ; - - delete pIniFile; - - - if (!MyUser.IsEmpty() && MyUser.Length() && !MyPass.IsEmpty() && MyPass.Length()) - { - if (!IsConnect) - { - - MySQL = mysql_init(MySQL); - if (mysql_real_connect(MySQL, "localhost",(MyUser).c_str(), (MyPass).c_str() , 0, 0, NULL, 0)) - IsConnect = true; - else - { - if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0)) - { - IsConnect = true; - theCommand = "GRANT ALL PRIVILEGES ON *.* TO "; - theCommand += "'" + MyUser + "' @localhost IDENTIFIED BY "; - theCommand += "'" + MyPass + "' with GRANT OPTION"; - char* los = theCommand.c_str(); - if(!mysql_query(MySQL, los )) - StatusLine->SimpleText = " "; - } - - } - MySQL->reconnect= 1; - - } - - } - else - { - if (!IsConnect) - { - MySQL = mysql_init(MySQL); - if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0)) - IsConnect = true; - MySQL->reconnect= 1; - } - } -} - -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Timer3Timer(TObject *Sender) -{ - if ((NT) && TheServiceStatus()) {IsMySQLInit(); } - - if ((NT) && !TheServiceStatus() && MySQLSignal()) {IsMySQLInit(); } - - if (!(NT) && MySQLSignal()) {IsMySQLInit(); } - - if (IsConnect) - { - GetServerStatus(); - if (!IsMySQLNode) - GetMainRoot(); - Extended->Enabled = true; - if (!IsProcess && !GetProcess()) - StatusLine->SimpleText = ""; - if (!IsVariables && !GetVariables()) - StatusLine->SimpleText = ""; - Timer3->Interval = 10000; - } - else - Extended->Enabled = false; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetServerStatus(void) -{ - - GetExtendedStatus(); - Edit3->Text = mysql_get_server_info(MySQL); - Edit4->Text = mysql_get_host_info(MySQL); - Edit5->Text = mysql_get_client_info(); - Edit6->Text = mysql_get_proto_info(MySQL); - - -} - -//--------------------------------------------------------------------------- -bool __fastcall TForm1::GetProcess() -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - int k = 0; - int therow = 1; - new_line=1; - - StringGrid2->RowCount= 2; - - if (!(res=mysql_list_processes(MySQL))) - { - return false; - } - - while ((row=mysql_fetch_row(res)) != 0) - { - mysql_field_seek(res,0); - StringGrid2->Cells[0][0] = "PID"; - StringGrid2->Cells[1][0] = "User"; - StringGrid2->Cells[2][0] = "Host"; - StringGrid2->Cells[3][0] = "DB"; - StringGrid2->Cells[4][0] = "Command"; - StringGrid2->Cells[5][0] = "Time"; - StringGrid2->Cells[6][0] = "State"; - StringGrid2->Cells[7][0] = "Info"; - for (i=0 ; i < mysql_num_fields(res); i++) - { - - if (k <= 6 ) - { - StringGrid2->Cells[k][therow] = row[i]; - k++; - } - else - { - - StringGrid2->Cells[(k)][therow] = row[i]; - k = 0; - therow++ ; - StringGrid2->RowCount++; - - } - - } - - } - - StringGrid2->RowCount--; - mysql_free_result(res); - StringGrid5->RowCount--; - IsProcess = true; - return true; - -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::GetVariables() -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - int k = 1; - new_line=1; - bool left = true; - AnsiString report; - StringGrid1->RowCount = 2; - if (mysql_query(MySQL,"show variables") || - !(res=mysql_store_result(MySQL))) - { - return false; - } - - while ((row=mysql_fetch_row(res)) != 0) - { - mysql_field_seek(res,0); - - StringGrid1->Cells[0][0] = "Variable Name"; - StringGrid1->Cells[1][0] = "Value"; - - - for (i=0 ; i < mysql_num_fields(res); i++) - { - - if (left) - { - if (treport) - report = GetString(row[i]); - StringGrid1->Cells[0][k++] = row[i]; - left = false; - } - else - { - if (treport) - Memo5->Lines->Add(report + row[i]); - StringGrid1->RowCount++; - StringGrid1->Cells[1][--k] = row[i]; - k++; - left = true; - } - - } - - } - - StringGrid1->RowCount--; - mysql_free_result(res); - IsVariables = true; - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::nice_time(AnsiString buff) -{ - - unsigned long sec; - unsigned long tmp; - AnsiString mytime; - - sec = StrToInt(buff); - - if (sec >= 3600L*24) - { - tmp=sec/(3600L*24); - sec-=3600L*24*tmp; - - mytime = IntToStr(tmp); - if (tmp > 1) - mytime+= " days "; - else - mytime+= " day "; - - } - - if (sec >= 3600L) - { - tmp=sec/3600L; - sec-=3600L*tmp; - mytime += IntToStr(tmp); - if (tmp > 1) - mytime+= " hours "; - else - mytime+= " hour "; - } - if (sec >= 60) - { - tmp=sec/60; - sec-=60*tmp; - mytime += IntToStr(tmp); - mytime+= " min "; - - } - mytime += IntToStr(sec); - mytime+= " sec "; - st29->Text = mytime ; - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::Button11Click(TObject *Sender) -{ - if (IsConnect) - { - if (GetVariables()) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button10Click(TObject *Sender) -{ - if (IsConnect) - { - if (GetProcess()) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button6Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_HOSTS)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button7Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_LOG)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button8Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_TABLES)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button2Click(TObject *Sender) -{ - Memo1->Enabled = true; - Memo1->Lines->Clear(); - AnsiString asFileName = FileSearch("my.ini", TheWinDir()); - if (asFileName.IsEmpty()) - Application->MessageBox("Don't found my.ini file on the Win Directory", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - else - FillMyIni(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button3Click(TObject *Sender) -{ - TIniFile *pIniFile = new - TIniFile(TheWinDir() + "\\my.ini"); - - if (!Memo1->GetTextLen()) - Application->MessageBox("The Memo Box is Empty", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - else - { - if(Application->MessageBox("Are you sure to write the modifications into My.ini file.", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - Memo1->Lines->SaveToFile(TheWinDir() + "\\my.ini"); - - Memo1->Lines->Clear(); - Memo1->Enabled = true; - Memo1->Lines->Clear(); - if (NtVer->Checked) - pIniFile->WriteString("WinMySQLadmin","Server",TheDir() + "/bin/mysqld-nt.exe"); - if (MysqldVer->Checked == true) - pIniFile->WriteString("WinMySQLadmin","Server", TheDir() + "/bin/mysqld.exe"); - if (ShareVer->Checked) - pIniFile->WriteString("WinMySQLadmin","Server",TheDir() + "/bin/mysqld-shareware.exe"); - if (OptVer->Checked) - pIniFile->WriteString("WinMySQLadmin","Server", TheDir() + "/bin/mysqld-opt.exe"); - FillMyIni(); - Application->MessageBox("My.ini was modificated", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - } - - } - delete pIniFile; - Memo1->Lines->Clear(); - FillMyIni(); - -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button1Click(TObject *Sender) -{ - if(CreatingShortCut()) - Application->MessageBox("The ShortCut on Start Menu was created", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); - else - Application->MessageBox("Fails the Operation of Create the ShortCut", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton2Click(TObject *Sender) -{ - BROWSEINFO info; - char szDir[MAX_PATH]; - char szDisplayName[MAX_PATH]; - LPITEMIDLIST pidl; - LPMALLOC pShellMalloc; - - - if(SHGetMalloc(&pShellMalloc) == NO_ERROR) - { - - memset(&info, 0x00,sizeof(info)); - info.hwndOwner = Handle; - info.pidlRoot = 0; - info.pszDisplayName = szDisplayName; - info.lpszTitle = "Search MySQL Base Directory"; - info.ulFlags = BIF_RETURNONLYFSDIRS; - info.lpfn = 0; - - pidl = SHBrowseForFolder(&info); - - if(pidl) - { - - if(SHGetPathFromIDList(pidl, szDir)) {BaseDir->Text = szDir; } - - pShellMalloc->Free(pidl); - } - pShellMalloc->Release(); - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::Button4Click(TObject *Sender) -{ - if (IsConnect) - { - Memo3->Lines->Add(mysql_stat(MySQL)); - } -} -//--------------------------------------------------------------------------- - - -void __fastcall TForm1::SpeedButton3Click(TObject *Sender) -{ - if(Showme1->Caption == "Show me") { TrayMessage(NIM_DELETE); - Showme1->Caption = "Hide me"; Show(); } - else { TrayMessage(NIM_ADD); TrayMessage(NIM_MODIFY); - Showme1->Caption = "Show me"; Hide(); } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::ExtendedClick(TObject *Sender) -{ -if (ya) - { - Extended->Caption = "Start Extended Server Status"; - ya = false; - ClearBox(); - } -else - { - Extended->Caption = "Stop Extended Server Status"; - ya = true; - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetServerOptions(void) -{ -AnsiString FileName; -FileName = FileSearch("mysqld-opt.exe", ExtractFilePath(Application->ExeName)); -if (FileName.IsEmpty()) {OptVer->Enabled = false; } - -FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); -if (FileName.IsEmpty()) {ShareVer->Enabled = false; } - -FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); -if (FileName.IsEmpty()) {MysqldVer->Enabled = false; } - -FileName = FileSearch("mysqld-nt.exe", ExtractFilePath(Application->ExeName)); -if (FileName.IsEmpty()) {NtVer->Enabled = false; } - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::GetReportServer(void) -{ - - AnsiString strspace; - Memo5->Lines->Clear(); - Memo5->Lines->Add("This Report was made using the WinMySQLadmin 1.0 Tool"); - Memo5->Lines->Add(""); - Memo5->Lines->Add(Now()); - Memo5->Lines->Add(""); - - preport = true; - Memo5->Lines->Add(""); - Memo5->Lines->Add("Server Status Values"); - Memo5->Lines->Add(""); - Memo5->Lines->Add(GetString("Server Info") + mysql_get_server_info(MySQL)); - Memo5->Lines->Add(GetString("Host Info") + mysql_get_host_info(MySQL)); - Memo5->Lines->Add(GetString("Client Info") + mysql_get_client_info()); - Memo5->Lines->Add(GetString("Proto Info") + mysql_get_proto_info(MySQL)); - GetExtendedStatus(); - preport = false; - treport = true; - Memo5->Lines->Add(""); - Memo5->Lines->Add("Variables Values"); - Memo5->Lines->Add(""); - GetVariables(); - treport = false; - ereport = true; - Memo5->Lines->Add(""); - Memo5->Lines->Add("Last Lines from Err File"); - Memo5->Lines->Add(""); - SeekErrFile(); - ereport = false; - -} - -void __fastcall TForm1::SpeedButton4Click(TObject *Sender) -{ - if(IsConnect) - GetReportServer(); - else - Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton5Click(TObject *Sender) -{ - AnsiString PathName; - SaveFileDialog->FileName = PathName; - if (SaveFileDialog->Execute() ){ - PathName= SaveFileDialog->FileName; - Caption = ExtractFileName(PathName); - Memo5->Lines->SaveToFile(PathName); - Memo5->Modified = false; - } -} -//--------------------------------------------------------------------------- -String __fastcall TForm1::GetString(String k) -{ - int i = 35 - k.Length(); - for (int y = 1 ; y <= i ;y++ ) - k+= " "; - return k ; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::SpeedButton6Click(TObject *Sender) -{ - PrinterSetupDialog1->Execute(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton7Click(TObject *Sender) -{ - AnsiString PathName; - if (PrintDialog1->Execute()){ - try { - Memo5->Print(PathName); - } - catch(...){ - Printer()->EndDoc(); - throw; - } - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton8Click(TObject *Sender) -{ - Memo5->CutToClipboard(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton9Click(TObject *Sender) -{ - Memo5->CopyToClipboard(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton10Click(TObject *Sender) -{ - - Memo5->PasteFromClipboard(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton11Click(TObject *Sender) -{ - Memo5->ClearSelection(); -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::SpeedButton12Click(TObject *Sender) -{ - Memo5->SelectAll(); -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::GetMainRoot() -{ - - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - AnsiString command; - - CleanGrid(); - CleanGridI(); - TakeIP(); - - MySQLNode = DBView->Items->Add(NULL, mainroot.UpperCase()); - MySQLNode->ImageIndex = 0; - - if (!(res=mysql_list_dbs(MySQL,"%"))) { return false; } - while ((row=mysql_fetch_row(res)) != 0) { - mysql_field_seek(res,0); - - for (i=0 ; i < mysql_num_fields(res); i++) - { - MySQLDbs = DBView->Items->AddChild(MySQLNode, row[i]); - MySQLDbs->ImageIndex = 1; - MySQLDbs->SelectedIndex = 1; - - - } - - } - - mysql_free_result(res); - MySQLNode->Expanded = true; - - - - - IsMySQLNode = true; - return true; - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::DeleteDatabaseSClick(TObject *Sender) -{ - AnsiString alert; - if (IsConnect) - { - if(DBView->Selected == MySQLNode ) - Application->MessageBox("Invalid database row selected.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - else if ( DBView->Selected == NULL ) - Application->MessageBox("Invalid database row selected.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - else - { - if (DBView->Selected->Text.UpperCase() == "MYSQL") - Application->MessageBox("You cann't use this tool to drop the MySQL Database.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - else { - alert = "Are you sure to drop the < "; - alert+= DBView->Selected->Text.c_str(); - alert+= " > database."; - if(Application->MessageBox(alert.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - char* lese = DBView->Selected->Text.c_str(); - if (!mysql_drop_db(MySQL, lese )) - { - DBView->Items->Clear(); - GetMainRoot(); - } - else - Application->MessageBox("Fails to drop the Database.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - } - } - } - } - else - Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); -} -//--------------------------------------------------------------------------- - bool __fastcall TForm1::IsDatabase(String Name) -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - AnsiString command; - - - CleanTree(); - command = "use "; - command+= Name.c_str(); - char* das = command.c_str(); - char* lis = Name.c_str(); - if (mysql_query(MySQL, das ) || - !(res=mysql_list_tables(MySQL,"%"))) - return false; - - MySQLNodeT = TableView->Items->Add(NULL, lis); - MySQLNodeT->ImageIndex = 1; - MySQLNodeT->SelectedIndex = 1; - while ((row=mysql_fetch_row(res)) != 0) { - mysql_field_seek(res,0); - - for (i=0 ; i < mysql_num_fields(res); i++) - { - - MySQLTbs = TableView->Items->AddChild(MySQLNodeT, row[i]); - MySQLTbs->ImageIndex = 2; - MySQLTbs->SelectedIndex = 2; - } - MySQLNodeT->Expanded = true; - } - mysql_free_result(res); - return true; -} -//--------------------------------------------------------------------------- - - -void __fastcall TForm1::DBViewClick(TObject *Sender) -{ - - if (IsConnect) - { - if (DBView->Selected != MySQLNode && DBView->Selected != NULL ) - { - IsDatabase(DBView->Selected->Text); - - } - else - { - CleanTree(); - } - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::TableViewClick(TObject *Sender) -{ - if (IsConnect) - { - if (DBView->Selected != MySQLNodeT ) - { - IsTable(TableView->Selected->Text); - IsIndex(TableView->Selected->Text); - - } - else - { - CleanGrid(); - CleanGridI(); - - } - } -} -//--------------------------------------------------------------------------- - bool __fastcall TForm1::IsTable(String Name) -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - int k = 0; - int therow = 1; - new_line=1; - AnsiString command; - AnsiString commandt; - - CleanGrid(); - CleanGridI(); - command = "use "; - command+= DBView->Selected->Text.c_str(); - char* las = command.c_str(); - - commandt = "desc "; - commandt+= Name.c_str(); - char* les = commandt.c_str(); - - if (mysql_query(MySQL, las )) - return false; - - if (mysql_query(MySQL, les ) || - !(res=mysql_store_result(MySQL))) - return false ; - - StringGrid4->Cells[0][0] = "Field"; - StringGrid4->Cells[1][0] = "Type"; - StringGrid4->Cells[2][0] = "Null"; - StringGrid4->Cells[3][0] = "Key"; - StringGrid4->Cells[4][0] = "Default"; - StringGrid4->Cells[5][0] = "Extra"; - StringGrid4->Cells[6][0] = "Previleges"; - - - int thecounter; - String u = GetNumberServer(); - if ( u == "3.22") - { - StringGrid3->ColCount = 7; - thecounter = 4; - } - else - thecounter = 5; - - while ((row=mysql_fetch_row(res)) != 0) - { - mysql_field_seek(res,0); - - for (i=0 ; i < mysql_num_fields(res); i++) - { - if (k <= thecounter ) - { - StringGrid4->Cells[k][therow] = row[i]; - k++; - } - else - { - StringGrid4->Cells[(k)][therow] = row[i]; - k = 0; - therow++ ; - StringGrid4->RowCount++; - } - } - - } - StringGrid4->RowCount--; - mysql_free_result(res); - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::TableViewChange(TObject *Sender, TTreeNode *Node) -{ -if (IsConnect) - { - if (DBView->Selected != MySQLNodeT ) - { - IsTable(TableView->Selected->Text); - IsIndex(TableView->Selected->Text); - - } - else - { - CleanGrid(); - CleanGridI(); - - } - } -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::DBViewChange(TObject *Sender, TTreeNode *Node) -{ - if (IsConnect) - { - if (DBView->Selected != MySQLNode ) - { - IsDatabase(DBView->Selected->Text); - - } - else - { - CleanTree(); - } - } - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::RefreshSClick(TObject *Sender) -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - AnsiString command; - - if (IsConnect) - { - IsMySQLNode = false; - CleanTree(); - DBView->Items->Clear(); - - TakeIP(); - - MySQLNode = DBView->Items->Add(NULL, mainroot.UpperCase()); - MySQLNode->ImageIndex = 0; - - if (!(res=mysql_list_dbs(MySQL,"%"))) { /*do nothing;*/ } - while ((row=mysql_fetch_row(res)) != 0) { - mysql_field_seek(res,0); - - for (i=0 ; i < mysql_num_fields(res); i++) - { - MySQLDbs = DBView->Items->AddChild(MySQLNode, row[i]); - MySQLDbs->ImageIndex = 1; - MySQLDbs->SelectedIndex = 1; - - } - - } - - mysql_free_result(res); - - IsMySQLNode = true; - - MySQLNode->Expanded = true; - - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::CreateDatabaseSClick(TObject *Sender) -{ - - if (IsConnect) - { - dbfrm->Show(); - - } - else - ShowMessage("Precisa estar conectado"); -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::CleanTree(void) -{ - StringGrid4->RowCount= 2; - StringGrid4->Cells[0][1] = ""; - StringGrid4->Cells[1][1] = ""; - StringGrid4->Cells[2][1] = ""; - StringGrid4->Cells[3][1] = ""; - StringGrid4->Cells[4][1] = ""; - StringGrid4->Cells[5][1] = ""; - TableView->Items->Clear(); - -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::CleanGrid(void) -{ - StringGrid4->RowCount= 2; - StringGrid4->Cells[0][1] = ""; - StringGrid4->Cells[1][1] = ""; - StringGrid4->Cells[2][1] = ""; - StringGrid4->Cells[3][1] = ""; - StringGrid4->Cells[4][1] = ""; - StringGrid4->Cells[5][1] = ""; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::CreatingDB() -{ - - if (mysql_create_db(MySQL, dbfrm->Edit1->Text.c_str())) - return true; - else - return false; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::OutRefresh(void) -{ - RefreshSClick(dbfrm->SpeedButton1); -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::FlushHosts1Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_HOSTS)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::FlushLogs1Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_LOG)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - -void __fastcall TForm1::FlushTables1Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_TABLES)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- - bool __fastcall TForm1::IsIndex(String Name) -{ - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - int k = 0; - int therow = 1; - new_line=1; - AnsiString command; - AnsiString commandt; - i = 0; - CleanGridI(); - command = "use "; - command+= DBView->Selected->Text.c_str(); - char* las = command.c_str(); - - commandt = "show index from "; - commandt+= Name.c_str(); - char* les = commandt.c_str(); - - if (mysql_query(MySQL, las )) - return false; - - if (mysql_query(MySQL, les ) || - !(res=mysql_store_result(MySQL))) - return false ; - - StringGrid3->RowCount= 2; - StringGrid3->Cells[0][0] = "Table"; - StringGrid3->Cells[1][0] = "Non_unique"; - StringGrid3->Cells[2][0] = "Key_name"; - StringGrid3->Cells[3][0] = "Seq_in_index"; - StringGrid3->Cells[4][0] = "Col_name"; - StringGrid3->Cells[5][0] = "Collation"; - StringGrid3->Cells[6][0] = "Card."; - StringGrid3->Cells[7][0] = "Sub_part"; - StringGrid3->Cells[8][0] = "Packed"; - StringGrid3->Cells[9][0] = "Comment"; - - int thecounter; - String u = GetNumberServer(); - - if ( u == "3.22") - { - StringGrid3->ColCount = 8; - thecounter = 6; - } - else - thecounter = 8; - while ((row=mysql_fetch_row(res)) != 0) - { - mysql_field_seek(res,0); - - for (i=0 ; i < mysql_num_fields(res); i++) - { - if (k <= thecounter ) - { - StringGrid3->Cells[k][therow] = row[i]; - k++; - } - else - { - StringGrid3->Cells[(k)][therow] = row[i]; - k = 0; - therow++ ; - StringGrid3->RowCount++; - } - } - - } - if (i) - StringGrid3->RowCount--; - mysql_free_result(res); - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::CleanGridI(void) -{ - StringGrid3->RowCount= 2; - StringGrid3->Cells[0][1] = ""; - StringGrid3->Cells[1][1] = ""; - StringGrid3->Cells[2][1] = ""; - StringGrid3->Cells[3][1] = ""; - StringGrid3->Cells[4][1] = ""; - StringGrid3->Cells[5][1] = ""; - StringGrid3->Cells[6][1] = ""; - StringGrid3->Cells[7][1] = ""; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::CreatingTable(String TheTable) -{ - - if (!mysql_query(MySQL, TheTable.c_str())) - return true; - else - return false; -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::GetExtendedStatus() -{ - if (!ya && !preport) - return true; - - MYSQL_RES *res; - MYSQL_ROW row; - unsigned int i; - int k = 1; - new_line=1; - bool left = true; - bool open_tables = false; - bool open_files = false; - bool uptime = false; - bool running_threads = false; - bool open_streams = false; - bool slow_queries = false; - bool opened_tables = false; - bool questions = false; - - AnsiString report; - if (yy) - StringGrid5->RowCount = 2; - - if (mysql_query(MySQL,"show status") || - !(res=mysql_store_result(MySQL))) - { - return false; - } - - while ((row=mysql_fetch_row(res)) != 0) - { - mysql_field_seek(res,0); - - StringGrid5->Cells[0][0] = "Variable Name"; - StringGrid5->Cells[1][0] = "Value"; - - - for (i=0 ; i < mysql_num_fields(res); i++) - { - - if (left) - { - if (preport) - report = GetString(row[i]); - if ( (String) row[i] == "Open_tables") - open_tables = true; - else - open_tables = false; - if ( (String) row[i] == "Open_files") - open_files = true; - else - open_files = false; - if ((String) row[i] == "Uptime") - uptime = true; - else - uptime = false; - - if ( (String) row[i] == "Opened_tables") - opened_tables = true; - else - opened_tables = false; - - if ( (String) row[i] == "Threads_running" || (String) row[i] == "Running_threads") - running_threads = true; - else - running_threads = false; - - if ( (String) row[i] == "Open_streams") - open_streams = true; - else - open_streams = false; - - if ( (String) row[i] == "Slow_queries") - slow_queries = true; - else - slow_queries = false; - - if ( (String) row[i] == "Questions") - questions = true; - else - questions = false; - - if (yy) - StringGrid5->Cells[0][k++] = row[i]; - - left = false; - } - else - { - if (preport) - Memo5->Lines->Add(report + row[i]); - if (open_tables) - st22->Text = row[i]; - if (open_files) - st23->Text = row[i]; - if (uptime) - nice_time(row[i]); - if (running_threads) - st27->Text = row[i]; - if (open_streams) - st24->Text = row[i]; - if (slow_queries) - st28->Text = row[i]; - if (opened_tables) - st25->Text = row[i]; - if (questions){ - q++; - st26->Text = StrToInt64(row[i]) - q; } - - if (yy){ - StringGrid5->RowCount++; - StringGrid5->Cells[1][--k] = row[i]; - k++; } - - left = true; - } - - } - - } - - - if (rinit) - StringGrid5->RowCount--; - mysql_free_result(res); - yy = false; - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TForm1::SpeedButton13Click(TObject *Sender) -{ - yy = true; - // rinit = true; -} -//--------------------------------------------------------------------------- -String __fastcall TForm1::GetNumberServer() -{ - String TheVersion; - - TheVersion = mysql_get_server_info(MySQL) ; - TheVersion.SetLength(4); - return TheVersion; - - -} - -//--------------------------------------------------------------------------- -void __fastcall TForm1::KillProcess1Click(TObject *Sender) -{ - - if (IsConnect) - KillPID(); - else - Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); -} -//--------------------------------------------------------------------------- -bool __fastcall TForm1::KillPID() -{ - String s = "Are you sure to kill the process PID no. "; - s+= StringGrid2->Cells[0][StringGrid2->Row]; - s+= " of the USER "; - s+= StringGrid2->Cells[1][StringGrid2->Row]; - unsigned long xx = mysql_thread_id(MySQL); - unsigned long yy = StrToInt(StringGrid2->Cells[0][StringGrid2->Row]); - if ( xx != yy) - { - if(Application->MessageBox(s.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) - { - if (!mysql_kill(MySQL,yy)) - { - GetProcess(); - return true; - } - } - } - else - { - Application->MessageBox("From here you can't kill the PID of this tool", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); - return true; - } - return true; -} -void __fastcall TForm1::FlushThreads1Click(TObject *Sender) -{ - if (IsConnect) - { - if (mysql_refresh(MySQL,REFRESH_THREADS)) - StatusLine->SimpleText = ""; - } -} -//--------------------------------------------------------------------------- - diff --git a/VC++Files/winmysqladmin/main.h b/VC++Files/winmysqladmin/main.h deleted file mode 100644 index dcb8ad60d7b..00000000000 --- a/VC++Files/winmysqladmin/main.h +++ /dev/null @@ -1,314 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef mainH -#define mainH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MYWM_NOTIFY (WM_APP+100) -#define IDC_MYICON 1006 -extern HINSTANCE g_hinst; -LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi); -//--------------------------------------------------------------------------- -class TForm1 : public TForm -{ -__published: // IDE-managed Components - TStatusBar *StatusLine; - TPanel *Panel1; - TImage *Image1; - TLabel *Label1; - TLabel *Label2; - TLabel *Label3; - TLabel *Label8; - TImage *Image3; - TImage *Image2; - TPageControl *PageControl1; - TTabSheet *TabSheet1; - TSpeedButton *SpeedButton1; - TGroupBox *GroupBox1; - TLabel *Label4; - TLabel *Label5; - TLabel *Label6; - TLabel *Label14; - TLabel *Label17; - TEdit *Localhost; - TEdit *Localuser; - TEdit *OS; - TMemo *Memo2; - TEdit *Edit2; - TGroupBox *GroupBox2; - TMemo *Memo3; - TGroupBox *GroupBox3; - TLabel *Label13; - TLabel *Label15; - TLabel *Label16; - TLabel *Label7; - TLabel *Label47; - TLabel *Label44; - TLabel *Label42; - TLabel *Label45; - TEdit *Edit3; - TEdit *Edit4; - TEdit *Edit5; - TEdit *Edit6; - TEdit *st29; - TEdit *st27; - TEdit *st25; - TEdit *st28; - TTabSheet *TabSheet2; - TTabSheet *TabSheet3; - TLabel *Label18; - TSpeedButton *SpeedButton2; - TEdit *BaseDir; - TMemo *Memo1; - TRadioGroup *RadioGroup1; - TRadioButton *ShareVer; - TRadioButton *MysqldVer; - TRadioButton *OptVer; - TRadioButton *NtVer; - TButton *Button2; - TButton *Button3; - TButton *Button1; - TTabSheet *TabSheet4; - TMemo *Memo4; - TButton *Button5; - TTabSheet *TabSheet5; - TStringGrid *StringGrid1; - TButton *Button11; - TTabSheet *TabSheet6; - TStringGrid *StringGrid2; - TButton *Button10; - TPopupMenu *PopupMenu1; - TMenuItem *Showme1; - TMenuItem *N1; - TMenuItem *Win9; - TMenuItem *Swin9; - TMenuItem *N3; - TMenuItem *SSW9; - TMenuItem *N4; - TMenuItem *ShutDownBoth1; - TMenuItem *N2; - TMenuItem *WinNT; - TMenuItem *ShutDownthisTool1; - TMenuItem *N5; - TMenuItem *StopS; - TMenuItem *N6; - TMenuItem *RService; - TMenuItem *N7; - TMenuItem *Standa; - TImageList *ImageList1; - TTimer *Timer1; - TTimer *Timer2; - TTimer *Timer3; - TSpeedButton *SpeedButton3; - TSpeedButton *Extended; - TLabel *Label9; - TEdit *st26; - TLabel *Label43; - TEdit *st24; - TLabel *Label41; - TEdit *st23; - TLabel *Label40; - TEdit *st22; - TLabel *Label39; - TTabSheet *TabSheet8; - TSaveDialog *SaveFileDialog; - TPrinterSetupDialog *PrinterSetupDialog1; - TPrintDialog *PrintDialog1; - TRichEdit *Memo5; - TGroupBox *GroupBox5; - TSpeedButton *SpeedButton4; - TSpeedButton *SpeedButton5; - TSpeedButton *SpeedButton7; - TSpeedButton *SpeedButton6; - TGroupBox *GroupBox6; - TSpeedButton *SpeedButton8; - TSpeedButton *SpeedButton9; - TSpeedButton *SpeedButton10; - TSpeedButton *SpeedButton11; - TSpeedButton *SpeedButton12; - TTabSheet *TabSheet9; - TImageList *ImageList2; - TPopupMenu *PopupMenu2; - TMenuItem *CreateDatabaseS; - TMenuItem *DeleteDatabaseS; - TMenuItem *RefreshS; - TMenuItem *N8; - TMenuItem *N9; - TMenuItem *N10; - TGroupBox *GroupBox7; - TTreeView *DBView; - TGroupBox *GroupBox8; - TTreeView *TableView; - TGroupBox *GroupBox9; - TStringGrid *StringGrid4; - TMenuItem *FlushHosts1; - TMenuItem *N11; - TMenuItem *FlushLogs1; - TMenuItem *N12; - TMenuItem *FlushTables1; - TGroupBox *GroupBox10; - TStringGrid *StringGrid3; - TImage *Image5; - TStringGrid *StringGrid5; - TSpeedButton *SpeedButton13; - TPopupMenu *PopupMenu4; - TMenuItem *KillProcess1; - TMenuItem *N13; - TMenuItem *FlushThreads1; - void __fastcall FormCreate(TObject *Sender); - void __fastcall Showme1Click(TObject *Sender); - void __fastcall Timer1Timer(TObject *Sender); - void __fastcall SpeedButton1Click(TObject *Sender); - void __fastcall Timer2Timer(TObject *Sender); - void __fastcall Swin9Click(TObject *Sender); - void __fastcall SSW9Click(TObject *Sender); - void __fastcall ShutDownBoth1Click(TObject *Sender); - void __fastcall ShutDownthisTool1Click(TObject *Sender); - void __fastcall StopSClick(TObject *Sender); - void __fastcall RServiceClick(TObject *Sender); - void __fastcall StandaClick(TObject *Sender); - void __fastcall Button5Click(TObject *Sender); - void __fastcall Timer3Timer(TObject *Sender); - void __fastcall Button11Click(TObject *Sender); - void __fastcall Button10Click(TObject *Sender); - void __fastcall Button6Click(TObject *Sender); - void __fastcall Button7Click(TObject *Sender); - void __fastcall Button8Click(TObject *Sender); - - void __fastcall Button2Click(TObject *Sender); - void __fastcall Button3Click(TObject *Sender); - void __fastcall Button1Click(TObject *Sender); - void __fastcall SpeedButton2Click(TObject *Sender); - void __fastcall Button4Click(TObject *Sender); - void __fastcall SpeedButton3Click(TObject *Sender); - void __fastcall ExtendedClick(TObject *Sender); - void __fastcall SpeedButton4Click(TObject *Sender); - void __fastcall SpeedButton5Click(TObject *Sender); - void __fastcall SpeedButton6Click(TObject *Sender); - void __fastcall SpeedButton7Click(TObject *Sender); - void __fastcall SpeedButton8Click(TObject *Sender); - void __fastcall SpeedButton9Click(TObject *Sender); - void __fastcall SpeedButton10Click(TObject *Sender); - void __fastcall SpeedButton11Click(TObject *Sender); - void __fastcall SpeedButton12Click(TObject *Sender); - void __fastcall DeleteDatabaseSClick(TObject *Sender); - void __fastcall DBViewClick(TObject *Sender); - void __fastcall TableViewClick(TObject *Sender); - void __fastcall TableViewChange(TObject *Sender, TTreeNode *Node); - void __fastcall DBViewChange(TObject *Sender, TTreeNode *Node); - - void __fastcall RefreshSClick(TObject *Sender); - void __fastcall CreateDatabaseSClick(TObject *Sender); - void __fastcall FlushHosts1Click(TObject *Sender); - void __fastcall FlushLogs1Click(TObject *Sender); - void __fastcall FlushTables1Click(TObject *Sender); - void __fastcall SpeedButton13Click(TObject *Sender); - void __fastcall KillProcess1Click(TObject *Sender); - void __fastcall FlushThreads1Click(TObject *Sender); - - - - - - - -private: // User declarations - void __fastcall DrawItem(TMessage& Msg); - void __fastcall MyNotify(TMessage& Msg); - bool __fastcall TrayMessage(DWORD dwMessage); - HANDLE __fastcall IconHandle(void); - void __fastcall ToggleState(void); - PSTR __fastcall TipText(void); - void __fastcall WMQueryEndSession(TWMQueryEndSession &msg); - AnsiString __fastcall TheComputer(); - AnsiString __fastcall TheUser(); - AnsiString __fastcall TheOS(); - void __fastcall TakeIP(void); - void __fastcall GetmemStatus(void); - void __fastcall ShowHelp(void); - void __fastcall ContinueLoad(void); - void __fastcall MyODBC(void); - void __fastcall IsMyIniUp(void); - void __fastcall QuickSearch(void); - AnsiString __fastcall TheWinDir(); - void __fastcall FillMyIni(void); - void __fastcall GetBaseDir(void); - bool __fastcall MySQLSignal(); - bool __fastcall mysqldstart(); - bool __fastcall SeekErrFile(); - AnsiString __fastcall TheDir(); - bool __fastcall TheServiceStart(); - bool __fastcall TheServicePause(); - bool __fastcall TheServiceResume(); - bool __fastcall TheServiceStatus(); - bool __fastcall TheServiceCreate(); - bool __fastcall TheServiceRemove(); - bool __fastcall Shutd(); - void __fastcall ClearBox(void); - bool __fastcall TheServerPath(); - void __fastcall GetServerOptions(void); - void __fastcall GetReportServer(void); - - - TFileStream *MyFile; - String FName; - - void __fastcall IsMySQLInit(void); - void __fastcall GetServerStatus(void); - bool __fastcall GetExtendedStatus(); - bool __fastcall GetProcess(); - bool __fastcall GetVariables(); - bool __fastcall nice_time(AnsiString buff); - String __fastcall GetString(String k); - String __fastcall GetNumberServer(); - // pointers for database screen - TTreeNode *MySQLNode, *MySQLDbs, *MySQLNodeT, *MySQLTbs; - - bool __fastcall GetMainRoot(); - bool __fastcall IsDatabase(String Name); - bool __fastcall IsTable(String Name); - void __fastcall CleanTree(void); - void __fastcall CleanGrid(void); - bool __fastcall IsIndex(String Name); - void __fastcall CleanGridI(void); - bool __fastcall KillPID(); - - - -public: // User declarations - __fastcall TForm1(TComponent* Owner); - void __fastcall GetServerFile(void); - void __fastcall CreateMyIniFile(void); - bool __fastcall CreatingShortCut(); - bool __fastcall CreatingDB(); - void __fastcall OutRefresh(void); - bool __fastcall CreatingTable(String TheTable); - - bool IsConnect ; - - - - STARTUPINFO si; - PROCESS_INFORMATION pi; - BEGIN_MESSAGE_MAP - MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem) - MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify) - MESSAGE_HANDLER(WM_QUERYENDSESSION,TWMQueryEndSession,WMQueryEndSession) - END_MESSAGE_MAP(TForm) -}; -//--------------------------------------------------------------------------- -extern PACKAGE TForm1 *Form1; -//--------------------------------------------------------------------------- -#endif diff --git a/VC++Files/winmysqladmin/mysql.h b/VC++Files/winmysqladmin/mysql.h deleted file mode 100644 index 734d78efea0..00000000000 --- a/VC++Files/winmysqladmin/mysql.h +++ /dev/null @@ -1,295 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* defines for the libmysql library */ - -#ifndef _mysql_h -#define _mysql_h - -#ifndef MYSQL_SERVER -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#ifndef _global_h /* If not standard header */ -#include -typedef char my_bool; -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) -#define __WIN__ -#endif -#if !defined(__WIN__) -#define STDCALL -#else -#define STDCALL __stdcall -#endif -typedef char * gptr; - -#ifndef ST_USED_MEM_DEFINED -#define ST_USED_MEM_DEFINED -typedef struct st_used_mem { /* struct for once_alloc */ - struct st_used_mem *next; /* Next block in use */ - unsigned int left; /* memory left in block */ - unsigned int size; /* size of block */ -} USED_MEM; -typedef struct st_mem_root { - USED_MEM *free; - USED_MEM *used; - unsigned int min_malloc; - unsigned int block_size; - void (*error_handler)(void); -} MEM_ROOT; -#endif - -#ifndef my_socket_defined -#ifdef __WIN__ -#define my_socket SOCKET -#else -typedef int my_socket; -#endif -#endif -#endif -#include "mysql_com.h" -#include "mysql_version.h" - -extern unsigned int mysql_port; -extern char *mysql_unix_port; - -#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) -#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) -#define IS_BLOB(n) ((n) & BLOB_FLAG) -#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR) - -typedef struct st_mysql_field { - char *name; /* Name of column */ - char *table; /* Table of column if column was a field */ - char *def; /* Default value (set by mysql_list_fields) */ - enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ - unsigned int length; /* Width of column */ - unsigned int max_length; /* Max width of selected set */ - unsigned int flags; /* Div flags */ - unsigned int decimals; /* Number of decimals in field */ -} MYSQL_FIELD; - -typedef char **MYSQL_ROW; /* return data as array of strings */ -typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ - -#if defined(NO_CLIENT_LONG_LONG) -typedef unsigned long my_ulonglong; -#elif defined (__WIN__) -typedef unsigned __int64 my_ulonglong; -#else -typedef unsigned long long my_ulonglong; -#endif - -#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) - -typedef struct st_mysql_rows { - struct st_mysql_rows *next; /* list of rows */ - MYSQL_ROW data; -} MYSQL_ROWS; - -typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ - -typedef struct st_mysql_data { - my_ulonglong rows; - unsigned int fields; - MYSQL_ROWS *data; - MEM_ROOT alloc; -} MYSQL_DATA; - -struct st_mysql_options { - unsigned int connect_timeout,client_flag; - my_bool compress,named_pipe; - unsigned int port; - char *host,*init_command,*user,*password,*unix_socket,*db; - char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; - my_bool use_ssl; /* if to use SSL or not */ - char *ssl_key; /* PEM key file */ - char *ssl_cert; /* PEM cert file */ - char *ssl_ca; /* PEM CA file */ - char *ssl_capath; /* PEM directory of CA-s? */ -}; - -enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, - MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, - MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME}; - -enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, - MYSQL_STATUS_USE_RESULT}; - -typedef struct st_mysql { - NET net; /* Communication parameters */ - gptr connector_fd; /* ConnectorFd for SSL */ - char *host,*user,*passwd,*unix_socket,*server_version,*host_info, - *info,*db; - unsigned int port,client_flag,server_capabilities; - unsigned int protocol_version; - unsigned int field_count; - unsigned int server_status; - unsigned long thread_id; /* Id for connection in server */ - my_ulonglong affected_rows; - my_ulonglong insert_id; /* id if insert on table with NEXTNR */ - my_ulonglong extra_info; /* Not used */ - unsigned long packet_length; - enum mysql_status status; - MYSQL_FIELD *fields; - MEM_ROOT field_alloc; - my_bool free_me; /* If free in mysql_close */ - my_bool reconnect; /* set to 1 if automatic reconnect */ - struct st_mysql_options options; - char scramble_buff[9]; - struct charset_info_st *charset; - unsigned int server_language; -} MYSQL; - - -typedef struct st_mysql_res { - my_ulonglong row_count; - unsigned int field_count, current_field; - MYSQL_FIELD *fields; - MYSQL_DATA *data; - MYSQL_ROWS *data_cursor; - MEM_ROOT field_alloc; - MYSQL_ROW row; /* If unbuffered read */ - MYSQL_ROW current_row; /* buffer to current row */ - unsigned long *lengths; /* column lengths of current row */ - MYSQL *handle; /* for unbuffered reads */ - my_bool eof; /* Used my mysql_fetch_row */ -} MYSQL_RES; - -/* Functions to get information from the MYSQL and MYSQL_RES structures */ -/* Should definitely be used if one uses shared libraries */ - -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); -my_bool STDCALL mysql_eof(MYSQL_RES *res); -MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, - unsigned int fieldnr); -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); -MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res); -unsigned int STDCALL mysql_field_tell(MYSQL_RES *res); - -unsigned int STDCALL mysql_field_count(MYSQL *mysql); -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); -unsigned int STDCALL mysql_errno(MYSQL *mysql); -char * STDCALL mysql_error(MYSQL *mysql); -char * STDCALL mysql_info(MYSQL *mysql); -unsigned long STDCALL mysql_thread_id(MYSQL *mysql); -const char * STDCALL mysql_character_set_name(MYSQL *mysql); - -MYSQL * STDCALL mysql_init(MYSQL *mysql); -#ifdef HAVE_OPENSSL -int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, - const char *cert, const char *ca, - const char *capath); -char * STDCALL mysql_ssl_cipher(MYSQL *mysql); -int STDCALL mysql_ssl_clear(MYSQL *mysql); -#endif /* HAVE_OPENSSL */ -MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, - const char *user, const char *passwd); -my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, - const char *passwd, const char *db); -#if MYSQL_VERSION_ID >= 32200 -MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, - const char *user, - const char *passwd, - const char *db, - unsigned int port, - const char *unix_socket, - unsigned int clientflag); -#else -MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, - const char *user, - const char *passwd, - unsigned int port, - const char *unix_socket, - unsigned int clientflag); -#endif -void STDCALL mysql_close(MYSQL *sock); -int STDCALL mysql_select_db(MYSQL *mysql, const char *db); -int STDCALL mysql_query(MYSQL *mysql, const char *q); -int STDCALL mysql_real_query(MYSQL *mysql, const char *q, - unsigned int length); -int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); -int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); -int STDCALL mysql_shutdown(MYSQL *mysql, - enum enum_shutdown_level - shutdown_level); -int STDCALL mysql_dump_debug_info(MYSQL *mysql); -int STDCALL mysql_refresh(MYSQL *mysql, - unsigned int refresh_options); -int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); -int STDCALL mysql_ping(MYSQL *mysql); -char * STDCALL mysql_stat(MYSQL *mysql); -char * STDCALL mysql_get_server_info(MYSQL *mysql); -char * STDCALL mysql_get_client_info(void); -char * STDCALL mysql_get_host_info(MYSQL *mysql); -unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); -MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); -MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, - const char *wild); -MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, - const char *arg); -void STDCALL mysql_free_result(MYSQL_RES *result); -void STDCALL mysql_data_seek(MYSQL_RES *result, - my_ulonglong offset); -MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET); -MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, - MYSQL_FIELD_OFFSET offset); -MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); -unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); -MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); -unsigned long STDCALL mysql_escape_string(char *to,const char *from, - unsigned long from_length); -unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, - char *to,const char *from, - unsigned long length); -void STDCALL mysql_debug(const char *debug); -char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, - char *to, - unsigned long to_length, - const char *from, - unsigned long from_length, - void *param, - char * - (*extend_buffer) - (void *, char *to, - unsigned long *length)); -void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); -unsigned int STDCALL mysql_thread_safe(void); - - -#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) - -/* new api functions */ - -#define HAVE_MYSQL_REAL_CONNECT - -#ifndef MYSQL_SERVER -#ifdef __cplusplus -} -#endif -#endif - -#endif diff --git a/VC++Files/winmysqladmin/mysql_com.h b/VC++Files/winmysqladmin/mysql_com.h deleted file mode 100644 index 2a7eb57d745..00000000000 --- a/VC++Files/winmysqladmin/mysql_com.h +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* -** Common definition between mysql server & client -*/ - -#ifndef _mysql_com_h -#define _mysql_com_h - - -#define NAME_LEN 64 /* Field/table name length */ -#define HOSTNAME_LENGTH 60 -#define USERNAME_LENGTH 16 - -#define LOCAL_HOST "localhost" -#define LOCAL_HOST_NAMEDPIPE "." - -#if defined(__EMX__) || defined(__OS2__) -#undef MYSQL_UNIX_ADDR -#define MYSQL_OS2_ADDR "\\socket\\MySQL" -#define MYSQL_UNIX_ADDR MYSQL_OS2_ADDR -#endif -#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) -#define MYSQL_NAMEDPIPE "MySQL" -#define MYSQL_SERVICENAME "MySql" -#endif /* __WIN__ */ - -enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, - COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH, - COM_SHUTDOWN,COM_STATISTICS, - COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL, - COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, - COM_CHANGE_USER, COM_BINLOG_DUMP, - COM_TABLE_DUMP}; - -#define NOT_NULL_FLAG 1 /* Field can't be NULL */ -#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ -#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ -#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ -#define BLOB_FLAG 16 /* Field is a blob */ -#define UNSIGNED_FLAG 32 /* Field is unsigned */ -#define ZEROFILL_FLAG 64 /* Field is zerofill */ -#define BINARY_FLAG 128 -/* The following are only sent to new clients */ -#define ENUM_FLAG 256 /* field is an enum */ -#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ -#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ -#define SET_FLAG 2048 /* field is a set */ -#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ -#define GROUP_FLAG 32768 /* Intern: Group field */ -#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ - -#define REFRESH_GRANT 1 /* Refresh grant tables */ -#define REFRESH_LOG 2 /* Start on new log file */ -#define REFRESH_TABLES 4 /* close all tables */ -#define REFRESH_HOSTS 8 /* Flush host cache */ -#define REFRESH_STATUS 16 /* Flush status variables */ -#define REFRESH_THREADS 32 /* Flush status variables */ -#define REFRESH_SLAVE 64 /* Reset master info and restart slave - thread */ -#define REFRESH_MASTER 128 /* Remove all bin logs in the index - and truncate the index */ - -/* The following can't be set with mysql_refresh() */ -#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ -#define REFRESH_FAST 32768 /* Intern flag */ - -#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ -#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ -#define CLIENT_LONG_FLAG 4 /* Get all column flags */ -#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ -#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ -#define CLIENT_COMPRESS 32 /* Can use compression protocol */ -#define CLIENT_ODBC 64 /* Odbc client */ -#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ -#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ -#define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */ -#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ -#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ -#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ -#define CLIENT_TRANSACTIONS 8196 /* Client knows about transactions */ - -#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ -#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ - -#define MYSQL_ERRMSG_SIZE 200 -#define NET_READ_TIMEOUT 30 /* Timeout on read */ -#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ -#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ - -#ifndef Vio_defined -#define Vio_defined -#ifdef HAVE_VIO -class Vio; /* Fill Vio class in C++ */ -#else -struct st_vio; /* Only C */ -typedef struct st_vio Vio; -#endif -#endif - -typedef struct st_net { - Vio* vio; - my_socket fd; /* For Perl DBI/dbd */ - int fcntl; - unsigned char *buff,*buff_end,*write_pos,*read_pos; - char last_error[MYSQL_ERRMSG_SIZE]; - unsigned int last_errno,max_packet,timeout,pkt_nr; - unsigned char error; - my_bool return_errno,compress; - my_bool no_send_ok; /* needed if we are doing several - queries in one command ( as in LOAD TABLE ... FROM MASTER ), - and do not want to confuse the client with OK at the wrong time - */ - unsigned long remain_in_buf,length, buf_length, where_b; - unsigned int *return_status; - unsigned char reading_or_writing; - char save_char; -} NET; - -#define packet_error ((unsigned int) -1) - -enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, - FIELD_TYPE_SHORT, FIELD_TYPE_LONG, - FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE, - FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP, - FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24, - FIELD_TYPE_DATE, FIELD_TYPE_TIME, - FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR, - FIELD_TYPE_NEWDATE, - FIELD_TYPE_ENUM=247, - FIELD_TYPE_SET=248, - FIELD_TYPE_TINY_BLOB=249, - FIELD_TYPE_MEDIUM_BLOB=250, - FIELD_TYPE_LONG_BLOB=251, - FIELD_TYPE_BLOB=252, - FIELD_TYPE_VAR_STRING=253, - FIELD_TYPE_STRING=254 -}; - -#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */ -#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */ - - -/* Shutdown/kill enums and constants */ - -/* Bits for THD::killable. */ -#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) -#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) -#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) -#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) - -enum mysql_enum_shutdown_level { - /* - We want levels to be in growing order of hardness (because we use number - comparisons). Note that DEFAULT does not respect the growing property, but - it's ok. - */ - DEFAULT= 0, - /* wait for existing connections to finish */ - WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, - /* wait for existing trans to finish */ - WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, - /* wait for existing updates to finish (=> no partial MyISAM update) */ - WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, - /* flush InnoDB buffers and other storage engines' buffers*/ - WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), - /* don't flush InnoDB buffers, flush other storage engines' buffers*/ - WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, - /* Now the 2 levels of the KILL command */ -#if MYSQL_VERSION_ID >= 50000 - KILL_QUERY= 254, -#endif - KILL_CONNECTION= 255 -}; - -extern unsigned long max_allowed_packet; -extern unsigned long net_buffer_length; - -#define net_new_transaction(net) ((net)->pkt_nr=0) - -int my_net_init(NET *net, Vio* vio); -void net_end(NET *net); -void net_clear(NET *net); -int net_flush(NET *net); -int my_net_write(NET *net,const char *packet,unsigned long len); -int net_write_command(NET *net,unsigned char command,const char *packet, - unsigned long len); -int net_real_write(NET *net,const char *packet,unsigned long len); -unsigned int my_net_read(NET *net); - -struct rand_struct { - unsigned long seed1,seed2,max_value; - double max_value_dbl; -}; - - /* The following is for user defined functions */ - -enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT}; - -typedef struct st_udf_args -{ - unsigned int arg_count; /* Number of arguments */ - enum Item_result *arg_type; /* Pointer to item_results */ - char **args; /* Pointer to argument */ - unsigned long *lengths; /* Length of string arguments */ - char *maybe_null; /* Set to 1 for all maybe_null args */ -} UDF_ARGS; - - /* This holds information about the result */ - -typedef struct st_udf_init -{ - my_bool maybe_null; /* 1 if function can return NULL */ - unsigned int decimals; /* for real functions */ - unsigned int max_length; /* For string functions */ - char *ptr; /* free pointer for function data */ - my_bool const_item; /* 0 if result is independent of arguments */ -} UDF_INIT; - - /* Constants when using compression */ -#define NET_HEADER_SIZE 4 /* standard header size */ -#define COMP_HEADER_SIZE 3 /* compression header extra size */ - - /* Prototypes to password functions */ - -#ifdef __cplusplus -extern "C" { -#endif - -void randominit(struct rand_struct *,unsigned long seed1, - unsigned long seed2); -double rnd(struct rand_struct *); -void make_scrambled_password(char *to,const char *password); -void get_salt_from_password(unsigned long *res,const char *password); -void make_password_from_salt(char *to, unsigned long *hash_res); -char *scramble(char *to,const char *message,const char *password, - my_bool old_ver); -my_bool check_scramble(const char *, const char *message, - unsigned long *salt,my_bool old_ver); -char *get_tty_password(char *opt_message); -void hash_password(unsigned long *result, const char *password); -#ifdef __cplusplus -} -#endif - -/* Some other useful functions */ - -void my_init(void); -void load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); - -#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ - -#ifdef __WIN__ -#define socket_errno WSAGetLastError() -#else -#define socket_errno errno -#endif - -#endif diff --git a/VC++Files/winmysqladmin/mysql_version.h b/VC++Files/winmysqladmin/mysql_version.h deleted file mode 100644 index 1f868704fe8..00000000000 --- a/VC++Files/winmysqladmin/mysql_version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB & Detron HB - This file is public domain and comes with NO WARRANTY of any kind */ - -/* Version numbers for protocol & mysqld */ - -#ifdef _CUSTOMCONFIG_ - #include -#else -#define PROTOCOL_VERSION 10 -#define MYSQL_SERVER_VERSION "3.23.22-beta" -#define FRM_VER 6 -#define MYSQL_VERSION_ID 32322 -#define MYSQL_PORT 3306 -#define MYSQL_UNIX_ADDR "/tmp/mysql.sock" - -/* mysqld compile time options */ -#ifndef MYSQL_CHARSET -#define MYSQL_CHARSET "latin1" -#endif -#endif diff --git a/VC++Files/winmysqladmin/winmysqladmin.cpp b/VC++Files/winmysqladmin/winmysqladmin.cpp deleted file mode 100644 index a4fbe590196..00000000000 --- a/VC++Files/winmysqladmin/winmysqladmin.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -HINSTANCE g_hinst; -USERES("winmysqladmin.res"); -USEFORM("main.cpp", Form1); -USEFORM("initsetup.cpp", Form2); -USEFORM("db.cpp", dbfrm); -USELIB("lib\mysqlclient.lib"); -USELIB("lib\myisammrg.lib"); -USELIB("lib\heap.lib"); -USELIB("lib\myisam.lib"); -USELIB("lib\mysys.lib"); -USELIB("lib\regex.lib"); -USELIB("lib\strings.lib"); -USELIB("lib\zlib.lib"); -//--------------------------------------------------------------------------- -WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - try - { - Application->Initialize(); - Application->HelpFile = "C:\\mysql\\bin\\WINMYSQLADMIN.HLP"; - Application->Title = "WinMySQLadmin 1.0"; - Application->CreateForm(__classid(TForm1), &Form1); - Application->CreateForm(__classid(TForm2), &Form2); - Application->CreateForm(__classid(Tdbfrm), &dbfrm); - Application->Run(); - } - catch (Exception &exception) - { - Application->ShowException(&exception); - } - return 0; -} -//--------------------------------------------------------------------------- From c9e7c0fd56e04ce15b09b44c927c221143c6a9b6 Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Mon, 23 May 2005 11:53:16 -0500 Subject: [PATCH 17/78] BUG# 10687: MERGE Engine fails on Windows This is a replacement for the original patch given by Ingo. This one comes from Monty. The problem is that merge files now use unix style pathnames on all platforms. The merge file open code was not properly converting those pathnames back to non-unix when necessary. --- myisammrg/myrg_open.c | 4 +++- mysys/my_getwd.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 0dc2f4f9768..f9cdc2bb205 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -67,7 +67,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) { if ((end=buff+length)[-1] == '\n') - end[-1]='\0'; + *--end='\0'; if (!buff[0]) continue; /* Skip empty lines */ if (buff[0] == '#') @@ -86,6 +86,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) sizeof(name_buff)-1-dir_length)); VOID(cleanup_dirname(buff,name_buff)); } + else + fn_format(buff, buff, "", "", 0); if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) goto err; if (!m_info) /* First file */ diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 89f949eca27..14d68168acd 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -208,7 +208,7 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) + return test(strchr(name, FN_LIBCHAR)) || test(strchr(name,'/')) #ifdef FN_DEVCHAR || test(strchr(name, FN_DEVCHAR)) #endif From 548994aa7bd55ceed5c1379fef333c3ded0f4036 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 23 May 2005 18:53:53 +0200 Subject: [PATCH 18/78] Build fixes for icc, compile _without_ "-no-gnu" --- include/my_global.h | 2 +- ndb/src/cw/cpcd/Process.cpp | 5 +---- ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 62c6a5d1e4a..f059d603976 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -44,7 +44,7 @@ #endif /* __CYGWIN__ */ /* Determine when to use "#pragma interface" */ -#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3) +#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3) #define USE_PRAGMA_INTERFACE #endif diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index cfffec7d0ce..431c96e3320 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -223,11 +223,8 @@ set_ulimit(const BaseString & pair){ if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } -#if defined(__INTEL_COMPILER) - struct rlimit64 rlp; -#else + struct rlimit rlp; -#endif #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} if(list[0].trim() == "c"){ diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index b3fc6e04d6c..f76440a462a 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -799,11 +799,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){ request->error = errno; return; } -#if defined(__INTEL_COMPILER) - struct dirent64 * dp; -#else struct dirent * dp; -#endif while ((dp = readdir(dirp)) != NULL){ if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", From 1c0da6110ea539fda524b941c32f20fafcbf0f24 Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Mon, 23 May 2005 12:05:15 -0500 Subject: [PATCH 19/78] BUG# 10687: Merge engine fails under Windows This cset is to roll out the cset applied earlier from Ingo. This bug has been fixed with a different cset. --- sql/ha_myisammrg.cc | 4 ++-- strings/my_vsnprintf.c | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 1bf2f8a31ad..9270361980f 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,8 +406,8 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s%c%s/%s", mysql_data_home, - FN_LIBCHAR, tables->db, tables->real_name); + uint length= my_snprintf(buff, FN_REFLEN, "%s%s/%s", mysql_data_home, + tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table, we use the table name without a path. This means that the diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index d92b291321b..d0e529288f7 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -28,7 +28,6 @@ %#[l]u %#[l]x %#.#s Note first # is ignored - %c RETURN length of result string @@ -121,11 +120,6 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) to+= res_length; continue; } - else if (*fmt == 'c') - { - *(to++)= (char) va_arg(ap, int); - continue; - } /* We come here on '%%', unknown code or too long parameter */ if (to == end) break; From c492ffcf2edd4454f11224b616328a2d1b2c8a39 Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Mon, 23 May 2005 12:31:22 -0500 Subject: [PATCH 20/78] BUG#10687 - Merge engine fails under Windows This final cset is to fix a syntax problem in ha_myisammrg.cc where a / was left out of a format string. It also adds a check in has_path to avoid a possible redundant comparison. ha_myisammrg.cc: Replaced missing / in format string my_getwd.c: Added test to see if FN_LIBCHAR != '/' before doing comparison to avoid redundant comparison --- mysys/my_getwd.c | 5 ++++- sql/ha_myisammrg.cc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 14d68168acd..5663ceaa60e 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -208,7 +208,10 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) || test(strchr(name,'/')) + return test(strchr(name, FN_LIBCHAR)) +#if FN_LIBCHAR != '/' + || test(strchr(name,'/')) +#endif #ifdef FN_DEVCHAR || test(strchr(name, FN_DEVCHAR)) #endif diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 9270361980f..0b160d72aab 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,7 +406,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s%s/%s", mysql_data_home, + uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home, tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table, From 52d6288e2d5b5ba156a32f868d4cb9245c1cee8c Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Mon, 23 May 2005 22:38:12 +0400 Subject: [PATCH 21/78] A comment for view_prepare_mode. --- sql/sql_lex.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index fffb8ff9ae6..3e463cb35ce 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -757,7 +757,13 @@ typedef struct st_lex bool drop_if_exists, drop_temporary, local_file, one_shot_set; bool in_comment, ignore_space, verbose, no_write_to_binlog; bool tx_chain, tx_release; - /* special JOIN::prepare mode: changing of query is prohibited */ + /* + Special JOIN::prepare mode: changing of query is prohibited. + When creating a view, we need to just check its syntax omitting + any optimizations: afterwards definition of the view will be + reconstructed by means of ::print() methods and written to + to an .frm file. We need this definition to stay untouched. + */ bool view_prepare_mode; bool safe_to_cache_query; bool subqueries, ignore; From 181f21c5d27d190a5f9ffb8cc2cfecff8b0b341f Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Mon, 23 May 2005 21:15:00 +0200 Subject: [PATCH 22/78] mysqld.dsp: Added BLACKHOLE and FEDERATED storage engines for max builds Some preparations for including yaSSL ha_federated.cc: Use local seach path for "mysql_priv.h" --- VC++Files/sql/mysqld.dsp | 27 ++++++++++++++++++--------- sql/ha_federated.cc | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 723c0d63b36..a140b99080b 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -49,7 +49,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../zlib" /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../zlib" /I "../include" /I "../regex" /I "../extra/yassl/include" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x410 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -75,7 +75,7 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE RSC /l 0x410 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -102,7 +102,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "DBUG_OFF" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x410 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -130,7 +130,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -159,7 +159,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -187,7 +187,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /D MYSQL_SERVER_SUFFIX=-classic /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D LICENSE=Commercial /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "HAVE_DLOPEN" /D "DBUG_OFF" /D "_MBCS" /D "NDEBUG" /FD /D MYSQL_SERVER_SUFFIX=-classic /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -215,7 +215,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_MBCS" /D "HAVE_DLOPEN" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D MYSQL_SERVER_SUFFIX=-pro /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_MBCS" /D "HAVE_DLOPEN" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D MYSQL_SERVER_SUFFIX=-pro /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -243,7 +243,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-classic-nt /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /D LICENSE=Commercial /D MYSQL_SERVER_SUFFIX=-classic-nt /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -272,7 +272,8 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /D "NDEBUG" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D LICENSE=Commercial /D "NDEBUG" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-pro-nt" /FD +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /I "../extra/yassl/include" /D "__NT__" /D "DBUG_OFF" /D "NDEBUG" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D LICENSE=Commercial /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-pro-nt" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -451,6 +452,14 @@ SOURCE=.\gstream.cpp # End Source File # Begin Source File +SOURCE=.\ha_blackhole.cpp +# End Source File +# Begin Source File + +SOURCE=.\ha_federated.cpp +# End Source File +# Begin Source File + SOURCE=.\ha_berkeley.cpp # End Source File # Begin Source File diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 0ac209d82e0..8cb6dcb7285 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -349,7 +349,7 @@ #pragma implementation // gcc: Class implementation #endif -#include +#include "mysql_priv.h" #ifdef HAVE_FEDERATED_DB #include "ha_federated.h" From 3384ecc988ef999b1fadfecce96f310923754f7d Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Mon, 23 May 2005 14:48:25 -0500 Subject: [PATCH 23/78] BUG# 9148 Denial of service fixups of test case and comment formatting --- mysql-test/r/lowercase_table.result | 6 ++++++ mysql-test/t/lowercase_table.test | 11 +++++++++++ mysql-test/t/reserved_win_names-master.opt | 1 - mysys/my_fopen.c | 5 +++-- mysys/my_open.c | 7 ++++--- 5 files changed, 24 insertions(+), 6 deletions(-) delete mode 100644 mysql-test/t/reserved_win_names-master.opt diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index ef379cebaa9..499f46a237e 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -83,3 +83,9 @@ create table t2 like T1; drop table t1, t2; show tables; Tables_in_test +use lpt1; +ERROR 42000: Unknown database 'lpt1' +use com1; +ERROR 42000: Unknown database 'com1' +use prn; +ERROR 42000: Unknown database 'prn' diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index ee8dc403981..ca81c7c66bc 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -82,3 +82,14 @@ create table t2 like T1; drop table t1, t2; show tables; + +# +#Bug 9148: Denial of service +# +--error 1049 +use lpt1; +--error 1049 +use com1; +--error 1049 +use prn; + diff --git a/mysql-test/t/reserved_win_names-master.opt b/mysql-test/t/reserved_win_names-master.opt deleted file mode 100644 index 62ab6dad1e0..00000000000 --- a/mysql-test/t/reserved_win_names-master.opt +++ /dev/null @@ -1 +0,0 @@ ---lower_case_table_names=1 diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 208e7e80fd8..4310250bd0d 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -34,8 +34,9 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); /* - * if we are not creating, then we need to use my_access to make sure - * the file exists since Windows doesn't handle files like "com1.sym" very well + if we are not creating, then we need to use my_access to make sure + the file exists since Windows doesn't handle files like "com1.sym" + very well */ #ifdef __WIN__ if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) diff --git a/mysys/my_open.c b/mysys/my_open.c index 1f3bb95b5a2..ea4d99c3e8c 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -46,9 +46,10 @@ File my_open(const char *FileName, int Flags, myf MyFlags) DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) - /* if we are not creating, then we need to use my_access to make - * sure the file exists since Windows doesn't handle files like - * "com1.sym" very well + /* + if we are not creating, then we need to use my_access to make + sure the file exists since Windows doesn't handle files like + "com1.sym" very well */ if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) return -1; From 3c2c8bf9a222b10b45d02b4de54db4d0f0ff0e1b Mon Sep 17 00:00:00 2001 From: "pem@mysql.comhem.se" <> Date: Mon, 23 May 2005 23:43:43 +0200 Subject: [PATCH 24/78] Fixed on BUG#6048: Stored procedure causes operating system reboot Memory leak in locally evalutated expressions during SP execution fixed by reusing allocated item slots when possible. Note: No test case added, since the test is a stress test that tries to make the machine to run out of memory. Second attempt, now tested with debug build, valgrind build, max (optimized) build, with and without --debug, --vagrind and --ps-protocol. Errors in trigger and view test with --debug in debug build where present before this patch, and likewise for valgrind warnings for view test in valgrind build with --ps-protocol. --- sql/item.cc | 3 ++- sql/item.h | 18 +++++++++++++ sql/sp_head.cc | 45 ++++++++++++++----------------- sql/sp_rcontext.cc | 67 +++++++++++++++++++++++++++++++++++++--------- sql/sp_rcontext.h | 7 +++-- sql/sql_class.cc | 3 ++- 6 files changed, 99 insertions(+), 44 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index f105d97bec2..a28cc261b3c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -298,7 +298,7 @@ longlong Item::val_int_from_decimal() Item::Item(): - name(0), orig_name(0), name_length(0), fixed(0), + rsize(0), name(0), orig_name(0), name_length(0), fixed(0), collation(&my_charset_bin, DERIVATION_COERCIBLE) { marker= 0; @@ -330,6 +330,7 @@ Item::Item(): tables */ Item::Item(THD *thd, Item *item): + rsize(0), str_value(item->str_value), name(item->name), orig_name(item->orig_name), diff --git a/sql/item.h b/sql/item.h index 11b9460906e..18a81dcaa03 100644 --- a/sql/item.h +++ b/sql/item.h @@ -232,6 +232,21 @@ public: static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } + /* Special for SP local variable assignment - reusing slots */ + static void *operator new(size_t size, Item *reuse, uint *rsize) + { + if (reuse && size <= reuse->rsize) + { + reuse->cleanup(); + TRASH((void *)reuse, size); + if (rsize) + (*rsize)= reuse->rsize; + return (void *)reuse; + } + if (rsize) + (*rsize)= size; + return (void *)sql_alloc((uint)size); + } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} @@ -247,6 +262,9 @@ public: enum traverse_order { POSTFIX, PREFIX }; + /* Reuse size, only used by SP local variable assignment, otherwize 0 */ + uint rsize; + /* str_values's main purpose is to be used to cache the value in save_in_field diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ca2ec6d0acf..988345694b2 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -131,10 +131,12 @@ sp_prepare_func_item(THD* thd, Item **it_addr) ** if nothing else. */ Item * -sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) +sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type, + Item *reuse) { DBUG_ENTER("sp_eval_func_item"); Item *it= sp_prepare_func_item(thd, it_addr); + uint rsize; DBUG_PRINT("info", ("type: %d", type)); if (!it) @@ -144,7 +146,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) /* QQ How do we do this? Is there some better way? */ if (type == MYSQL_TYPE_NULL) - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); else { switch (sp_map_result_type(type)) { @@ -155,12 +157,12 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) if (it->null_value) { DBUG_PRINT("info", ("INT_RESULT: null")); - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); } else { DBUG_PRINT("info", ("INT_RESULT: %d", i)); - it= new Item_int(i); + it= new(reuse, &rsize) Item_int(i); } break; } @@ -171,7 +173,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) if (it->null_value) { DBUG_PRINT("info", ("REAL_RESULT: null")); - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); } else { @@ -180,7 +182,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) uint8 decimals= it->decimals; uint32 max_length= it->max_length; DBUG_PRINT("info", ("REAL_RESULT: %g", d)); - it= new Item_float(d); + it= new(reuse, &rsize) Item_float(d); it->decimals= decimals; it->max_length= max_length; } @@ -190,9 +192,9 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) { my_decimal value, *val= it->val_decimal(&value); if (it->null_value) - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); else - it= new Item_decimal(val); + it= new(reuse, &rsize) Item_decimal(val); #ifndef DBUG_OFF char dbug_buff[DECIMAL_MAX_STR_LENGTH+1]; DBUG_PRINT("info", ("DECIMAL_RESULT: %s", dbug_decimal_as_string(dbug_buff, val))); @@ -208,14 +210,16 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) if (it->null_value) { DBUG_PRINT("info", ("default result: null")); - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); } else { DBUG_PRINT("info",("default result: %*s", s->length(), s->c_ptr_quick())); - it= new Item_string(thd->strmake(s->ptr(), s->length()), - s->length(), it->collation.collation); + it= new(reuse, &rsize) Item_string(thd->strmake(s->ptr(), + s->length()), + s->length(), + it->collation.collation); } break; } @@ -224,6 +228,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type) DBUG_ASSERT(0); } } + it->rsize= rsize; DBUG_RETURN(it); } @@ -708,7 +713,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp) for (i= 0 ; i < params && i < argcount ; i++) { sp_pvar_t *pvar = m_pcont->find_pvar(i); - Item *it= sp_eval_func_item(thd, argp++, pvar->type); + Item *it= sp_eval_func_item(thd, argp++, pvar->type, NULL); if (it) nctx->push_item(it); @@ -823,7 +828,7 @@ sp_head::execute_procedure(THD *thd, List *args) } else { - Item *it2= sp_eval_func_item(thd, li.ref(), pvar->type); + Item *it2= sp_eval_func_item(thd, li.ref(), pvar->type, NULL); if (it2) nctx->push_item(it2); // IN or INOUT @@ -1466,19 +1471,9 @@ sp_instr_set::execute(THD *thd, uint *nextp) int sp_instr_set::exec_core(THD *thd, uint *nextp) { - Item *it; - int res; + int res= thd->spcont->set_item_eval(thd, m_offset, &m_value, m_type); - it= sp_eval_func_item(thd, &m_value, m_type); - if (! it) - res= -1; - else - { - res= 0; - thd->spcont->set_item(m_offset, it); - } *nextp = m_ip+1; - return res; } @@ -1715,7 +1710,7 @@ sp_instr_freturn::exec_core(THD *thd, uint *nextp) Item *it; int res; - it= sp_eval_func_item(thd, &m_value, m_type); + it= sp_eval_func_item(thd, &m_value, m_type, NULL); if (! it) res= -1; else diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 672491a97f2..49ead5d1585 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -40,19 +40,39 @@ sp_rcontext::sp_rcontext(uint fsize, uint hmax, uint cmax) m_saved.empty(); } -int -sp_rcontext::set_item_eval(uint idx, Item **item_addr, enum_field_types type) -{ - extern Item *sp_eval_func_item(THD *thd, Item **it, enum_field_types type); - Item *it= sp_eval_func_item(current_thd, item_addr, type); +int +sp_rcontext::set_item_eval(THD *thd, uint idx, Item **item_addr, + enum_field_types type) +{ + extern Item *sp_eval_func_item(THD *thd, Item **it, enum_field_types type, + Item *reuse); + Item *it; + Item *reuse_it; + Item *old_item_next; + Item *old_free_list= thd->free_list; + int res; + LINT_INIT(old_item_next); + + if ((reuse_it= get_item(idx))) + old_item_next= reuse_it->next; + it= sp_eval_func_item(thd, item_addr, type, reuse_it); if (! it) - return -1; + res= -1; else { + res= 0; + if (reuse_it && it == reuse_it) + { + // A reused item slot, where the constructor put it in the free_list, + // so we have to restore the list. + thd->free_list= old_free_list; + it->next= old_item_next; + } set_item(idx, it); - return 0; } + + return res; } bool @@ -111,7 +131,10 @@ void sp_rcontext::save_variables(uint fp) { while (fp < m_count) - m_saved.push_front(m_frame[fp++]); + { + m_saved.push_front(m_frame[fp]); + m_frame[fp++]= NULL; // Prevent reuse + } } void @@ -230,7 +253,12 @@ sp_cursor::fetch(THD *thd, List *vars) for (fldcount= 0 ; (pv= li++) ; fldcount++) { Item *it; + Item *reuse; + uint rsize; + Item *old_item_next; + Item *old_free_list= thd->free_list; const char *s; + LINT_INIT(old_item_next); if (fldcount >= m_prot->get_field_count()) { @@ -238,9 +266,13 @@ sp_cursor::fetch(THD *thd, List *vars) ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0)); return -1; } + + if ((reuse= thd->spcont->get_item(pv->offset))) + old_item_next= reuse->next; + s= row[fldcount]; if (!s) - it= new Item_null(); + it= new(reuse, &rsize) Item_null(); else { /* @@ -255,23 +287,32 @@ sp_cursor::fetch(THD *thd, List *vars) len= (*next -s)-1; switch (sp_map_result_type(pv->type)) { case INT_RESULT: - it= new Item_int(s); + it= new(reuse, &rsize) Item_int(s); break; case REAL_RESULT: - it= new Item_float(s, len); + it= new(reuse, &rsize) Item_float(s, len); break; case DECIMAL_RESULT: - it= new Item_decimal(s, len, thd->db_charset); + it= new(reuse, &rsize) Item_decimal(s, len, thd->db_charset); break; case STRING_RESULT: /* TODO: Document why we do an extra copy of the string 's' here */ - it= new Item_string(thd->strmake(s, len), len, thd->db_charset); + it= new(reuse, &rsize) Item_string(thd->strmake(s, len), len, + thd->db_charset); break; case ROW_RESULT: default: DBUG_ASSERT(0); } } + it->rsize= rsize; + if (reuse && it == reuse) + { + // A reused item slot, where the constructor put it in the free_list, + // so we have to restore the list. + thd->free_list= old_free_list; + it->next= old_item_next; + } thd->spcont->set_item(pv->offset, it); } if (fldcount < m_prot->get_field_count()) diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index c132032e32c..417c50d0f0f 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -62,19 +62,19 @@ class sp_rcontext : public Sql_alloc push_item(Item *i) { if (m_count < m_fsize) - m_frame[m_count++] = i; + m_frame[m_count++]= i; } inline void set_item(uint idx, Item *i) { if (idx < m_count) - m_frame[idx] = i; + m_frame[idx]= i; } /* Returns 0 on success, -1 on (eval) failure */ int - set_item_eval(uint idx, Item **i, enum_field_types type); + set_item_eval(THD *thd, uint idx, Item **i, enum_field_types type); inline Item * get_item(uint idx) @@ -82,7 +82,6 @@ class sp_rcontext : public Sql_alloc return m_frame[idx]; } - inline Item ** get_item_addr(uint idx) { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2d5c4722164..2a500610479 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1746,7 +1746,8 @@ bool select_dumpvar::send_data(List &items) { if ((yy=var_li++)) { - if (thd->spcont->set_item_eval(yy->get_offset(), it.ref(), zz->type)) + if (thd->spcont->set_item_eval(current_thd, + yy->get_offset(), it.ref(), zz->type)) DBUG_RETURN(1); } } From 76a20eb3976909d7e07ed6db19f05caef71e8d5b Mon Sep 17 00:00:00 2001 From: "gbichot@bk-internal.mysql.com" <> Date: Mon, 23 May 2005 23:54:39 +0200 Subject: [PATCH 25/78] marking the file gone again to hopefully get the tree on its feet --- BitKeeper/etc/gone | 1 + BitKeeper/etc/logging_ok | 1 + 2 files changed, 2 insertions(+) diff --git a/BitKeeper/etc/gone b/BitKeeper/etc/gone index 63a759cf131..2d5522899d2 100644 --- a/BitKeeper/etc/gone +++ b/BitKeeper/etc/gone @@ -750,6 +750,7 @@ mwagner@work.mysql.com|mysql-test/r/3.23/sel000001.result|20001010091454|28284|3 mwagner@work.mysql.com|mysql-test/r/3.23/sel000002.result|20001010091454|29230|d1787e6fd5dbc1cc nick@nick.leippe.com|mysql-test/r/rpl_empty_master_crash.result|20020531235552|47718|615f521be2132141 nick@nick.leippe.com|mysql-test/t/rpl_empty_master_crash.test|20020531235552|52328|99464e737639ccc6 +reggie@mdk10.(none)|mysql-test/t/reserved_win_names-master.opt|20050520210356|14878|e56da049a7ce9a5b sasha@mysql.sashanet.com|BitKeeper/etc/logging_ok|20000801000905|12967|5b7d847a2158554 sasha@mysql.sashanet.com|build-tags|20011125054855|05181|7afb7e785b80f97 sasha@mysql.sashanet.com|build-tags|20011201050944|25384|b6f6fff142121618 diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 2ed4bf2a5d3..aad4399302e 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -49,6 +49,7 @@ dlenev@mysql.com ejonore@mc03.ndb.mysql.com evgen@moonbone.(none) evgen@moonbone.local +gbichot@bk-internal.mysql.com gbichot@production.mysql.com gbichot@quadita2.mysql.com gbichot@quadxeon.mysql.com From 077346c746efcc85f6e2509b4772f29c5df07c45 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Tue, 24 May 2005 14:35:23 +0400 Subject: [PATCH 26/78] Fix for bug #10659: information_schema_db fail on Mac OS --- mysql-test/r/information_schema_db.result | 4 ++-- mysql-test/t/information_schema_db.test | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 0ccb22be22a..3da5cc7bd11 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -1,6 +1,6 @@ use INFORMATION_SCHEMA; show tables; -Tables_in_INFORMATION_SCHEMA +Tables_in_information_schema SCHEMATA TABLES COLUMNS @@ -17,7 +17,7 @@ COLUMN_PRIVILEGES TABLE_CONSTRAINTS KEY_COLUMN_USAGE show tables from INFORMATION_SCHEMA like 'T%'; -Tables_in_INFORMATION_SCHEMA (T%) +Tables_in_information_schema (T%) TABLES TABLE_PRIVILEGES TABLE_CONSTRAINTS diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test index f88d04c2783..efb738d682c 100644 --- a/mysql-test/t/information_schema_db.test +++ b/mysql-test/t/information_schema_db.test @@ -1,7 +1,9 @@ -- source include/testdb_only.inc use INFORMATION_SCHEMA; +--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema show tables; +--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)' show tables from INFORMATION_SCHEMA like 'T%'; create database `inf%`; use `inf%`; From a6a589ef76b5042b5567ac45f58c6fa798986247 Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Tue, 24 May 2005 11:44:34 +0100 Subject: [PATCH 27/78] Bug#7241 - Invalid response when DELETE .. USING and LOCK TABLES used. Only acquire necessary write lock for multi-delete --- mysql-test/r/lock.result | 10 ++++++++++ mysql-test/t/lock.test | 14 ++++++++++++++ sql/sql_parse.cc | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result index 429bc5ed352..54162a36d83 100644 --- a/mysql-test/r/lock.result +++ b/mysql-test/r/lock.result @@ -47,3 +47,13 @@ unlock tables; lock tables t1 write, t1 as t1_alias read; insert into t1 select index1,nr from t1 as t1_alias; drop table t1,t2; +create table t1 ( a int(11) not null auto_increment, primary key(a)); +create table t2 ( a int(11) not null auto_increment, primary key(a)); +lock tables t1 write, t2 read; +delete from t1 using t1,t2 where t1.a=t2.a; +delete t1 from t1,t2 where t1.a=t2.a; +delete from t2 using t1,t2 where t1.a=t2.a; +ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +delete t2 from t1,t2 where t1.a=t2.a; +ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +drop table t1,t2; diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 26fc4e32bda..261c01b405c 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -59,3 +59,17 @@ unlock tables; lock tables t1 write, t1 as t1_alias read; insert into t1 select index1,nr from t1 as t1_alias; drop table t1,t2; + +# +# Bug7241 - Invalid response when DELETE .. USING and LOCK TABLES used. +# +create table t1 ( a int(11) not null auto_increment, primary key(a)); +create table t2 ( a int(11) not null auto_increment, primary key(a)); +lock tables t1 write, t2 read; +delete from t1 using t1,t2 where t1.a=t2.a; +delete t1 from t1,t2 where t1.a=t2.a; +--error 1099 +delete from t2 using t1,t2 where t1.a=t2.a; +--error 1099 +delete t2 from t1,t2 where t1.a=t2.a; +drop table t1,t2; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c5b429ec8fc..2c1723be5d9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4141,6 +4141,7 @@ void mysql_init_multi_delete(LEX *lex) lex->select_lex.select_limit= lex->unit.select_limit_cnt= HA_POS_ERROR; lex->select_lex.table_list.save_and_clear(&lex->auxilliary_table_list); + lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ; } @@ -5437,6 +5438,11 @@ int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count) } walk->lock_type= target_tbl->lock_type; target_tbl->table_list= walk; // Remember corresponding table + if (walk->table_list) + { + target_tbl->table_list= walk->table_list; + walk->table_list->lock_type= walk->lock_type; + } } DBUG_RETURN(0); } From 16c96b88d5bca806628bbb86da26a731db8a2a73 Mon Sep 17 00:00:00 2001 From: "jan@hundin.mysql.fi" <> Date: Tue, 24 May 2005 14:06:44 +0300 Subject: [PATCH 28/78] Print information about XA recovery only if there are prepared XA transactions after recovery. --- innobase/trx/trx0trx.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index cdda1dd4dee..c6d1f953772 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -1926,10 +1926,6 @@ trx_recover_for_mysql( ut_ad(xid_list); ut_ad(len); - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Starting recovery for XA transactions...\n"); - /* We should set those transactions which are in the prepared state to the xid_list */ @@ -1941,6 +1937,12 @@ trx_recover_for_mysql( if (trx->conc_state == TRX_PREPARED) { xid_list[count] = trx->xid; + if (count == 0) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: Starting recovery for XA transactions...\n"); + } + ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Transaction %lu %lu in prepared state after recovery\n", @@ -1964,10 +1966,12 @@ trx_recover_for_mysql( mutex_exit(&kernel_mutex); - ut_print_timestamp(stderr); - fprintf(stderr, + if (count > 0){ + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: %d transactions in prepared state after recovery\n", - count); + count); + } return (count); } From 72f9abbf76030ff9a7f6dd96696419e34302ea14 Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Tue, 24 May 2005 13:38:46 +0100 Subject: [PATCH 29/78] Add comments --- sql/sql_parse.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 2c1723be5d9..80c68dad247 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1992,6 +1992,10 @@ mysql_execute_command(THD *thd) #endif } #endif /* !HAVE_REPLICATION */ + + /* When subselects or time_zone info is used in a query + * we create a new TABLE_LIST containing all referenced tables + * and set local variable 'tables' to point to this list. */ if ((&lex->select_lex != lex->all_selects_list || lex->time_zone_tables_used) && lex->unit.create_total_list(thd, lex, &tables)) @@ -5438,6 +5442,9 @@ int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count) } walk->lock_type= target_tbl->lock_type; target_tbl->table_list= walk; // Remember corresponding table + + /* in case of subselects, we need to set lock_type in + * corresponding table in list of all tables */ if (walk->table_list) { target_tbl->table_list= walk->table_list; From 6726b9fd098b6031d3e7c17e5628839d301a1094 Mon Sep 17 00:00:00 2001 From: "reggie@mdk10.(none)" <> Date: Tue, 24 May 2005 09:01:06 -0500 Subject: [PATCH 30/78] removed unneeded reserved_win_names testcase --- mysql-test/r/reserved_win_names.require | 2 -- mysql-test/r/reserved_win_names.result | 7 ------- mysql-test/t/reserved_win_names.test | 12 ------------ 3 files changed, 21 deletions(-) delete mode 100644 mysql-test/r/reserved_win_names.require delete mode 100644 mysql-test/r/reserved_win_names.result delete mode 100644 mysql-test/t/reserved_win_names.test diff --git a/mysql-test/r/reserved_win_names.require b/mysql-test/r/reserved_win_names.require deleted file mode 100644 index 7f803aca482..00000000000 --- a/mysql-test/r/reserved_win_names.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -lower_case_table_names 1 diff --git a/mysql-test/r/reserved_win_names.result b/mysql-test/r/reserved_win_names.result deleted file mode 100644 index eaa0f71513f..00000000000 --- a/mysql-test/r/reserved_win_names.result +++ /dev/null @@ -1,7 +0,0 @@ -use COM1; -ERROR 42000: Unknown database 'com1' -use LPT1; -ERROR 42000: Unknown database 'lpt1' -use PRN; -ERROR 42000: Unknown database 'prn' - diff --git a/mysql-test/t/reserved_win_names.test b/mysql-test/t/reserved_win_names.test deleted file mode 100644 index d9b23935ddf..00000000000 --- a/mysql-test/t/reserved_win_names.test +++ /dev/null @@ -1,12 +0,0 @@ -# -# Test of reserved Windows names -# ---require r/reserved_win_names.require - ---error 1049 -use COM1; ---error 1049 -use LPT1; ---error 1049 -use PRN; - From 5254d52cb65f82d1f4864f346f5ab612dc6a4890 Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Tue, 24 May 2005 17:50:17 +0300 Subject: [PATCH 31/78] Added a test case for Bug#8009. --- mysql-test/r/select.result | 6 ++++++ mysql-test/t/select.test | 9 +++++++++ sql/item.cc | 1 + 3 files changed, 16 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c39d1a322e4..f828759672a 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2509,3 +2509,9 @@ AND FK_firma_id = 2; COUNT(*) 0 drop table t1; +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +b +9223372036854775808 +DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 0634323cef7..3877e67de41 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2051,3 +2051,12 @@ SELECT COUNT(*) FROM t1 WHERE AND FK_firma_id = 2; drop table t1; + +# +# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX +# + +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +DROP TABLE t1; diff --git a/sql/item.cc b/sql/item.cc index 59785813566..c43421117e5 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2107,6 +2107,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length) *ptr=0; // Keep purify happy collation.set(&my_charset_bin, DERIVATION_COERCIBLE); fixed= 1; + unsigned_flag= 1; } longlong Item_varbinary::val_int() From bedc2e3d4c9f28eeff3965d974e55f8983d4abcc Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Tue, 24 May 2005 18:51:53 +0200 Subject: [PATCH 32/78] ha_archive.cc: Use local seach path for "mysql_priv.h" mysqld.dsp: Added the ARCHIVE storage engine to max ha_archive.h: VC6, but not VC7, needs a cast of byte[] to char* to make the compile select the right conversion function in String --- VC++Files/sql/mysqld.dsp | 10 +++++++--- sql/examples/ha_archive.cc | 2 +- sql/examples/ha_archive.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index a140b99080b..3642585b4d6 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -75,7 +75,7 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE RSC /l 0x410 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -130,7 +130,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-nt-max /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -159,7 +159,7 @@ LINK32=xilink6.exe # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../extra/yassl/include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "HAVE_ARCHIVE_DB" /D "HAVE_BLACKHOLE_DB" /D "HAVE_FEDERATED_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /D MYSQL_SERVER_SUFFIX=-max /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -452,6 +452,10 @@ SOURCE=.\gstream.cpp # End Source File # Begin Source File +SOURCE=.\examples\ha_archive.cpp +# End Source File +# Begin Source File + SOURCE=.\ha_blackhole.cpp # End Source File # Begin Source File diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc index 231031c9834..f28ba79a00e 100644 --- a/sql/examples/ha_archive.cc +++ b/sql/examples/ha_archive.cc @@ -18,7 +18,7 @@ #pragma implementation // gcc: Class implementation #endif -#include +#include "../mysql_priv.h" #ifdef HAVE_ARCHIVE_DB #include "ha_archive.h" diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index c68462be1ab..2f310d8c69b 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -61,7 +61,7 @@ public: ha_archive(TABLE *table): handler(table), delayed_insert(0), bulk_insert(0) { /* Set our original buffer from pre-allocated memory */ - buffer.set(byte_buffer, IO_SIZE, system_charset_info); + buffer.set((char *)byte_buffer, IO_SIZE, system_charset_info); /* The size of the offset value we will use for position() */ ref_length = sizeof(z_off_t); From 007a20591892beb3734ed4d29fdfe28b750f435a Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Tue, 24 May 2005 22:19:33 +0400 Subject: [PATCH 33/78] Fix for bugs: #5860 "Multi-table UPDATE does not activate update triggers" #6812 "Triggers are not activated for INSERT ... SELECT" #8755 "Trigger is not activated by LOAD DATA". This patch also implements proper handling of triggers for special forms of insert like REPLACE or INSERT ... ON DUPLICATE KEY UPDATE. Also now we don't call after trigger in case when we have failed to inserted/update or delete row. Trigger failure should stop statement execution. I have not properly tested handling of errors which happen inside of triggers in this patch, since it is simplier to do this once we will be able to access tables from triggers. --- mysql-test/r/trigger.result | 109 ++++++++++++++++++++++++ mysql-test/t/trigger.test | 118 ++++++++++++++++++++++++++ sql/item.cc | 43 +++++----- sql/item.h | 19 +++-- sql/mysql_priv.h | 12 ++- sql/sql_base.cc | 72 +++++++++++++++- sql/sql_delete.cc | 45 ++++++++-- sql/sql_insert.cc | 163 +++++++++++++++++++++++++++--------- sql/sql_load.cc | 30 +++++-- sql/sql_trigger.cc | 45 +++++----- sql/sql_trigger.h | 39 +++++++-- sql/sql_update.cc | 66 +++++++++++---- 12 files changed, 634 insertions(+), 127 deletions(-) diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index cf0e0e8f564..1d2fb5989a5 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -140,6 +140,48 @@ drop trigger t1.trg1; drop trigger t1.trg2; drop trigger t1.trg3; drop table t1; +create table t1 (id int not null primary key, data int); +create trigger t1_bi before insert on t1 for each row +set @log:= concat(@log, "(BEFORE_INSERT: new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_ai after insert on t1 for each row +set @log:= concat(@log, "(AFTER_INSERT: new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_bu before update on t1 for each row +set @log:= concat(@log, "(BEFORE_UPDATE: old=(id=", old.id, ", data=", old.data, +") new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_au after update on t1 for each row +set @log:= concat(@log, "(AFTER_UPDATE: old=(id=", old.id, ", data=", old.data, +") new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_bd before delete on t1 for each row +set @log:= concat(@log, "(BEFORE_DELETE: old=(id=", old.id, ", data=", old.data,"))"); +create trigger t1_ad after delete on t1 for each row +set @log:= concat(@log, "(AFTER_DELETE: old=(id=", old.id, ", data=", old.data,"))"); +set @log:= ""; +insert into t1 values (1, 1); +select @log; +@log +(BEFORE_INSERT: new=(id=1, data=1))(AFTER_INSERT: new=(id=1, data=1)) +set @log:= ""; +insert ignore t1 values (1, 2); +select @log; +@log +(BEFORE_INSERT: new=(id=1, data=2)) +set @log:= ""; +replace t1 values (1, 3), (2, 2); +select @log; +@log +(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2)) +alter table t1 add ts timestamp default now(); +set @log:= ""; +replace t1 (id, data) values (1, 4); +select @log; +@log +(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=3))(AFTER_DELETE: old=(id=1, data=3))(AFTER_INSERT: new=(id=1, data=4)) +set @log:= ""; +insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +select @log; +@log +(BEFORE_INSERT: new=(id=1, data=5))(BEFORE_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(AFTER_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3)) +drop table t1; create table t1 (i int); create trigger trg before insert on t1 for each row set @a:= old.i; ERROR HY000: There is no OLD row in on INSERT trigger @@ -206,3 +248,70 @@ create table t1 (i int); create trigger trg1 before insert on t1 for each row set @a:= 1; drop database mysqltest; use test; +create table t1 (i int, j int default 10, k int not null, key (k)); +create table t2 (i int); +insert into t1 (i, k) values (1, 1); +insert into t2 values (1); +create trigger trg1 before update on t1 for each row set @a:= @a + new.j - old.j; +create trigger trg2 after update on t1 for each row set @b:= "Fired"; +set @a:= 0, @b:= ""; +update t1, t2 set j = j + 10 where t1.i = t2.i; +select @a, @b; +@a @b +10 Fired +insert into t1 values (2, 13, 2); +insert into t2 values (2); +set @a:= 0, @b:= ""; +update t1, t2 set j = j + 15 where t1.i = t2.i and t1.k >= 2; +select @a, @b; +@a @b +15 Fired +create trigger trg3 before delete on t1 for each row set @c:= @c + old.j; +create trigger trg4 before delete on t2 for each row set @d:= @d + old.i; +create trigger trg5 after delete on t1 for each row set @e:= "After delete t1 fired"; +create trigger trg6 after delete on t2 for each row set @f:= "After delete t2 fired"; +set @c:= 0, @d:= 0, @e:= "", @f:= ""; +delete t1, t2 from t1, t2 where t1.i = t2.i; +select @c, @d, @e, @f; +@c @d @e @f +48 3 After delete t1 fired After delete t2 fired +drop table t1, t2; +create table t1 (i int, j int default 10)| +create table t2 (i int)| +insert into t2 values (1), (2)| +create trigger trg1 before insert on t1 for each row +begin +if new.i = 1 then +set new.j := 1; +end if; +end| +create trigger trg2 after insert on t1 for each row set @a:= 1| +set @a:= 0| +insert into t1 (i) select * from t2| +select * from t1| +i j +1 1 +2 10 +select @a| +@a +1 +drop table t1, t2| +create table t1 (i int, j int, k int); +create trigger trg1 before insert on t1 for each row set new.k = new.i; +create trigger trg2 after insert on t1 for each row set @b:= "Fired"; +set @b:=""; +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i); +select *, @b from t1; +i j k @b +10 NULL 10 Fired +15 NULL 15 Fired +set @b:=""; +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); +select *, @b from t1; +i j k @b +10 NULL 10 Fired +15 NULL 15 Fired +1 2 1 Fired +3 4 3 Fired +5 6 5 Fired +drop table t1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 53144cf3591..79f65bba678 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -150,6 +150,55 @@ drop trigger t1.trg3; drop table t1; +# Let us test how triggers work for special forms of INSERT such as +# REPLACE and INSERT ... ON DUPLICATE KEY UPDATE +create table t1 (id int not null primary key, data int); +create trigger t1_bi before insert on t1 for each row + set @log:= concat(@log, "(BEFORE_INSERT: new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_ai after insert on t1 for each row + set @log:= concat(@log, "(AFTER_INSERT: new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_bu before update on t1 for each row + set @log:= concat(@log, "(BEFORE_UPDATE: old=(id=", old.id, ", data=", old.data, + ") new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_au after update on t1 for each row + set @log:= concat(@log, "(AFTER_UPDATE: old=(id=", old.id, ", data=", old.data, + ") new=(id=", new.id, ", data=", new.data,"))"); +create trigger t1_bd before delete on t1 for each row + set @log:= concat(@log, "(BEFORE_DELETE: old=(id=", old.id, ", data=", old.data,"))"); +create trigger t1_ad after delete on t1 for each row + set @log:= concat(@log, "(AFTER_DELETE: old=(id=", old.id, ", data=", old.data,"))"); +# Simple INSERT - both triggers should be called +set @log:= ""; +insert into t1 values (1, 1); +select @log; +# INSERT IGNORE for already existing key - only before trigger should fire +set @log:= ""; +insert ignore t1 values (1, 2); +select @log; +# REPLACE: before insert trigger should be called for both records, +# but then for first one update will be executed (and both update +# triggers should fire). For second after insert trigger will be +# called as for usual insert +set @log:= ""; +replace t1 values (1, 3), (2, 2); +select @log; +# Now let us change table in such way that REPLACE on won't be executed +# using update. +alter table t1 add ts timestamp default now(); +set @log:= ""; +# This REPLACE should be executed via DELETE and INSERT so proper +# triggers should be invoked. +replace t1 (id, data) values (1, 4); +select @log; +# Finally let us test INSERT ... ON DUPLICATE KEY UPDATE ... +set @log:= ""; +insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +select @log; + +# This also drops associated triggers +drop table t1; + + # # Test of wrong column specifiers in triggers # @@ -249,3 +298,72 @@ create trigger trg1 before insert on t1 for each row set @a:= 1; # This should succeed drop database mysqltest; use test; + +# Test for bug #5860 "Multi-table UPDATE does not activate update triggers" +# We will also test how delete triggers wor for multi-table DELETE. +create table t1 (i int, j int default 10, k int not null, key (k)); +create table t2 (i int); +insert into t1 (i, k) values (1, 1); +insert into t2 values (1); +create trigger trg1 before update on t1 for each row set @a:= @a + new.j - old.j; +create trigger trg2 after update on t1 for each row set @b:= "Fired"; +set @a:= 0, @b:= ""; +# Check that trigger works in case of update on the fly +update t1, t2 set j = j + 10 where t1.i = t2.i; +select @a, @b; +insert into t1 values (2, 13, 2); +insert into t2 values (2); +set @a:= 0, @b:= ""; +# And now let us check that triggers work in case of multi-update which +# is done through temporary tables... +update t1, t2 set j = j + 15 where t1.i = t2.i and t1.k >= 2; +select @a, @b; +# Let us test delete triggers for multi-delete now. +# We create triggers for both tables because we want test how they +# work in both on-the-fly and via-temp-tables cases. +create trigger trg3 before delete on t1 for each row set @c:= @c + old.j; +create trigger trg4 before delete on t2 for each row set @d:= @d + old.i; +create trigger trg5 after delete on t1 for each row set @e:= "After delete t1 fired"; +create trigger trg6 after delete on t2 for each row set @f:= "After delete t2 fired"; +set @c:= 0, @d:= 0, @e:= "", @f:= ""; +delete t1, t2 from t1, t2 where t1.i = t2.i; +select @c, @d, @e, @f; +# This also will drop triggers +drop table t1, t2; + +# Test for bug #6812 "Triggers are not activated for INSERT ... SELECT". +# (We also check the fact that trigger modifies some field does not affect +# value of next record inserted). +delimiter |; +create table t1 (i int, j int default 10)| +create table t2 (i int)| +insert into t2 values (1), (2)| +create trigger trg1 before insert on t1 for each row +begin + if new.i = 1 then + set new.j := 1; + end if; +end| +create trigger trg2 after insert on t1 for each row set @a:= 1| +set @a:= 0| +insert into t1 (i) select * from t2| +select * from t1| +select @a| +# This also will drop triggers +drop table t1, t2| +delimiter ;| + +# Test for bug #8755 "Trigger is not activated by LOAD DATA" +create table t1 (i int, j int, k int); +create trigger trg1 before insert on t1 for each row set new.k = new.i; +create trigger trg2 after insert on t1 for each row set @b:= "Fired"; +set @b:=""; +# Test triggers with file with separators +load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i); +select *, @b from t1; +set @b:=""; +# Test triggers with fixed size row file +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); +select *, @b from t1; +# This also will drop triggers +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index 30c134ebdd5..7f241955ec4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4546,40 +4546,40 @@ void Item_insert_value::print(String *str) /* - Bind item representing field of row being changed in trigger - to appropriate Field object. + Find index of Field object which will be appropriate for item + representing field of row being changed in trigger. SYNOPSIS setup_field() thd - current thread context table - table of trigger (and where we looking for fields) - event - type of trigger event NOTE This function does almost the same as fix_fields() for Item_field - but is invoked during trigger definition parsing and takes TABLE - object as its argument. If proper field was not found in table - error will be reported at fix_fields() time. + but is invoked right after trigger definition parsing. Since at + this stage we can't say exactly what Field object (corresponding + to TABLE::record[0] or TABLE::record[1]) should be bound to this + Item, we only find out index of the Field and then select concrete + Field object in fix_fields() (by that time Table_trigger_list::old_field/ + new_field should point to proper array of Fields). + It also binds Item_trigger_field to Table_triggers_list object for + table of trigger which uses this item. */ -void Item_trigger_field::setup_field(THD *thd, TABLE *table, - enum trg_event_type event) + +void Item_trigger_field::setup_field(THD *thd, TABLE *table) { - uint field_idx= (uint)-1; bool save_set_query_id= thd->set_query_id; /* TODO: Think more about consequences of this step. */ thd->set_query_id= 0; - - if (find_field_in_real_table(thd, table, field_name, - strlen(field_name), 0, 0, - &field_idx)) - { - field= (row_version == OLD_ROW && event == TRG_EVENT_UPDATE) ? - table->triggers->old_field[field_idx] : - table->field[field_idx]; - } - + /* + Try to find field by its name and if it will be found + set field_idx properly. + */ + (void)find_field_in_real_table(thd, table, field_name, strlen(field_name), + 0, 0, &field_idx); thd->set_query_id= save_set_query_id; + triggers= table->triggers; } @@ -4604,9 +4604,10 @@ bool Item_trigger_field::fix_fields(THD *thd, */ DBUG_ASSERT(fixed == 0); - if (field) + if (field_idx != (uint)-1) { - // QQ: May be this should be moved to setup_field? + field= (row_version == OLD_ROW) ? triggers->old_field[field_idx] : + triggers->new_field[field_idx]; set_field(field); fixed= 1; return 0; diff --git a/sql/item.h b/sql/item.h index 0e15e539067..7b2344f12d8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1601,13 +1601,18 @@ enum trg_event_type TRG_EVENT_INSERT= 0 , TRG_EVENT_UPDATE= 1, TRG_EVENT_DELETE= 2 }; +class Table_triggers_list; + /* Represents NEW/OLD version of field of row which is changed/read in trigger. - Note: For this item actual binding to Field object happens not during - fix_fields() (like for Item_field) but during parsing of trigger - definition, when table is opened, with special setup_field() call. + Note: For this item main part of actual binding to Field object happens + not during fix_fields() call (like for Item_field) but right after + parsing of trigger definition, when table is opened, with special + setup_field() call. On fix_fields() stage we simply choose one of + two Field instances representing either OLD or NEW version of this + field. */ class Item_trigger_field : public Item_field { @@ -1617,13 +1622,17 @@ public: row_version_type row_version; /* Next in list of all Item_trigger_field's in trigger */ Item_trigger_field *next_trg_field; + /* Index of the field in the TABLE::field array */ + uint field_idx; + /* Pointer to Table_trigger_list object for table of this trigger */ + Table_triggers_list *triggers; Item_trigger_field(row_version_type row_ver_par, const char *field_name_par): Item_field((const char *)NULL, (const char *)NULL, field_name_par), - row_version(row_ver_par) + row_version(row_ver_par), field_idx((uint)-1) {} - void setup_field(THD *thd, TABLE *table, enum trg_event_type event); + void setup_field(THD *thd, TABLE *table); enum Type type() const { return TRIGGER_FIELD_ITEM; } bool eq(const Item *item, bool binary_cmp) const; bool fix_fields(THD *, struct st_table_list *, Item **); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 25490b04ab3..82dceb87ed4 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -924,10 +924,18 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table, bool return_if_owned_by_thd); bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables); void copy_field_from_tmp_record(Field *field,int offset); -bool fill_record(THD *thd, List &fields, List &values, - bool ignore_errors); bool fill_record(THD *thd, Field **field, List &values, bool ignore_errors); +bool fill_record_n_invoke_before_triggers(THD *thd, List &fields, + List &values, + bool ignore_errors, + Table_triggers_list *triggers, + enum trg_event_type event); +bool fill_record_n_invoke_before_triggers(THD *thd, Field **field, + List &values, + bool ignore_errors, + Table_triggers_list *triggers, + enum trg_event_type event); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild); inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index bda5700b273..d431bb7ddca 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3813,7 +3813,7 @@ err_no_arena: TRUE error occured */ -bool +static bool fill_record(THD * thd, List &fields, List &values, bool ignore_errors) { @@ -3839,6 +3839,41 @@ fill_record(THD * thd, List &fields, List &values, } +/* + Fill fields in list with values from the list of items and invoke + before triggers. + + SYNOPSIS + fill_record_n_invoke_before_triggers() + thd thread context + fields Item_fields list to be filled + values values to fill with + ignore_errors TRUE if we should ignore errors + triggers object holding list of triggers to be invoked + event event type for triggers to be invoked + + NOTE + This function assumes that fields which values will be set and triggers + to be invoked belong to the same table, and that TABLE::record[0] and + record[1] buffers correspond to new and old versions of row respectively. + + RETURN + FALSE OK + TRUE error occured +*/ + +bool +fill_record_n_invoke_before_triggers(THD *thd, List &fields, + List &values, bool ignore_errors, + Table_triggers_list *triggers, + enum trg_event_type event) +{ + return (fill_record(thd, fields, values, ignore_errors) || + triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE)); +} + + /* Fill field buffer with values from Field list @@ -3875,6 +3910,41 @@ fill_record(THD *thd, Field **ptr, List &values, bool ignore_errors) } +/* + Fill fields in array with values from the list of items and invoke + before triggers. + + SYNOPSIS + fill_record_n_invoke_before_triggers() + thd thread context + ptr NULL-ended array of fields to be filled + values values to fill with + ignore_errors TRUE if we should ignore errors + triggers object holding list of triggers to be invoked + event event type for triggers to be invoked + + NOTE + This function assumes that fields which values will be set and triggers + to be invoked belong to the same table, and that TABLE::record[0] and + record[1] buffers correspond to new and old versions of row respectively. + + RETURN + FALSE OK + TRUE error occured +*/ + +bool +fill_record_n_invoke_before_triggers(THD *thd, Field **ptr, + List &values, bool ignore_errors, + Table_triggers_list *triggers, + enum trg_event_type event) +{ + return (fill_record(thd, ptr, values, ignore_errors) || + triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE)); +} + + static void mysql_rm_tmp_tables(void) { uint i, idx; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index cded9e2a13e..19e9866597a 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -176,13 +176,24 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (!(select && select->skip_record())&& !thd->net.report_error ) { - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_DELETE, - TRG_ACTION_BEFORE); + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_BEFORE, FALSE)) + { + error= 1; + break; + } if (!(error=table->file->delete_row(table->record[0]))) { deleted++; + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_AFTER, FALSE)) + { + error= 1; + break; + } if (!--limit && using_limit) { error= -1; @@ -203,10 +214,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, error= 1; break; } - - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_DELETE, - TRG_ACTION_AFTER); } else table->file->unlock_row(); // Row failed selection, release lock on it @@ -509,9 +516,19 @@ bool multi_delete::send_data(List &values) if (secure_counter < 0) { /* If this is the table we are scanning */ + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_BEFORE, FALSE)) + DBUG_RETURN(1); table->status|= STATUS_DELETED; if (!(error=table->file->delete_row(table->record[0]))) + { deleted++; + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_AFTER, FALSE)) + DBUG_RETURN(1); + } else if (!table_being_deleted->next_local || table_being_deleted->table->file->has_transactions()) { @@ -614,12 +631,26 @@ int multi_delete::do_deletes(bool from_send_error) info.ignore_not_found_rows= 1; while (!(local_error=info.read_record(&info)) && !thd->killed) { + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_BEFORE, FALSE)) + { + local_error= 1; + break; + } if ((local_error=table->file->delete_row(table->record[0]))) { table->file->print_error(local_error,MYF(0)); break; } deleted++; + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_AFTER, FALSE)) + { + local_error= 1; + break; + } } end_read_record(&info); if (thd->killed && !local_error) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index adb33af05b9..ce90b4ad3e0 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -398,7 +398,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (fields.elements || !value_count) { restore_record(table,s->default_values); // Get empty record - if (fill_record(thd, fields, *values, 0)) + if (fill_record_n_invoke_before_triggers(thd, fields, *values, 0, + table->triggers, + TRG_EVENT_INSERT)) { if (values_list.elements != 1 && !thd->net.report_error) { @@ -419,8 +421,17 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (thd->used_tables) // Column used in values() restore_record(table,s->default_values); // Get empty record else - table->record[0][0]= table->s->default_values[0]; // Fix delete marker - if (fill_record(thd, table->field, *values, 0)) + { + /* + Fix delete marker. No need to restore rest of record since it will + be overwritten by fill_record() anyway (and fill_record() does not + use default values in this case). + */ + table->record[0][0]= table->s->default_values[0]; + } + if (fill_record_n_invoke_before_triggers(thd, table->field, *values, 0, + table->triggers, + TRG_EVENT_INSERT)) { if (values_list.elements != 1 && ! thd->net.report_error) { @@ -432,14 +443,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, } } - /* - FIXME: Actually we should do this before - check_that_all_fields_are_given_values Or even go into write_record ? - */ - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, - TRG_ACTION_BEFORE); - if ((res= table_list->view_check_option(thd, (values_list.elements == 1 ? 0 : @@ -473,9 +476,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (error) break; thd->row_count++; - - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, TRG_ACTION_AFTER); } /* @@ -802,15 +802,35 @@ static int last_uniq_key(TABLE *table,uint keynr) /* - Write a record to table with optional deleting of conflicting records + Write a record to table with optional deleting of conflicting records, + invoke proper triggers if needed. - Sets thd->no_trans_update if table which is updated didn't have transactions + SYNOPSIS + write_record() + thd - thread context + table - table to which record should be written + info - COPY_INFO structure describing handling of duplicates + and which is used for counting number of records inserted + and deleted. + + NOTE + Once this record will be written to table after insert trigger will + be invoked. If instead of inserting new record we will update old one + then both on update triggers will work instead. Similarly both on + delete triggers will be invoked if we will delete conflicting records. + + Sets thd->no_trans_update if table which is updated didn't have + transactions. + + RETURN VALUE + 0 - success + non-0 - error */ int write_record(THD *thd, TABLE *table,COPY_INFO *info) { - int error; + int error, trg_error= 0; char *key=0; DBUG_ENTER("write_record"); @@ -881,25 +901,33 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) restore_record(table,record[1]); DBUG_ASSERT(info->update_fields->elements == info->update_values->elements); - if (fill_record(thd, *info->update_fields, *info->update_values, 0)) - goto err; + if (fill_record_n_invoke_before_triggers(thd, *info->update_fields, + *info->update_values, 0, + table->triggers, + TRG_EVENT_UPDATE)) + goto before_trg_err; /* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */ if (info->view && (res= info->view->view_check_option(current_thd, info->ignore)) == VIEW_CHECK_SKIP) - break; + goto ok_or_after_trg_err; if (res == VIEW_CHECK_ERROR) - goto err; + goto before_trg_err; if ((error=table->file->update_row(table->record[1],table->record[0]))) { if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore) - break; + goto ok_or_after_trg_err; goto err; } info->updated++; - break; + + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_AFTER, TRUE)); + info->copied++; + goto ok_or_after_trg_err; } else /* DUP_REPLACE */ { @@ -916,20 +944,48 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) (table->timestamp_field_type == TIMESTAMP_NO_AUTO_SET || table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)) { + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_BEFORE, TRUE)) + goto before_trg_err; if ((error=table->file->update_row(table->record[1], table->record[0]))) goto err; info->deleted++; - break; /* Update logfile and count */ + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_AFTER, + TRUE)); + /* Update logfile and count */ + info->copied++; + goto ok_or_after_trg_err; + } + else + { + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_BEFORE, TRUE)) + goto before_trg_err; + if ((error=table->file->delete_row(table->record[1]))) + goto err; + info->deleted++; + if (!table->file->has_transactions()) + thd->no_trans_update= 1; + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_DELETE, + TRG_ACTION_AFTER, TRUE)) + { + trg_error= 1; + goto ok_or_after_trg_err; + } + /* Let us attempt do write_row() once more */ } - else if ((error=table->file->delete_row(table->record[1]))) - goto err; - info->deleted++; - if (!table->file->has_transactions()) - thd->no_trans_update= 1; } } info->copied++; + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_INSERT, + TRG_ACTION_AFTER, TRUE)); } else if ((error=table->file->write_row(table->record[0]))) { @@ -939,18 +995,27 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) table->file->restore_auto_increment(); } else + { info->copied++; + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_INSERT, + TRG_ACTION_AFTER, TRUE)); + } + +ok_or_after_trg_err: if (key) my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH); if (!table->file->has_transactions()) thd->no_trans_update= 1; - DBUG_RETURN(0); + DBUG_RETURN(trg_error); err: - if (key) - my_afree(key); info->last_errno= error; table->file->print_error(error,MYF(0)); + +before_trg_err: + if (key) + my_safe_afree(key, table->s->max_unique_length, MAX_KEY_LENGTH); DBUG_RETURN(1); } @@ -2013,12 +2078,27 @@ bool select_insert::send_data(List &values) DBUG_RETURN(1); } } - if (!(error= write_record(thd, table,&info)) && table->next_number_field) + if (!(error= write_record(thd, table, &info))) { - /* Clear for next record */ - table->next_number_field->reset(); - if (! last_insert_id && thd->insert_id_used) - last_insert_id=thd->insert_id(); + if (table->triggers) + { + /* + If triggers exist then whey can modify some fields which were not + originally touched by INSERT ... SELECT, so we have to restore + their original values for the next row. + */ + restore_record(table, s->default_values); + } + if (table->next_number_field) + { + /* + Clear auto-increment field for the next record, if triggers are used + we will clear it twice, but this should be cheap. + */ + table->next_number_field->reset(); + if (!last_insert_id && thd->insert_id_used) + last_insert_id= thd->insert_id(); + } } DBUG_RETURN(error); } @@ -2027,9 +2107,11 @@ bool select_insert::send_data(List &values) void select_insert::store_values(List &values) { if (fields->elements) - fill_record(thd, *fields, values, 1); + fill_record_n_invoke_before_triggers(thd, *fields, values, 1, + table->triggers, TRG_EVENT_INSERT); else - fill_record(thd, table->field, values, 1); + fill_record_n_invoke_before_triggers(thd, table->field, values, 1, + table->triggers, TRG_EVENT_INSERT); } void select_insert::send_error(uint errcode,const char *err) @@ -2172,7 +2254,8 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) void select_create::store_values(List &values) { - fill_record(thd, field, values, 1); + fill_record_n_invoke_before_triggers(thd, field, values, 1, + table->triggers, TRG_EVENT_INSERT); } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index c827bbace3e..1545055f475 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -21,6 +21,8 @@ #include #include #include "sql_repl.h" +#include "sp_head.h" +#include "sql_trigger.h" class READ_INFO { File file; @@ -568,7 +570,11 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count); } - if (fill_record(thd, set_fields, set_values, ignore_check_option_errors)) + if (thd->killed || + fill_record_n_invoke_before_triggers(thd, set_fields, set_values, + ignore_check_option_errors, + table->triggers, + TRG_EVENT_INSERT)) DBUG_RETURN(1); switch (table_list->view_check_option(thd, @@ -580,7 +586,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, DBUG_RETURN(-1); } - if (thd->killed || write_record(thd,table,&info)) + if (write_record(thd, table, &info)) DBUG_RETURN(1); thd->no_trans_update= no_trans_update; @@ -592,8 +598,10 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, */ if (!id && thd->insert_id_used) id= thd->last_insert_id; - if (table->next_number_field) - table->next_number_field->reset(); // Clear for next record + /* + We don't need to reset auto-increment field since we are restoring + its default value at the beginning of each loop iteration. + */ if (read_info.next_line()) // Skip to next line break; if (read_info.line_cuted) @@ -725,7 +733,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, } } - if (fill_record(thd, set_fields, set_values, ignore_check_option_errors)) + if (thd->killed || + fill_record_n_invoke_before_triggers(thd, set_fields, set_values, + ignore_check_option_errors, + table->triggers, + TRG_EVENT_INSERT)) DBUG_RETURN(1); switch (table_list->view_check_option(thd, @@ -738,7 +750,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, } - if (thd->killed || write_record(thd, table, &info)) + if (write_record(thd, table, &info)) DBUG_RETURN(1); /* If auto_increment values are used, save the first one @@ -748,8 +760,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, */ if (!id && thd->insert_id_used) id= thd->last_insert_id; - if (table->next_number_field) - table->next_number_field->reset(); // Clear for next record + /* + We don't need to reset auto-increment field since we are restoring + its default value at the beginning of each loop iteration. + */ thd->no_trans_update= no_trans_update; if (read_info.next_line()) // Skip to next line break; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 670c618bec5..95524a6dfbf 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -85,7 +85,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) DBUG_RETURN(TRUE); } - if (!(table->triggers= new (&table->mem_root) Table_triggers_list())) + if (!(table->triggers= new (&table->mem_root) Table_triggers_list(table))) DBUG_RETURN(TRUE); } @@ -190,17 +190,16 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) to other tables from trigger we won't be able to catch changes in other tables... - To simplify code a bit we have to create Fields for accessing to old row - values if we have ON UPDATE trigger. + Since we don't plan to access to contents of the fields it does not + matter that we choose for both OLD and NEW values the same versions + of Field objects here. */ - if (!old_field && lex->trg_chistics.event == TRG_EVENT_UPDATE && - prepare_old_row_accessors(table)) - return 1; + old_field= new_field= table->field; for (trg_field= (Item_trigger_field *)(lex->trg_table_fields.first); trg_field; trg_field= trg_field->next_trg_field) { - trg_field->setup_field(thd, table, lex->trg_chistics.event); + trg_field->setup_field(thd, table); if (!trg_field->fixed && trg_field->fix_fields(thd, (TABLE_LIST *)0, (Item **)0)) return 1; @@ -318,34 +317,35 @@ Table_triggers_list::~Table_triggers_list() for (int j= 0; j < 2; j++) delete bodies[i][j]; - if (old_field) - for (Field **fld_ptr= old_field; *fld_ptr; fld_ptr++) + if (record1_field) + for (Field **fld_ptr= record1_field; *fld_ptr; fld_ptr++) delete *fld_ptr; } /* - Prepare array of Field objects which will represent OLD.* row values in - ON UPDATE trigger (by referencing to record[1] instead of record[0]). + Prepare array of Field objects referencing to TABLE::record[1] instead + of record[0] (they will represent OLD.* row values in ON UPDATE trigger + and in ON DELETE trigger which will be called during REPLACE execution). SYNOPSIS - prepare_old_row_accessors() + prepare_record1_accessors() table - pointer to TABLE object for which we are creating fields. RETURN VALUE False - success True - error */ -bool Table_triggers_list::prepare_old_row_accessors(TABLE *table) +bool Table_triggers_list::prepare_record1_accessors(TABLE *table) { Field **fld, **old_fld; - if (!(old_field= (Field **)alloc_root(&table->mem_root, - (table->s->fields + 1) * - sizeof(Field*)))) + if (!(record1_field= (Field **)alloc_root(&table->mem_root, + (table->s->fields + 1) * + sizeof(Field*)))) return 1; - for (fld= table->field, old_fld= old_field; *fld; fld++, old_fld++) + for (fld= table->field, old_fld= record1_field; *fld; fld++, old_fld++) { /* QQ: it is supposed that it is ok to use this function for field @@ -406,7 +406,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, parser->type()->length)) { Table_triggers_list *triggers= - new (&table->mem_root) Table_triggers_list(); + new (&table->mem_root) Table_triggers_list(table); if (!triggers) DBUG_RETURN(1); @@ -417,8 +417,11 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, table->triggers= triggers; - /* TODO: This could be avoided if there is no ON UPDATE trigger. */ - if (triggers->prepare_old_row_accessors(table)) + /* + TODO: This could be avoided if there is no triggers + for UPDATE and DELETE. + */ + if (triggers->prepare_record1_accessors(table)) DBUG_RETURN(1); List_iterator_fast it(triggers->definitions_list); @@ -478,7 +481,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, (Item_trigger_field *)(lex.trg_table_fields.first); trg_field; trg_field= trg_field->next_trg_field) - trg_field->setup_field(thd, table, lex.trg_chistics.event); + trg_field->setup_field(thd, table); lex_end(&lex); } diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 90c906fc72f..d61da8ff06b 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -8,10 +8,20 @@ class Table_triggers_list: public Sql_alloc /* Triggers as SPs grouped by event, action_time */ sp_head *bodies[3][2]; /* - Copy of TABLE::Field array with field pointers set to old version - of record, used for OLD values in trigger on UPDATE. + Copy of TABLE::Field array with field pointers set to TABLE::record[1] + buffer instead of TABLE::record[0] (used for OLD values in on UPDATE + trigger and DELETE trigger when it is called for REPLACE). */ + Field **record1_field; + /* + During execution of trigger new_field and old_field should point to the + array of fields representing new or old version of row correspondingly + (so it can point to TABLE::field or to Tale_triggers_list::record1_field) + */ + Field **new_field; Field **old_field; + /* TABLE instance for which this triggers list object was created */ + TABLE *table; /* Names of triggers. Should correspond to order of triggers on definitions_list, @@ -26,8 +36,8 @@ public: */ List definitions_list; - Table_triggers_list(): - old_field(0) + Table_triggers_list(TABLE *table_arg): + record1_field(0), table(table_arg) { bzero((char *)bodies, sizeof(bodies)); } @@ -36,7 +46,8 @@ public: bool create_trigger(THD *thd, TABLE_LIST *table); bool drop_trigger(THD *thd, TABLE_LIST *table); bool process_triggers(THD *thd, trg_event_type event, - trg_action_time_type time_type) + trg_action_time_type time_type, + bool old_row_is_record1) { int res= 0; @@ -48,6 +59,17 @@ public: thd->net.no_send_ok= TRUE; #endif + if (old_row_is_record1) + { + old_field= record1_field; + new_field= table->field; + } + else + { + new_field= record1_field; + old_field= table->field; + } + /* FIXME: We should juggle with security context here (because trigger should be invoked with creator rights). @@ -79,8 +101,13 @@ public: bodies[TRG_EVENT_DELETE][TRG_ACTION_AFTER]); } + bool has_before_update_triggers() + { + return test(bodies[TRG_EVENT_UPDATE][TRG_ACTION_BEFORE]); + } + friend class Item_trigger_field; private: - bool prepare_old_row_accessors(TABLE *table); + bool prepare_record1_accessors(TABLE *table); }; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 95268c41aed..291f829a4e3 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -398,14 +398,13 @@ int mysql_update(THD *thd, if (!(select && select->skip_record())) { store_record(table,record[1]); - if (fill_record(thd, fields, values, 0)) + if (fill_record_n_invoke_before_triggers(thd, fields, values, 0, + table->triggers, + TRG_EVENT_UPDATE)) break; /* purecov: inspected */ found++; - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_BEFORE); - if (compare_record(table, query_id)) { if ((res= table_list->view_check_option(thd, ignore)) != @@ -425,6 +424,14 @@ int mysql_update(THD *thd, { updated++; thd->no_trans_update= !transactional_table; + + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_AFTER, TRUE)) + { + error= 1; + break; + } } else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY) { @@ -435,9 +442,6 @@ int mysql_update(THD *thd, } } - if (table->triggers) - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER); - if (!--limit && using_limit) { error= -1; // Simulate end of file @@ -1073,8 +1077,8 @@ multi_update::initialize_tables(JOIN *join) NOTES We can update the first table in join on the fly if we know that - a row in this tabel will never be read twice. This is true under - the folloing conditions: + a row in this table will never be read twice. This is true under + the following conditions: - We are doing a table scan and the data is in a separate file (MyISAM) or if we don't update a clustered key. @@ -1082,6 +1086,10 @@ multi_update::initialize_tables(JOIN *join) - We are doing a range scan and we don't update the scan key or the primary key for a clustered table handler. + When checking for above cases we also should take into account that + BEFORE UPDATE trigger potentially may change value of any field in row + being updated. + WARNING This code is a bit dependent of how make_join_readinfo() works. @@ -1099,15 +1107,21 @@ static bool safe_update_on_fly(JOIN_TAB *join_tab, List *fields) case JT_EQ_REF: return TRUE; // At most one matching row case JT_REF: - return !check_if_key_used(table, join_tab->ref.key, *fields); + return !check_if_key_used(table, join_tab->ref.key, *fields) && + !(table->triggers && + table->triggers->has_before_update_triggers()); case JT_ALL: /* If range search on index */ if (join_tab->quick) - return !join_tab->quick->check_if_keys_used(fields); + return !join_tab->quick->check_if_keys_used(fields) && + !(table->triggers && + table->triggers->has_before_update_triggers()); /* If scanning in clustered key */ if ((table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && table->s->primary_key < MAX_KEY) - return !check_if_key_used(table, table->s->primary_key, *fields); + return !check_if_key_used(table, table->s->primary_key, *fields) && + !(table->triggers && + table->triggers->has_before_update_triggers()); return TRUE; default: break; // Avoid compler warning @@ -1170,8 +1184,10 @@ bool multi_update::send_data(List ¬_used_values) { table->status|= STATUS_UPDATED; store_record(table,record[1]); - if (fill_record(thd, *fields_for_table[offset], - *values_for_table[offset], 0)) + if (fill_record_n_invoke_before_triggers(thd, *fields_for_table[offset], + *values_for_table[offset], 0, + table->triggers, + TRG_EVENT_UPDATE)) DBUG_RETURN(1); found++; @@ -1207,8 +1223,15 @@ bool multi_update::send_data(List ¬_used_values) DBUG_RETURN(1); } } - else if (!table->file->has_transactions()) - thd->no_trans_update= 1; + else + { + if (!table->file->has_transactions()) + thd->no_trans_update= 1; + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_AFTER, TRUE)) + DBUG_RETURN(1); + } } } else @@ -1329,6 +1352,11 @@ int multi_update::do_updates(bool from_send_error) copy_field_ptr++) (*copy_field_ptr->do_copy)(copy_field_ptr); + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_BEFORE, TRUE)) + goto err2; + if (compare_record(table, thd->query_id)) { if ((local_error=table->file->update_row(table->record[1], @@ -1338,6 +1366,11 @@ int multi_update::do_updates(bool from_send_error) goto err; } updated++; + + if (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, + TRG_ACTION_AFTER, TRUE)) + goto err2; } } @@ -1360,6 +1393,7 @@ err: table->file->print_error(local_error,MYF(0)); } +err2: (void) table->file->ha_rnd_end(); (void) tmp_table->file->ha_rnd_end(); From e2c8f63ed4288f6b195002138dd419abdc1636f2 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 24 May 2005 21:02:42 +0200 Subject: [PATCH 34/78] simplifying new/my_arg_new wrapping --- include/my_global.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/my_global.h b/include/my_global.h index f059d603976..d7cda085353 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -289,12 +289,14 @@ C_MODE_START int __cxa_pure_virtual() {\ #endif #if defined(__ia64__) #define new my_arg_new +#define need_to_restore_new 1 #endif C_MODE_START #include C_MODE_END -#if defined(__ia64__) +#ifdef need_to_restore_new /* probably safer than #ifdef new */ #undef new +#undef need_to_restore_new #endif #endif #include /* Recommended by debian */ From 1dabee5aad6d4942c57014c9d9b548a0bb060c1d Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com" <> Date: Wed, 25 May 2005 00:15:06 +0500 Subject: [PATCH 35/78] Upgrade yaSSL to 0.9.9. --- extra/yassl/include/factory.hpp | 2 +- extra/yassl/include/yassl_int.hpp | 2 +- extra/yassl/include/yassl_types.hpp | 10 - extra/yassl/src/buffer.cpp | 12 +- extra/yassl/src/cert_wrapper.cpp | 24 +-- extra/yassl/src/crypto_wrapper.cpp | 58 +++--- extra/yassl/src/handshake.cpp | 30 +-- extra/yassl/src/ssl.cpp | 4 +- extra/yassl/src/yassl_imp.cpp | 79 ++++--- extra/yassl/src/yassl_int.cpp | 127 +++++------ extra/yassl/taocrypt/include/aes.hpp | 5 +- extra/yassl/taocrypt/include/algebra.hpp | 126 ++--------- extra/yassl/taocrypt/include/block.hpp | 20 +- extra/yassl/taocrypt/include/des.hpp | 5 +- extra/yassl/taocrypt/include/error.hpp | 3 +- extra/yassl/taocrypt/include/hash.hpp | 2 +- extra/yassl/taocrypt/include/integer.hpp | 10 +- extra/yassl/taocrypt/include/misc.hpp | 11 - extra/yassl/taocrypt/include/modarith.hpp | 13 +- extra/yassl/taocrypt/include/modes.hpp | 55 +++-- extra/yassl/taocrypt/src/algebra.cpp | 99 ++++----- extra/yassl/taocrypt/src/asn.cpp | 20 +- extra/yassl/taocrypt/src/dh.cpp | 1 - extra/yassl/taocrypt/src/dsa.cpp | 2 - extra/yassl/taocrypt/src/integer.cpp | 243 +--------------------- extra/yassl/taocrypt/src/misc.cpp | 27 --- extra/yassl/taocrypt/src/random.cpp | 1 - extra/yassl/taocrypt/src/rsa.cpp | 7 - 28 files changed, 283 insertions(+), 715 deletions(-) diff --git a/extra/yassl/include/factory.hpp b/extra/yassl/include/factory.hpp index 96798466352..7f7aaf8bd7f 100644 --- a/extra/yassl/include/factory.hpp +++ b/extra/yassl/include/factory.hpp @@ -67,7 +67,7 @@ public: init(*this); } - // reservce place in vector before registering, used by init funcion + // reserve place in vector before registering, used by init funcion void Reserve(size_t sz) { callbacks_.reserve(sz); diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index 02895d3897b..c9168254907 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -31,8 +31,8 @@ #include "yassl_imp.hpp" #include "crypto_wrapper.hpp" #include "cert_wrapper.hpp" -#include "lock.hpp" #include "log.hpp" +#include "lock.hpp" namespace yaSSL { diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp index 1ad4998bade..28f673f920d 100644 --- a/extra/yassl/include/yassl_types.hpp +++ b/extra/yassl/include/yassl_types.hpp @@ -29,16 +29,6 @@ #include -namespace yaSSL { - -// library allocation -struct new_t {}; // yaSSL New type -extern new_t ys; // pass in parameter - -} // namespace yaSSL - -void* operator new (size_t, yaSSL::new_t); -void* operator new[](size_t, yaSSL::new_t); namespace yaSSL { diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index c97103c6f6d..6dc8845559c 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -62,13 +62,13 @@ input_buffer::input_buffer() input_buffer::input_buffer(uint s) - : size_(0), current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(new byte[s]), end_(buffer_ + s) {} // with assign input_buffer::input_buffer(uint s, const byte* t, uint len) - : size_(0), current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(new byte[s]), end_(buffer_ + s) { assign(t, len); } @@ -84,7 +84,7 @@ input_buffer::~input_buffer() void input_buffer::allocate(uint s) { assert(!buffer_); // find realloc error - buffer_ = new (ys) byte[s]; + buffer_ = new byte[s]; end_ = buffer_ + s; } @@ -198,13 +198,13 @@ output_buffer::output_buffer() // with allocate output_buffer::output_buffer(uint s) - : current_(0), buffer_(new (ys) byte[s]), end_(buffer_ + s) + : current_(0), buffer_(new byte[s]), end_(buffer_ + s) {} // with assign output_buffer::output_buffer(uint s, const byte* t, uint len) - : current_(0), buffer_(new (ys) byte[s]), end_(buffer_+ s) + : current_(0), buffer_(new byte[s]), end_(buffer_+ s) { write(t, len); } @@ -239,7 +239,7 @@ void output_buffer::set_current(uint c) void output_buffer::allocate(uint s) { assert(!buffer_); // find realloc error - buffer_ = new (ys) byte[s]; end_ = buffer_ + s; + buffer_ = new byte[s]; end_ = buffer_ + s; } diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp index 98861d01287..33c1fee6ec3 100644 --- a/extra/yassl/src/cert_wrapper.cpp +++ b/extra/yassl/src/cert_wrapper.cpp @@ -39,7 +39,7 @@ namespace yaSSL { -x509::x509(uint sz) : length_(sz), buffer_(new (ys) opaque[sz]) +x509::x509(uint sz) : length_(sz), buffer_(new opaque[sz]) { } @@ -51,7 +51,7 @@ x509::~x509() x509::x509(const x509& that) : length_(that.length_), - buffer_(new (ys) opaque[length_]) + buffer_(new opaque[length_]) { memcpy(buffer_, that.buffer_, length_); } @@ -153,7 +153,7 @@ void CertManager::AddPeerCert(x509* x) void CertManager::CopySelfCert(const x509* x) { if (x) - list_.push_back(new (ys) x509(*x)); + list_.push_back(new x509(*x)); } @@ -165,7 +165,7 @@ int CertManager::CopyCaCert(const x509* x) if (!cert.GetError().What()) { const TaoCrypt::PublicKey& key = cert.GetPublicKey(); - signers_.push_back(new (ys) TaoCrypt::Signer(key.GetKey(), key.size(), + signers_.push_back(new TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); } return cert.GetError().What(); @@ -234,7 +234,7 @@ int CertManager::Validate() return err; const TaoCrypt::PublicKey& key = cert.GetPublicKey(); - signers_.push_back(new (ys) TaoCrypt::Signer(key.GetKey(), key.size(), + signers_.push_back(new TaoCrypt::Signer(key.GetKey(), key.size(), cert.GetCommonName(), cert.GetHash())); --last; --count; @@ -259,7 +259,7 @@ int CertManager::Validate() int iSz = cert.GetIssuer() ? strlen(cert.GetIssuer()) + 1 : 0; int sSz = cert.GetCommonName() ? strlen(cert.GetCommonName()) + 1 : 0; - peerX509_ = new (ys) X509(cert.GetIssuer(), iSz, cert.GetCommonName(), + peerX509_ = new X509(cert.GetIssuer(), iSz, cert.GetCommonName(), sSz); } return 0; @@ -273,13 +273,13 @@ int CertManager::SetPrivateKey(const x509& key) privateKey_.assign(key.get_buffer(), key.get_length()); // set key type - if (x509* cert509 = list_.front()) { - TaoCrypt::Source source(cert509->get_buffer(), cert509->get_length()); - TaoCrypt::CertDecoder cert(source, false); - cert.DecodeToKey(); - if (int err = cert.GetError().What()) + if (x509* cert = list_.front()) { + TaoCrypt::Source source(cert->get_buffer(), cert->get_length()); + TaoCrypt::CertDecoder cd(source, false); + cd.DecodeToKey(); + if (int err = cd.GetError().What()) return err; - if (cert.GetKeyType() == TaoCrypt::RSAk) + if (cd.GetKeyType() == TaoCrypt::RSAk) keyType_ = rsa_sa_algo; else keyType_ = dsa_sa_algo; diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index c083c56f313..e6b28cd9302 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -58,13 +58,13 @@ struct MD5::MD5Impl { }; -MD5::MD5() : pimpl_(new (ys) MD5Impl) {} +MD5::MD5() : pimpl_(new MD5Impl) {} MD5::~MD5() { delete pimpl_; } -MD5::MD5(const MD5& that) : Digest(), pimpl_(new (ys) +MD5::MD5(const MD5& that) : Digest(), pimpl_(new MD5Impl(that.pimpl_->md5_)) {} @@ -116,14 +116,13 @@ struct SHA::SHAImpl { }; -SHA::SHA() : pimpl_(new (ys) SHAImpl) {} +SHA::SHA() : pimpl_(new SHAImpl) {} SHA::~SHA() { delete pimpl_; } -SHA::SHA(const SHA& that) : Digest(), pimpl_(new (ys) - SHAImpl(that.pimpl_->sha_)) {} +SHA::SHA(const SHA& that) : Digest(), pimpl_(new SHAImpl(that.pimpl_->sha_)) {} SHA& SHA::operator=(const SHA& that) { @@ -174,14 +173,13 @@ struct RMD::RMDImpl { }; -RMD::RMD() : pimpl_(new (ys) RMDImpl) {} +RMD::RMD() : pimpl_(new RMDImpl) {} RMD::~RMD() { delete pimpl_; } -RMD::RMD(const RMD& that) : Digest(), pimpl_(new (ys) - RMDImpl(that.pimpl_->rmd_)) {} +RMD::RMD(const RMD& that) : Digest(), pimpl_(new RMDImpl(that.pimpl_->rmd_)) {} RMD& RMD::operator=(const RMD& that) { @@ -232,7 +230,7 @@ struct HMAC_MD5::HMAC_MD5Impl { HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_MD5Impl) + : pimpl_(new HMAC_MD5Impl) { pimpl_->mac_.SetKey(secret, len); } @@ -282,7 +280,7 @@ struct HMAC_SHA::HMAC_SHAImpl { HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_SHAImpl) + : pimpl_(new HMAC_SHAImpl) { pimpl_->mac_.SetKey(secret, len); } @@ -333,7 +331,7 @@ struct HMAC_RMD::HMAC_RMDImpl { HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_RMDImpl) + : pimpl_(new HMAC_RMDImpl) { pimpl_->mac_.SetKey(secret, len); } @@ -381,7 +379,7 @@ struct DES::DESImpl { }; -DES::DES() : pimpl_(new (ys) DESImpl) {} +DES::DES() : pimpl_(new DESImpl) {} DES::~DES() { delete pimpl_; } @@ -417,7 +415,7 @@ struct DES_EDE::DES_EDEImpl { }; -DES_EDE::DES_EDE() : pimpl_(new (ys) DES_EDEImpl) {} +DES_EDE::DES_EDE() : pimpl_(new DES_EDEImpl) {} DES_EDE::~DES_EDE() { delete pimpl_; } @@ -455,7 +453,7 @@ struct RC4::RC4Impl { }; -RC4::RC4() : pimpl_(new (ys) RC4Impl) {} +RC4::RC4() : pimpl_(new RC4Impl) {} RC4::~RC4() { delete pimpl_; } @@ -497,7 +495,7 @@ struct AES::AESImpl { }; -AES::AES(unsigned int ks) : pimpl_(new (ys) AESImpl(ks)) {} +AES::AES(unsigned int ks) : pimpl_(new AESImpl(ks)) {} AES::~AES() { delete pimpl_; } @@ -538,7 +536,7 @@ struct RandomPool::RandomImpl { TaoCrypt::RandomNumberGenerator RNG_; }; -RandomPool::RandomPool() : pimpl_(new (ys) RandomImpl) {} +RandomPool::RandomPool() : pimpl_(new RandomImpl) {} RandomPool::~RandomPool() { delete pimpl_; } @@ -582,7 +580,7 @@ void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz) // Set public or private key DSS::DSS(const byte* key, unsigned int sz, bool publicKey) - : pimpl_(new (ys) DSSImpl) + : pimpl_(new DSSImpl) { if (publicKey) pimpl_->SetPublic(key, sz); @@ -653,7 +651,7 @@ void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz) // Set public or private key RSA::RSA(const byte* key, unsigned int sz, bool publicKey) - : pimpl_(new (ys) RSAImpl) + : pimpl_(new RSAImpl) { if (publicKey) pimpl_->SetPublic(key, sz); @@ -725,13 +723,13 @@ struct Integer::IntegerImpl { explicit IntegerImpl(const TaoCrypt::Integer& i) : int_(i) {} }; -Integer::Integer() : pimpl_(new (ys) IntegerImpl) {} +Integer::Integer() : pimpl_(new IntegerImpl) {} Integer::~Integer() { delete pimpl_; } -Integer::Integer(const Integer& other) : pimpl_(new (ys) +Integer::Integer(const Integer& other) : pimpl_(new IntegerImpl(other.pimpl_->int_)) {} @@ -770,9 +768,9 @@ struct DiffieHellman::DHImpl { void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) { - publicKey_ = new (ys) byte[pubSz]; - privateKey_ = new (ys) byte[privSz]; - agreedKey_ = new (ys) byte[agrSz]; + publicKey_ = new byte[pubSz]; + privateKey_ = new byte[privSz]; + agreedKey_ = new byte[agrSz]; } }; @@ -781,7 +779,7 @@ struct DiffieHellman::DHImpl { /* // server Side DH, server's view DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) - : pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) + : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using namespace TaoCrypt; Source source; @@ -805,12 +803,12 @@ DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, unsigned int gSz, const byte* pub, unsigned int pubSz, const RandomPool& random) - : pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) + : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); - pimpl_->publicKey_ = new (ys) opaque[pubSz]; + pimpl_->publicKey_ = new opaque[pubSz]; memcpy(pimpl_->publicKey_, pub, pubSz); } @@ -818,7 +816,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, // Server Side DH, server's view DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, const RandomPool& random) -: pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) +: pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; @@ -836,7 +834,7 @@ DiffieHellman::~DiffieHellman() { delete pimpl_; } // Client side and view, use server that for p and g DiffieHellman::DiffieHellman(const DiffieHellman& that) - : pimpl_(new (ys) DHImpl(*that.pimpl_)) + : pimpl_(new DHImpl(*that.pimpl_)) { pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, pimpl_->publicKey_); @@ -957,7 +955,7 @@ x509* PemToDer(const char* fname, CertType type) Base64Decoder b64Dec(der); uint sz = der.size(); - mySTL::auto_ptr x(new (ys) x509(sz)); + mySTL::auto_ptr x(new x509(sz)); memcpy(x->use_buffer(), der.get_buffer(), sz); fclose(file); @@ -971,8 +969,6 @@ x509* PemToDer(const char* fname, CertType type) template class TaoCrypt::HMAC; template class TaoCrypt::HMAC; template class TaoCrypt::HMAC; -template class TaoCrypt::Mode_BASE<16>; -template class TaoCrypt::Mode_BASE<8>; #endif #endif // !USE_CRYPTOPP_LIB diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 35c4cbd4922..28872e50063 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -362,9 +362,9 @@ void p_hash(output_buffer& result, const output_buffer& secret, if (lastLen) times += 1; if (hash == md5) - hmac.reset(new (ys) HMAC_MD5(secret.get_buffer(), secret.get_size())); + hmac.reset(new HMAC_MD5(secret.get_buffer(), secret.get_size())); else - hmac.reset(new (ys) HMAC_SHA(secret.get_buffer(), secret.get_size())); + hmac.reset(new HMAC_SHA(secret.get_buffer(), secret.get_size())); // A0 = seed hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1 uint lastTime = times - 1; @@ -582,11 +582,11 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz, MACAlgorithm algo = ssl.getSecurity().get_parms().mac_algorithm_; if (algo == sha) - hmac.reset(new (ys) HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); + hmac.reset(new HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); else if (algo == rmd) - hmac.reset(new (ys) HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); + hmac.reset(new HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); else - hmac.reset(new (ys) HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); + hmac.reset(new HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); hmac->update(seq, SEQ_SZ); // seq_num inner[0] = content; // type @@ -687,7 +687,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr buffered) // make sure we have enough input in buffer to process this record if (hdr.length_ > buffer.get_remaining()) { uint sz = buffer.get_remaining() + RECORD_HEADER; - buffered.reset(new (ys) input_buffer(sz, buffer.get_buffer() + + buffered.reset(new input_buffer(sz, buffer.get_buffer() + buffer.get_current() - RECORD_HEADER, sz)); break; } @@ -760,7 +760,7 @@ void sendClientKeyExchange(SSL& ssl, BufferOutput buffer) RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, ck); buildOutput(*out.get(), rlHeader, hsHeader, ck); hashHandShake(ssl, *out.get()); @@ -781,7 +781,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer) RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, sk); buildOutput(*out.get(), rlHeader, hsHeader, sk); hashHandShake(ssl, *out.get()); @@ -806,7 +806,7 @@ void sendChangeCipher(SSL& ssl, BufferOutput buffer) ChangeCipherSpec ccs; RecordLayerHeader rlHeader; buildHeader(ssl, rlHeader, ccs); - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildOutput(*out.get(), rlHeader, ccs); if (buffer == buffered) @@ -823,7 +823,7 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer) Finished fin; buildFinished(ssl, fin, side == client_end ? client : server); - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); cipherFinished(ssl, fin, *out.get()); // hashes handshake if (ssl.getSecurity().get_resuming()) { @@ -907,7 +907,7 @@ void sendServerHello(SSL& ssl, BufferOutput buffer) ServerHello sh(ssl.getSecurity().get_connection().version_); RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildServerHello(ssl, sh); ssl.set_random(sh.get_random(), server_end); @@ -930,7 +930,7 @@ void sendServerHelloDone(SSL& ssl, BufferOutput buffer) ServerHelloDone shd; RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, shd); buildOutput(*out.get(), rlHeader, hsHeader, shd); @@ -951,7 +951,7 @@ void sendCertificate(SSL& ssl, BufferOutput buffer) Certificate cert(ssl.getCrypto().get_certManager().get_cert()); RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, cert); buildOutput(*out.get(), rlHeader, hsHeader, cert); @@ -973,7 +973,7 @@ void sendCertificateRequest(SSL& ssl, BufferOutput buffer) request.Build(); RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, request); buildOutput(*out.get(), rlHeader, hsHeader, request); @@ -995,7 +995,7 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer) verify.Build(ssl); RecordLayerHeader rlHeader; HandShakeHeader hsHeader; - mySTL::auto_ptr out(new (ys) output_buffer); + mySTL::auto_ptr out(new output_buffer); buildHeaders(ssl, hsHeader, rlHeader, verify); buildOutput(*out.get(), rlHeader, hsHeader, verify); diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 53bd8a75ab6..b0d9dcca902 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -443,7 +443,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) fseek(input, 0, SEEK_END); long sz = ftell(input); rewind(input); - x = new (ys) x509(sz); // takes ownership + x = new x509(sz); // takes ownership size_t bytes = fread(x->use_buffer(), sz, 1, input); if (bytes != 1) { fclose(input); @@ -663,7 +663,7 @@ BIGNUM* BN_bin2bn(const unsigned char* num, int sz, BIGNUM* retVal) if (!retVal) { created = true; - bn.reset(new (ys) BIGNUM); + bn.reset(new BIGNUM); retVal = bn.get(); } diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index c1485cce986..02654727f78 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -134,10 +134,10 @@ void DH_Server::build(SSL& ssl) const CertManager& cert = ssl.getCrypto().get_certManager(); if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) - auth.reset(new (ys) RSA(cert.get_privateKey(), + auth.reset(new RSA(cert.get_privateKey(), cert.get_privateKeyLength(), false)); else { - auth.reset(new (ys) DSS(cert.get_privateKey(), + auth.reset(new DSS(cert.get_privateKey(), cert.get_privateKeyLength(), false)); sigSz += DSS_ENCODED_EXTRA; } @@ -168,7 +168,7 @@ void DH_Server::build(SSL& ssl) byte hash[FINISHED_SZ]; MD5 md5; SHA sha; - signature_ = new (ys) byte[sigSz]; + signature_ = new byte[sigSz]; const Connection& conn = ssl.getSecurity().get_connection(); // md5 @@ -199,7 +199,7 @@ void DH_Server::build(SSL& ssl) tmp.write(signature_, sigSz); // key message - keyMessage_ = new (ys) opaque[length_]; + keyMessage_ = new opaque[length_]; memcpy(keyMessage_, tmp.get_buffer(), tmp.get_size()); } @@ -253,7 +253,7 @@ opaque* EncryptedPreMasterSecret::get_clientKey() const void EncryptedPreMasterSecret::alloc(int sz) { length_ = sz; - secret_ = new (ys) opaque[sz]; + secret_ = new opaque[sz]; } @@ -303,7 +303,7 @@ opaque* ClientDiffieHellmanPublic::get_clientKey() const void ClientDiffieHellmanPublic::alloc(int sz, bool offset) { length_ = sz + (offset ? KEY_OFFSET : 0); - Yc_ = new (ys) opaque[length_]; + Yc_ = new opaque[length_]; } @@ -348,7 +348,7 @@ void DH_Server::read(SSL& ssl, input_buffer& input) tmp[1] = input[AUTO]; ato16(tmp, length); - signature_ = new (ys) byte[length]; + signature_ = new byte[length]; input.read(signature_, length); // verify signature @@ -386,7 +386,7 @@ void DH_Server::read(SSL& ssl, input_buffer& input) } // save input - ssl.useCrypto().SetDH(new (ys) DiffieHellman(parms_.get_p(), + ssl.useCrypto().SetDH(new DiffieHellman(parms_.get_p(), parms_.get_pSize(), parms_.get_g(), parms_.get_gSize(), parms_.get_pub(), parms_.get_pubSize(), ssl.getCrypto().get_random())); @@ -928,7 +928,7 @@ void Data::Process(input_buffer& input, SSL& ssl) // read data if (dataSz) { input_buffer* data; - ssl.addData(data = new (ys) input_buffer(dataSz)); + ssl.addData(data = new input_buffer(dataSz)); input.read(data->get_buffer(), dataSz); data->add_size(dataSz); @@ -1025,7 +1025,7 @@ void Certificate::Process(input_buffer& input, SSL& ssl) c24to32(tmp, cert_sz); x509* myCert; - cm.AddPeerCert(myCert = new (ys) x509(cert_sz)); + cm.AddPeerCert(myCert = new x509(cert_sz)); input.read(myCert->use_buffer(), myCert->get_length()); list_sz -= cert_sz + CERT_HEADER; @@ -1111,21 +1111,21 @@ const opaque* ServerDHParams::get_pub() const opaque* ServerDHParams::alloc_p(int sz) { - p_ = new (ys) opaque[pSz_ = sz]; + p_ = new opaque[pSz_ = sz]; return p_; } opaque* ServerDHParams::alloc_g(int sz) { - g_ = new (ys) opaque[gSz_ = sz]; + g_ = new opaque[gSz_ = sz]; return g_; } opaque* ServerDHParams::alloc_pub(int sz) { - Ys_ = new (ys) opaque[pubSz_ = sz]; + Ys_ = new opaque[pubSz_ = sz]; return Ys_; } @@ -1537,7 +1537,7 @@ void CertificateRequest::Build() for (int j = 0; j < authCount; j++) { int sz = REQUEST_HEADER + MIN_DIS_SIZE; DistinguishedName dn; - certificate_authorities_.push_back(dn = new (ys) byte[sz]); + certificate_authorities_.push_back(dn = new byte[sz]); opaque tmp[REQUEST_HEADER]; c16toa(MIN_DIS_SIZE, tmp); @@ -1584,7 +1584,7 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request) ato16(tmp, dnSz); DistinguishedName dn; - request.certificate_authorities_.push_back(dn = new (ys) + request.certificate_authorities_.push_back(dn = new byte[REQUEST_HEADER + dnSz]); memcpy(dn, tmp, REQUEST_HEADER); input.read(&dn[REQUEST_HEADER], dnSz); @@ -1665,7 +1665,7 @@ void CertificateVerify::Build(SSL& ssl) RSA rsa(cert.get_privateKey(), cert.get_privateKeyLength(), false); sz = rsa.get_cipherLength() + VERIFY_HEADER; - sig.reset(new (ys) byte[sz]); + sig.reset(new byte[sz]); c16toa(sz - VERIFY_HEADER, len); memcpy(sig.get(), len, VERIFY_HEADER); @@ -1676,7 +1676,7 @@ void CertificateVerify::Build(SSL& ssl) DSS dss(cert.get_privateKey(), cert.get_privateKeyLength(), false); sz = DSS_SIG_SZ + DSS_ENCODED_EXTRA + VERIFY_HEADER; - sig.reset(new (ys) byte[sz]); + sig.reset(new byte[sz]); c16toa(sz - VERIFY_HEADER, len); memcpy(sig.get(), len, VERIFY_HEADER); @@ -1714,7 +1714,7 @@ input_buffer& operator>>(input_buffer& input, CertificateVerify& request) ato16(tmp, sz); request.set_length(sz); - request.signature_ = new (ys) byte[sz]; + request.signature_ = new byte[sz]; input.read(request.signature_, sz); return input; @@ -1975,7 +1975,7 @@ Connection::~Connection() void Connection::AllocPreSecret(uint sz) { - pre_master_secret_ = new (ys) opaque[pre_secret_len_ = sz]; + pre_master_secret_ = new opaque[pre_secret_len_ = sz]; } @@ -2011,35 +2011,35 @@ void Connection::CleanPreMaster() // Create functions for message factory -Message* CreateCipherSpec() { return new (ys) ChangeCipherSpec; } -Message* CreateAlert() { return new (ys) Alert; } -Message* CreateHandShake() { return new (ys) HandShakeHeader; } -Message* CreateData() { return new (ys) Data; } +Message* CreateCipherSpec() { return new ChangeCipherSpec; } +Message* CreateAlert() { return new Alert; } +Message* CreateHandShake() { return new HandShakeHeader; } +Message* CreateData() { return new Data; } // Create functions for handshake factory -HandShakeBase* CreateHelloRequest() { return new (ys) HelloRequest; } -HandShakeBase* CreateClientHello() { return new (ys) ClientHello; } -HandShakeBase* CreateServerHello() { return new (ys) ServerHello; } -HandShakeBase* CreateCertificate() { return new (ys) Certificate; } -HandShakeBase* CreateServerKeyExchange() { return new (ys) ServerKeyExchange;} -HandShakeBase* CreateCertificateRequest() { return new (ys) +HandShakeBase* CreateHelloRequest() { return new HelloRequest; } +HandShakeBase* CreateClientHello() { return new ClientHello; } +HandShakeBase* CreateServerHello() { return new ServerHello; } +HandShakeBase* CreateCertificate() { return new Certificate; } +HandShakeBase* CreateServerKeyExchange() { return new ServerKeyExchange;} +HandShakeBase* CreateCertificateRequest() { return new CertificateRequest; } -HandShakeBase* CreateServerHelloDone() { return new (ys) ServerHelloDone; } -HandShakeBase* CreateCertificateVerify() { return new (ys) CertificateVerify;} -HandShakeBase* CreateClientKeyExchange() { return new (ys) ClientKeyExchange;} -HandShakeBase* CreateFinished() { return new (ys) Finished; } +HandShakeBase* CreateServerHelloDone() { return new ServerHelloDone; } +HandShakeBase* CreateCertificateVerify() { return new CertificateVerify;} +HandShakeBase* CreateClientKeyExchange() { return new ClientKeyExchange;} +HandShakeBase* CreateFinished() { return new Finished; } // Create functions for server key exchange factory -ServerKeyBase* CreateRSAServerKEA() { return new (ys) RSA_Server; } -ServerKeyBase* CreateDHServerKEA() { return new (ys) DH_Server; } -ServerKeyBase* CreateFortezzaServerKEA() { return new (ys) Fortezza_Server; } +ServerKeyBase* CreateRSAServerKEA() { return new RSA_Server; } +ServerKeyBase* CreateDHServerKEA() { return new DH_Server; } +ServerKeyBase* CreateFortezzaServerKEA() { return new Fortezza_Server; } // Create functions for client key exchange factory -ClientKeyBase* CreateRSAClient() { return new (ys) +ClientKeyBase* CreateRSAClient() { return new EncryptedPreMasterSecret; } -ClientKeyBase* CreateDHClient() { return new (ys) +ClientKeyBase* CreateDHClient() { return new ClientDiffieHellmanPublic; } -ClientKeyBase* CreateFortezzaClient() { return new (ys) FortezzaKeys; } +ClientKeyBase* CreateFortezzaClient() { return new FortezzaKeys; } // Constructor calls this to Register compile time callbacks @@ -2115,4 +2115,3 @@ template yaSSL::del_ptr_zero mySTL::for_each: template yaSSL::del_ptr_zero mySTL::for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); } #endif - diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index c552cfa7189..f32a8420b98 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -31,28 +31,6 @@ #include "openssl/ssl.h" // for DH -void* operator new(size_t sz, yaSSL::new_t) -{ - void* ptr = ::operator new(sz); - - if (!ptr) abort(); - - return ptr; -} - -void* operator new[](size_t sz, yaSSL::new_t n) -{ -#if defined(_MSC_VER) && (_MSC_VER < 1300) - void* ptr = ::operator new(sz); // no ::operator new[] -#else - void* ptr = ::operator new[](sz); -#endif - - if (!ptr) abort(); - - return ptr; -} - namespace yaSSL { @@ -60,8 +38,6 @@ namespace yaSSL { using mySTL::min; -new_t ys; // for library new - // convert a 32 bit integer into a 24 bit one void c32to24(uint32 u32, uint24& u24) @@ -308,8 +284,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = AES_256_KEY_SZ; parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); break; @@ -322,8 +298,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = AES_128_KEY_SZ; parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); break; @@ -336,8 +312,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = DES_EDE_KEY_SZ; parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_3DES_EDE_CBC_SHA] , MAX_SUITE_NAME); break; @@ -350,8 +326,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = DES_KEY_SZ; parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); break; @@ -364,8 +340,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = RC4_KEY_SZ; parms.iv_size_ = 0; parms.cipher_type_ = stream; - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) RC4); + crypto_.setDigest(new SHA); + crypto_.setCipher(new RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_SHA], MAX_SUITE_NAME); break; @@ -378,8 +354,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = RC4_KEY_SZ; parms.iv_size_ = 0; parms.cipher_type_ = stream; - crypto_.setDigest(new (ys) MD5); - crypto_.setCipher(new (ys) RC4); + crypto_.setDigest(new MD5); + crypto_.setCipher(new RC4); strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_MD5], MAX_SUITE_NAME); break; @@ -394,8 +370,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_DES_CBC_SHA], MAX_SUITE_NAME); break; @@ -410,8 +386,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); break; @@ -426,8 +402,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); break; @@ -442,8 +418,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); break; @@ -458,8 +434,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_DES_CBC_SHA], MAX_SUITE_NAME); break; @@ -474,8 +450,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new SHA); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); break; @@ -490,8 +466,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); break; @@ -506,8 +482,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) SHA); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new SHA); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); break; @@ -520,8 +496,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = AES_256_KEY_SZ; parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); break; @@ -534,8 +510,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = AES_128_KEY_SZ; parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); break; @@ -548,8 +524,8 @@ void SSL::set_pending(Cipher suite) parms.key_size_ = DES_EDE_KEY_SZ; parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new RMD); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); break; @@ -564,8 +540,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new RMD); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); @@ -581,8 +557,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); @@ -598,8 +574,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); @@ -615,8 +591,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = DES_IV_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) DES_EDE); + crypto_.setDigest(new RMD); + crypto_.setCipher(new DES_EDE); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); @@ -632,8 +608,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES(AES_256_KEY_SZ)); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES(AES_256_KEY_SZ)); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); @@ -649,8 +625,8 @@ void SSL::set_pending(Cipher suite) parms.iv_size_ = AES_BLOCK_SZ; parms.cipher_type_ = block; secure_.use_connection().send_server_key_ = true; // eph - crypto_.setDigest(new (ys) RMD); - crypto_.setCipher(new (ys) AES); + crypto_.setDigest(new RMD); + crypto_.setCipher(new AES); strncpy(parms.cipher_name_, cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); @@ -936,12 +912,14 @@ struct SumBuffer { } // namespace for locals using namespace yassl_int_cpp_local1; + uint SSL::bufferedData() { return mySTL::for_each(buffers_.getData().begin(),buffers_.getData().end(), SumData()).total_; } + // use input buffer to fill data void SSL::fillData(Data& data) { @@ -1367,7 +1345,7 @@ typedef Mutex::Lock Lock; void Sessions::add(const SSL& ssl) { Lock guard(mutex_); - list_.push_back(new (ys) SSL_SESSION(ssl, random_)); + list_.push_back(new SSL_SESSION(ssl, random_)); } @@ -1397,6 +1375,7 @@ struct sess_match { } // local namespace using namespace yassl_int_cpp_local2; + // lookup session by id, return a copy if space provided SSL_SESSION* Sessions::lookup(const opaque* id, SSL_SESSION* copy) { @@ -1764,7 +1743,7 @@ void Crypto::SetDH(DiffieHellman* dh) void Crypto::SetDH(const DH_Parms& dh) { if (dh.set_) - dh_ = new (ys) DiffieHellman(dh.p_, dh.g_, random_); + dh_ = new DiffieHellman(dh.p_, dh.g_, random_); } @@ -1931,7 +1910,7 @@ X509_NAME::X509_NAME(const char* n, size_t sz) : name_(0) { if (sz) { - name_ = new (ys) char[sz]; + name_ = new char[sz]; memcpy(name_, n, sz); } } @@ -1952,7 +1931,7 @@ char* X509_NAME::GetName() X509::X509(const char* i, size_t iSz, const char* s, size_t sSz) : issuer_(i, iSz), subject_(s, sSz) {} - + X509_NAME* X509::GetIssuer() { diff --git a/extra/yassl/taocrypt/include/aes.hpp b/extra/yassl/taocrypt/include/aes.hpp index b2c93eff9fe..b8436d35c5f 100644 --- a/extra/yassl/taocrypt/include/aes.hpp +++ b/extra/yassl/taocrypt/include/aes.hpp @@ -37,11 +37,12 @@ enum { AES_BLOCK_SIZE = 16 }; // AES encryption and decryption, see FIPS-197 -class AES : public Mode_BASE { +class AES : public Mode_BASE { public: enum { BLOCK_SIZE = AES_BLOCK_SIZE }; - AES(CipherDir DIR, Mode MODE) : dir_(DIR), mode_(MODE) {} + AES(CipherDir DIR, Mode MODE) + : Mode_BASE(BLOCK_SIZE), dir_(DIR), mode_(MODE) {} void Process(byte*, const byte*, word32); void SetKey(const byte* iv, word32 sz, CipherDir fake = ENCRYPTION); diff --git a/extra/yassl/taocrypt/include/algebra.hpp b/extra/yassl/taocrypt/include/algebra.hpp index 74f244507f6..92cac607d97 100644 --- a/extra/yassl/taocrypt/include/algebra.hpp +++ b/extra/yassl/taocrypt/include/algebra.hpp @@ -24,11 +24,10 @@ #ifndef TAO_CRYPT_ALGEBRA_HPP #define TAO_CRYPT_ALGEBRA_HPP -#include "misc.hpp" +#include "integer.hpp" namespace TaoCrypt { -class Integer; // "const Element&" returned by member functions are references // to internal data members. Since each object may have only @@ -38,11 +37,11 @@ class Integer; // But this should be fine: // abcd = group.Add(a, group.Add(b, group.Add(c,d)); -//! Abstract Group -template class TAOCRYPT_NO_VTABLE AbstractGroup +// Abstract Group +class TAOCRYPT_NO_VTABLE AbstractGroup { public: - typedef T Element; + typedef Integer Element; virtual ~AbstractGroup() {} @@ -65,15 +64,14 @@ public: const Integer *exponents, unsigned int exponentsCount) const; }; -//! Abstract Ring -template class TAOCRYPT_NO_VTABLE AbstractRing - : public AbstractGroup +// Abstract Ring +class TAOCRYPT_NO_VTABLE AbstractRing : public AbstractGroup { public: - typedef T Element; + typedef Integer Element; AbstractRing() {m_mg.m_pRing = this;} - AbstractRing(const AbstractRing &source) {m_mg.m_pRing = this;} + AbstractRing(const AbstractRing &source) : AbstractGroup() {m_mg.m_pRing = this;} AbstractRing& operator=(const AbstractRing &source) {return *this;} virtual bool IsUnit(const Element &a) const =0; @@ -91,14 +89,14 @@ public: virtual void SimultaneousExponentiate(Element *results, const Element&, const Integer *exponents, unsigned int exponentsCount) const; - virtual const AbstractGroup& MultiplicativeGroup() const + virtual const AbstractGroup& MultiplicativeGroup() const {return m_mg;} private: - class MultiplicativeGroupT : public AbstractGroup + class MultiplicativeGroupT : public AbstractGroup { public: - const AbstractRing& GetRing() const + const AbstractRing& GetRing() const {return *m_pRing;} bool Equal(const Element &a, const Element &b) const @@ -137,44 +135,19 @@ private: {GetRing().SimultaneousExponentiate(results, base, exponents, exponentsCount);} - const AbstractRing *m_pRing; + const AbstractRing* m_pRing; }; MultiplicativeGroupT m_mg; }; -// ******************************************************** -//! Base and Exponent -template -struct BaseAndExponent +// Abstract Euclidean Domain +class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain + : public AbstractRing { public: - BaseAndExponent() {} - BaseAndExponent(const T &base, const E &exponent) : base(base), - exponent(exponent) {} - bool operator<(const BaseAndExponent &rhs) const - {return exponent < rhs.exponent;} - T base; - E exponent; -}; - -// VC60 workaround: incomplete member template support -template - Element GeneralCascadeMultiplication(const AbstractGroup &group, - Iterator begin, Iterator end); -template - Element GeneralCascadeExponentiation(const AbstractRing &ring, - Iterator begin, Iterator end); - -// ******************************************************** - -//! Abstract Euclidean Domain -template class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain - : public AbstractRing -{ -public: - typedef T Element; + typedef Integer Element; virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a, const Element &d) const =0; @@ -186,13 +159,12 @@ protected: mutable Element result; }; -// ******************************************************** -//! EuclideanDomainOf -template class EuclideanDomainOf : public AbstractEuclideanDomain +// EuclideanDomainOf +class EuclideanDomainOf : public AbstractEuclideanDomain { public: - typedef T Element; + typedef Integer Element; EuclideanDomainOf() {} @@ -249,68 +221,8 @@ private: mutable Element result; }; -//! Quotient Ring -template class QuotientRing : public AbstractRing -{ -public: - typedef T EuclideanDomain; - typedef typename T::Element Element; - - QuotientRing(const EuclideanDomain &domain, const Element &modulus) - : m_domain(domain), m_modulus(modulus) {} - - const EuclideanDomain & GetDomain() const - {return m_domain;} - - const Element& GetModulus() const - {return m_modulus;} - - bool Equal(const Element &a, const Element &b) const - {return m_domain.Equal(m_domain.Mod(m_domain.Subtract(a, b), - m_modulus), m_domain.Identity());} - - const Element& Identity() const - {return m_domain.Identity();} - - const Element& Add(const Element &a, const Element &b) const - {return m_domain.Add(a, b);} - - Element& Accumulate(Element &a, const Element &b) const - {return m_domain.Accumulate(a, b);} - - const Element& Inverse(const Element &a) const - {return m_domain.Inverse(a);} - - const Element& Subtract(const Element &a, const Element &b) const - {return m_domain.Subtract(a, b);} - - Element& Reduce(Element &a, const Element &b) const - {return m_domain.Reduce(a, b);} - - const Element& Double(const Element &a) const - {return m_domain.Double(a);} - - bool IsUnit(const Element &a) const - {return m_domain.IsUnit(m_domain.Gcd(a, m_modulus));} - - const Element& MultiplicativeIdentity() const - {return m_domain.MultiplicativeIdentity();} - - const Element& Multiply(const Element &a, const Element &b) const - {return m_domain.Mod(m_domain.Multiply(a, b), m_modulus);} - - const Element& Square(const Element &a) const - {return m_domain.Mod(m_domain.Square(a), m_modulus);} - - const Element& MultiplicativeInverse(const Element &a) const; - -protected: - EuclideanDomain m_domain; - Element m_modulus; -}; } // namespace - #endif // TAO_CRYPT_ALGEBRA_HPP diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index f490fb0b6e7..f3c4415682d 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -34,10 +34,6 @@ #include // ptrdiff_t -#if defined(_MSC_VER) && defined(_CRTAPI1) -#define TAOCRYPT_MSVCRT6 -#endif - namespace TaoCrypt { @@ -47,13 +43,13 @@ template class AllocatorBase { public: - typedef T value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; pointer address(reference r) const {return (&r);} const_pointer address(const_reference r) const {return (&r); } @@ -104,7 +100,7 @@ public: CheckSize(n); if (n == 0) return 0; - return new (tc) T[n]; + return new T[n]; } void deallocate(void* p, size_type n) diff --git a/extra/yassl/taocrypt/include/des.hpp b/extra/yassl/taocrypt/include/des.hpp index e8100b4e198..127b8ddc6d5 100644 --- a/extra/yassl/taocrypt/include/des.hpp +++ b/extra/yassl/taocrypt/include/des.hpp @@ -36,12 +36,13 @@ namespace TaoCrypt { enum { DES_BLOCK_SIZE = 8 }; // Base for all DES types -class DES_BASE : public Mode_BASE { +class DES_BASE : public Mode_BASE { public: enum { BLOCK_SIZE = DES_BLOCK_SIZE, KEY_SIZE = 32, BOXES = 8, BOX_SIZE = 64 }; - DES_BASE(CipherDir DIR, Mode MODE) : dir_(DIR), mode_(MODE) {} + DES_BASE(CipherDir DIR, Mode MODE) + : Mode_BASE(BLOCK_SIZE), dir_(DIR), mode_(MODE) {} void Process(byte*, const byte*, word32); protected: diff --git a/extra/yassl/taocrypt/include/error.hpp b/extra/yassl/taocrypt/include/error.hpp index 6170d0349b5..55ab39313f5 100644 --- a/extra/yassl/taocrypt/include/error.hpp +++ b/extra/yassl/taocrypt/include/error.hpp @@ -65,7 +65,8 @@ UNKOWN_HASH_E = 1034, // "unknown hash OID" DSA_SZ_E = 1035, // "bad DSA r or s size" BEFORE_DATE_E = 1036, // "before date in the future" AFTER_DATE_E = 1037, // "after date in the past" -SIG_CONFIRM_E = 1038 // "bad signature confirmation" +SIG_CONFIRM_E = 1038, // "bad self signature confirmation" +SIG_OTHER_E = 1039 // "bad other signature confirmation" }; diff --git a/extra/yassl/taocrypt/include/hash.hpp b/extra/yassl/taocrypt/include/hash.hpp index 1703de23713..f01f343c2d1 100644 --- a/extra/yassl/taocrypt/include/hash.hpp +++ b/extra/yassl/taocrypt/include/hash.hpp @@ -50,7 +50,7 @@ public: class HASHwithTransform : public HASH { public: HASHwithTransform(word32 digSz, word32 buffSz) - : digest_(new (tc) word32[digSz]), buffer_(new (tc) byte[buffSz]) {} + : digest_(new word32[digSz]), buffer_(new byte[buffSz]) {} virtual ~HASHwithTransform() { delete[] buffer_; delete[] digest_; } virtual ByteOrder getByteOrder() const = 0; diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp index 3713d09d9f9..6b1984e46ed 100644 --- a/extra/yassl/taocrypt/include/integer.hpp +++ b/extra/yassl/taocrypt/include/integer.hpp @@ -29,8 +29,8 @@ #include "block.hpp" #include "random.hpp" #include "file.hpp" -#include #include "algorithm.hpp" // mySTL::swap +#include #ifdef TAOCRYPT_X86ASM_AVAILABLE @@ -128,9 +128,6 @@ public: Integer(signed long value); Integer(Sign s, word highWord, word lowWord); - explicit Integer(const char* str); - explicit Integer(const wchar_t* str); - // BER Decode Source explicit Integer(Source&); @@ -254,15 +251,13 @@ public: private: friend class ModularArithmetic; friend class MontgomeryRepresentation; - friend class HalfMontgomeryRepresentation; - Integer(word value, unsigned int length); static const Integer zero; static const Integer one; static const Integer two; - int PositiveCompare(const Integer& t) const; + friend void PositiveAdd(Integer& sum, const Integer& a, const Integer& b); friend void PositiveSubtract(Integer& diff, const Integer& a, const Integer& b); @@ -308,6 +303,7 @@ inline void swap(Integer &a, Integer &b) Integer CRT(const Integer& xp, const Integer& p, const Integer& xq, const Integer& q, const Integer& u); + inline Integer ModularExponentiation(const Integer& a, const Integer& e, const Integer& m) { diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index b5b0a4575fc..de8cbb30fcb 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -28,17 +28,6 @@ #include #include -namespace TaoCrypt { - -// library allocation -struct new_t {}; // TaoCrypt New type -extern new_t tc; // pass in parameter - -} // namespace TaoCrypt - -void* operator new (size_t, TaoCrypt::new_t); -void* operator new[](size_t, TaoCrypt::new_t); - namespace TaoCrypt { diff --git a/extra/yassl/taocrypt/include/modarith.hpp b/extra/yassl/taocrypt/include/modarith.hpp index 88a2cc95c7c..66a841b05c3 100644 --- a/extra/yassl/taocrypt/include/modarith.hpp +++ b/extra/yassl/taocrypt/include/modarith.hpp @@ -27,14 +27,13 @@ #define TAO_CRYPT_MODARITH_HPP #include "misc.hpp" -#include "integer.hpp" #include "algebra.hpp" namespace TaoCrypt { -//! ModularArithmetic -class ModularArithmetic : public AbstractRing +// ModularArithmetic +class ModularArithmetic : public AbstractRing { public: @@ -45,7 +44,7 @@ public: : modulus(modulus), result((word)0, modulus.reg_.size()) {} ModularArithmetic(const ModularArithmetic &ma) - : AbstractRing(), + : AbstractRing(), modulus(ma.modulus), result((word)0, modulus.reg_.size()) {} const Integer& GetModulus() const {return modulus;} @@ -149,12 +148,12 @@ public: Integer CascadeExponentiate(const Integer &x, const Integer &e1, const Integer &y, const Integer &e2) const - {return AbstractRing::CascadeExponentiate(x, e1, y, e2);} + {return AbstractRing::CascadeExponentiate(x, e1, y, e2);} void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const - {AbstractRing::SimultaneousExponentiate(results, base, - exponents, exponentsCount);} + {AbstractRing::SimultaneousExponentiate(results, base, + exponents, exponentsCount);} private: Integer u; diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp index 2a21ad46b76..3f9878a9e62 100644 --- a/extra/yassl/taocrypt/include/modes.hpp +++ b/extra/yassl/taocrypt/include/modes.hpp @@ -56,10 +56,11 @@ private: // Mode Base for block ciphers, static size -template class Mode_BASE { public: - Mode_BASE() {} + enum { MaxBlockSz = 16 }; + + explicit Mode_BASE(int sz) : blockSz_(sz) { assert(sz <= MaxBlockSz); } virtual ~Mode_BASE() {} virtual void ProcessAndXorBlock(const byte*, const byte*, byte*) const = 0; @@ -68,10 +69,11 @@ public: void CBC_Encrypt(byte*, const byte*, word32); void CBC_Decrypt(byte*, const byte*, word32); - void SetIV(const byte* iv) { memcpy(reg_, iv, BLOCK_SIZE); } + void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); } private: - byte reg_[BLOCK_SIZE]; - byte tmp_[BLOCK_SIZE]; + byte reg_[MaxBlockSz]; + byte tmp_[MaxBlockSz]; + int blockSz_; Mode_BASE(const Mode_BASE&); // hide copy Mode_BASE& operator=(const Mode_BASE&); // and assign @@ -79,51 +81,48 @@ private: // ECB Process blocks -template -void Mode_BASE::ECB_Process(byte* out, const byte* in, word32 sz) +inline void Mode_BASE::ECB_Process(byte* out, const byte* in, word32 sz) { - word32 blocks = sz / BLOCK_SIZE; + word32 blocks = sz / blockSz_; while (blocks--) { ProcessAndXorBlock(in, 0, out); - out += BLOCK_SIZE; - in += BLOCK_SIZE; + out += blockSz_; + in += blockSz_; } } // CBC Encrypt -template -void Mode_BASE::CBC_Encrypt(byte* out, const byte* in, word32 sz) +inline void Mode_BASE::CBC_Encrypt(byte* out, const byte* in, word32 sz) { - word32 blocks = sz / BLOCK_SIZE; + word32 blocks = sz / blockSz_; while (blocks--) { - xorbuf(reg_, in, BLOCK_SIZE); + xorbuf(reg_, in, blockSz_); ProcessAndXorBlock(reg_, 0, reg_); - memcpy(out, reg_, BLOCK_SIZE); - out += BLOCK_SIZE; - in += BLOCK_SIZE; + memcpy(out, reg_, blockSz_); + out += blockSz_; + in += blockSz_; } } // CBC Decrypt -template -void Mode_BASE::CBC_Decrypt(byte* out, const byte* in, word32 sz) +inline void Mode_BASE::CBC_Decrypt(byte* out, const byte* in, word32 sz) { - word32 blocks = sz / BLOCK_SIZE; - byte hold[BLOCK_SIZE]; + word32 blocks = sz / blockSz_; + byte hold[MaxBlockSz]; while (blocks--) { - memcpy(tmp_, in, BLOCK_SIZE); + memcpy(tmp_, in, blockSz_); ProcessAndXorBlock(tmp_, 0, out); - xorbuf(out, reg_, BLOCK_SIZE); - memcpy(hold, reg_, BLOCK_SIZE); // swap reg_ and tmp_ - memcpy(reg_, tmp_, BLOCK_SIZE); - memcpy(tmp_, hold, BLOCK_SIZE); - out += BLOCK_SIZE; - in += BLOCK_SIZE; + xorbuf(out, reg_, blockSz_); + memcpy(hold, reg_, blockSz_); // swap reg_ and tmp_ + memcpy(reg_, tmp_, blockSz_); + memcpy(tmp_, hold, blockSz_); + out += blockSz_; + in += blockSz_; } } diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index 1924be9b618..d70f8dd5d72 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -23,60 +23,58 @@ #include "runtime.hpp" #include "algebra.hpp" -#include "integer.hpp" #include "vector.hpp" // mySTL::vector (simple) namespace TaoCrypt { -template const T& AbstractGroup::Double(const Element &a) const + +const Integer& AbstractGroup::Double(const Element &a) const { return Add(a, a); } -template const T& AbstractGroup::Subtract(const Element &a, - const Element &b) const +const Integer& AbstractGroup::Subtract(const Element &a, const Element &b) const { // make copy of a in case Inverse() overwrites it Element a1(a); return Add(a1, Inverse(b)); } -template T& AbstractGroup::Accumulate(Element &a, - const Element &b) const +Integer& AbstractGroup::Accumulate(Element &a, const Element &b) const { return a = Add(a, b); } -template T& AbstractGroup::Reduce(Element &a, - const Element &b) const +Integer& AbstractGroup::Reduce(Element &a, const Element &b) const { return a = Subtract(a, b); } -template const T& AbstractRing::Square(const Element &a) const +const Integer& AbstractRing::Square(const Element &a) const { return Multiply(a, a); } -template const T& AbstractRing::Divide(const Element &a, - const Element &b) const + +const Integer& AbstractRing::Divide(const Element &a, const Element &b) const { // make copy of a in case MultiplicativeInverse() overwrites it Element a1(a); return Multiply(a1, MultiplicativeInverse(b)); } -template const T& AbstractEuclideanDomain::Mod(const Element &a, - const Element &b) const + +const Integer& AbstractEuclideanDomain::Mod(const Element &a, + const Element &b) const { Element q; DivisionAlgorithm(result, q, a, b); return result; } -template const T& AbstractEuclideanDomain::Gcd(const Element &a, - const Element &b) const +const Integer& AbstractEuclideanDomain::Gcd(const Element &a, + const Element &b) const { Element g[3]={b, a}; unsigned int i0=0, i1=1, i2=2; @@ -90,45 +88,17 @@ template const T& AbstractEuclideanDomain::Gcd(const Element &a, return result = g[i0]; } -template const typename - QuotientRing::Element& QuotientRing::MultiplicativeInverse( - const Element &a) const -{ - Element g[3]={m_modulus, a}; -#ifdef __BCPLUSPLUS__ - // BC++50 workaround - Element v[3]; - v[0]=m_domain.Identity(); - v[1]=m_domain.MultiplicativeIdentity(); -#else - Element v[3]={m_domain.Identity(), m_domain.MultiplicativeIdentity()}; -#endif - Element y; - unsigned int i0=0, i1=1, i2=2; - while (!Equal(g[i1], Identity())) - { - // y = g[i0] / g[i1]; - // g[i2] = g[i0] % g[i1]; - m_domain.DivisionAlgorithm(g[i2], y, g[i0], g[i1]); - // v[i2] = v[i0] - (v[i1] * y); - v[i2] = m_domain.Subtract(v[i0], m_domain.Multiply(v[i1], y)); - unsigned int t = i0; i0 = i1; i1 = i2; i2 = t; - } - - return m_domain.IsUnit(g[i0]) ? m_domain.Divide(v[i0], g[i0]) : - m_domain.Identity(); -} - -template T AbstractGroup::ScalarMultiply(const Element &base, - const Integer &exponent) const +Integer AbstractGroup::ScalarMultiply(const Element &base, + const Integer &exponent) const { Element result; SimultaneousMultiply(&result, base, &exponent, 1); return result; } -template T AbstractGroup::CascadeScalarMultiply(const Element &x, + +Integer AbstractGroup::CascadeScalarMultiply(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const { const unsigned expLen = max(e1.BitCount(), e2.BitCount()); @@ -258,8 +228,8 @@ struct WindowSlider bool fastNegate, negateNext, firstTime, finished; }; -template -void AbstractGroup::SimultaneousMultiply(T *results, const T &base, + +void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base, const Integer *expBegin, unsigned int expCount) const { mySTL::vector > buckets(expCount); @@ -321,34 +291,39 @@ void AbstractGroup::SimultaneousMultiply(T *results, const T &base, } } -template T AbstractRing::Exponentiate(const Element &base, - const Integer &exponent) const +Integer AbstractRing::Exponentiate(const Element &base, + const Integer &exponent) const { Element result; SimultaneousExponentiate(&result, base, &exponent, 1); return result; } -template T AbstractRing::CascadeExponentiate(const Element &x, + +Integer AbstractRing::CascadeExponentiate(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const { - return MultiplicativeGroup().AbstractGroup::CascadeScalarMultiply( + return MultiplicativeGroup().AbstractGroup::CascadeScalarMultiply( x, e1, y, e2); } -template Element GeneralCascadeExponentiation( - const AbstractRing &ring, Iterator begin, Iterator end) -{ - return GeneralCascadeMultiplication(ring.MultiplicativeGroup(), - begin, end); -} -template -void AbstractRing::SimultaneousExponentiate(T *results, const T &base, +void AbstractRing::SimultaneousExponentiate(Integer *results, + const Integer &base, const Integer *exponents, unsigned int expCount) const { - MultiplicativeGroup().AbstractGroup::SimultaneousMultiply(results, base, + MultiplicativeGroup().AbstractGroup::SimultaneousMultiply(results, base, exponents, expCount); } + } // namespace + +#ifdef __GNUC__ +namespace mySTL { +template TaoCrypt::WindowSlider* uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template vector* uninit_fill_n*, unsigned int, vector >(vector*, unsigned int, vector const&); +template void destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template void destroy*>(vector*, vector*); +} +#endif diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index d0d22a6c61d..59c544bd633 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -187,7 +187,7 @@ PublicKey::PublicKey(const byte* k, word32 s) : key_(0), sz_(0) void PublicKey::SetSize(word32 s) { sz_ = s; - key_ = new (tc) byte[sz_]; + key_ = new byte[sz_]; } @@ -199,7 +199,7 @@ void PublicKey::SetKey(const byte* k) void PublicKey::AddToEnd(const byte* data, word32 len) { - mySTL::auto_ptr tmp(new (tc) byte[sz_ + len]); + mySTL::auto_ptr tmp(new byte[sz_ + len]); memcpy(tmp.get(), key_, sz_); memcpy(tmp.get() + sz_, data, len); @@ -218,7 +218,7 @@ Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h) { if (n) { int sz = strlen(n); - name_ = new (tc) char[sz + 1]; + name_ = new char[sz + 1]; memcpy(name_, n, sz); name_[sz] = 0; } @@ -480,7 +480,7 @@ void CertDecoder::Decode(SignerList* signers) } else if (!ValidateSignature(signers)) - source_.SetError(SIG_CONFIRM_E); + source_.SetError(SIG_OTHER_E); } @@ -632,7 +632,7 @@ word32 CertDecoder::GetSignature() } sigLength_--; - signature_ = new (tc) byte[sigLength_]; + signature_ = new byte[sigLength_]; memcpy(signature_, source_.get_current(), sigLength_); source_.advance(sigLength_); @@ -653,7 +653,7 @@ word32 CertDecoder::GetDigest() sigLength_ = GetLength(source_); - signature_ = new (tc) byte[sigLength_]; + signature_ = new byte[sigLength_]; memcpy(signature_, source_.get_current(), sigLength_); source_.advance(sigLength_); @@ -693,7 +693,7 @@ void CertDecoder::GetName(NameType nt) if (id == COMMON_NAME) { char*& ptr = (nt == ISSUER) ? issuer_ : subject_; - ptr = new (tc) char[strLen + 1]; + ptr = new char[strLen + 1]; memcpy(ptr, source_.get_current(), strLen); ptr[strLen] = 0; } @@ -810,15 +810,15 @@ bool CertDecoder::ConfirmSignature(Source& pub) mySTL::auto_ptr hasher; if (signatureOID_ == MD5wRSA) { - hasher.reset(new (tc) MD5); + hasher.reset(new MD5); ht = MD5h; } else if (signatureOID_ == MD2wRSA) { - hasher.reset(new (tc) MD2); + hasher.reset(new MD2); ht = MD2h; } else if (signatureOID_ == SHAwRSA || signatureOID_ == SHAwDSA) { - hasher.reset(new (tc) SHA); + hasher.reset(new SHA); ht = SHAh; } else { diff --git a/extra/yassl/taocrypt/src/dh.cpp b/extra/yassl/taocrypt/src/dh.cpp index af50d471b52..ea1b5846f7d 100644 --- a/extra/yassl/taocrypt/src/dh.cpp +++ b/extra/yassl/taocrypt/src/dh.cpp @@ -26,7 +26,6 @@ #include "runtime.hpp" #include "dh.hpp" #include "asn.hpp" -#include namespace TaoCrypt { diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp index 4716ebb22df..5cb3018a402 100644 --- a/extra/yassl/taocrypt/src/dsa.cpp +++ b/extra/yassl/taocrypt/src/dsa.cpp @@ -27,8 +27,6 @@ #include "modarith.hpp" #include "stdexcept.hpp" -#include "algebra.cpp" // for GCC 3.2 on aix ? - namespace TaoCrypt { diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 9be0a25b363..37cfe374451 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -38,11 +38,10 @@ #include "asn.hpp" #include "stdexcept.hpp" -#include "algebra.cpp" #ifdef __DECCXX - #include // for asm multiply overflow + #include // for asm overflow assembly #endif @@ -63,7 +62,7 @@ #pragma message("You do not seem to have the Visual C++ Processor Pack ") #pragma message("installed, so use of SSE2 intrinsics will be disabled.") #elif defined(__GNUC__) && defined(__i386__) -/* #warning You do not have GCC 3.3 or later, or did not specify the -msse2 \ +/* #warning You do not have GCC 3.3 or later, or did not specify the -msse2 \ compiler option. Use of SSE2 intrinsics will be disabled. */ #endif @@ -109,7 +108,7 @@ CPP_TYPENAME AllocatorBase::pointer AlignedAllocator::allocate( assert(IsAlignedOn(p, 16)); return (T*)p; } - return new (tc) T[n]; + return new T[n]; } @@ -178,7 +177,7 @@ DWord() {} #elif defined(__DECCXX) r.halfs_.high = asm("umulh %a0, %a1, %v0", a, b); #else - #error unsupported alpha compiler for asm multiply overflow + #error can not implement multiply overflow #endif #elif defined(__ia64__) r.halfs_.low = a*b; @@ -392,6 +391,7 @@ S DivideThreeWordsByTwo(S* A, S B0, S B1, D* dummy_VC6_WorkAround = 0) return Q; } + // do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1 template inline D DivideFourWordsByTwo(S *T, const D &Al, const D &Ah, const D &B) @@ -470,66 +470,6 @@ static inline unsigned int RoundupSize(unsigned int n) } -template -static Integer StringToInteger(const T *str) -{ - word radix; - - unsigned int length; - for (length = 0; str[length] != 0; length++) {} - - Integer v; - - if (length == 0) - return v; - - switch (str[length-1]) - { - case 'h': - case 'H': - radix=16; - break; - case 'o': - case 'O': - radix=8; - break; - case 'b': - case 'B': - radix=2; - break; - default: - radix=10; - } - - if (length > 2 && str[0] == '0' && str[1] == 'x') - radix = 16; - - for (unsigned i=0; i= '0' && str[i] <= '9') - digit = str[i] - '0'; - else if (str[i] >= 'A' && str[i] <= 'F') - digit = str[i] - 'A' + 10; - else if (str[i] >= 'a' && str[i] <= 'f') - digit = str[i] - 'a' + 10; - else - digit = radix; - - if (digit < radix) - { - v *= radix; - v += digit; - } - } - - if (str[0] == '-') - v.Negate(); - - return v; -} - static int Compare(const word *A, const word *B, unsigned int N) { while (N--) @@ -2308,85 +2248,6 @@ void RecursiveMultiplyBottom(word *R, word *T, const word *A, const word *B, } } -/* -template -void RecursiveMultiplyTop(word *R, word *T, const word *L, const word *A, - const word *B, unsigned int N, const P *dummy=0) -{ - assert(N>=2 && N%2==0); - - if (N==4) - { - P::Multiply4(T, A, B); - ((dword *)R)[0] = ((dword *)T)[2]; - ((dword *)R)[1] = ((dword *)T)[3]; - } - else if (N==2) - { - P::Multiply2(T, A, B); - ((dword *)R)[0] = ((dword *)T)[1]; - } - else - { - const unsigned int N2 = N/2; - int carry; - - int aComp = Compare(A0, A1, N2); - int bComp = Compare(B0, B1, N2); - - switch (2*aComp + aComp + bComp) - { - case -4: - P::Subtract(R0, A1, A0, N2); - P::Subtract(R1, B0, B1, N2); - RecursiveMultiply

(T0, T2, R0, R1, N2); - P::Subtract(T1, T1, R0, N2); - carry = -1; - break; - case -2: - P::Subtract(R0, A1, A0, N2); - P::Subtract(R1, B0, B1, N2); - RecursiveMultiply

(T0, T2, R0, R1, N2); - carry = 0; - break; - case 2: - P::Subtract(R0, A0, A1, N2); - P::Subtract(R1, B1, B0, N2); - RecursiveMultiply

(T0, T2, R0, R1, N2); - carry = 0; - break; - case 4: - P::Subtract(R0, A1, A0, N2); - P::Subtract(R1, B0, B1, N2); - RecursiveMultiply

(T0, T2, R0, R1, N2); - P::Subtract(T1, T1, R1, N2); - carry = -1; - break; - default: - SetWords(T0, 0, N); - carry = 0; - } - - RecursiveMultiply

(T2, R0, A1, B1, N2); - - // now T[01] holds (A1-A0)*(B0-B1), T[23] holds A1*B1 - - word c2 = P::Subtract(R0, L+N2, L, N2); - c2 += P::Subtract(R0, R0, T0, N2); - word t = (Compare(R0, T2, N2) == -1); - - carry += t; - carry += Increment(R0, N2, c2+t); - carry += P::Add(R0, R0, T1, N2); - carry += P::Add(R0, R0, T3, N2); - assert (carry >= 0 && carry <= 2); - - CopyWords(R1, T3, N2); - Increment(R1, N2, carry); - } -} -*/ - void RecursiveMultiplyTop(word *R, word *T, const word *L, const word *A, const word *B, unsigned int N) @@ -2739,20 +2600,6 @@ Integer::Integer(word value, unsigned int length) } -Integer::Integer(const char *str) - : reg_(2), sign_(POSITIVE) -{ - *this = StringToInteger(str); -} - - -Integer::Integer(const wchar_t *str) - : reg_(2), sign_(POSITIVE) -{ - *this = StringToInteger(str); -} - - Integer::Integer(const byte *encodedInteger, unsigned int byteCount, Signedness s) { @@ -3358,76 +3205,6 @@ Integer Integer::Times(const Integer &b) const #undef R2 #undef R3 -/* -// do a 3 word by 2 word divide, returns quotient and leaves remainder in A -static word SubatomicDivide(word *A, word B0, word B1) -{ - // assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a word - assert(A[2] < B1 || (A[2]==B1 && A[1] < B0)); - - dword p, u; - word Q; - - // estimate the quotient: do a 2 word by 1 word divide - if (B1+1 == 0) - Q = A[2]; - else - Q = word(MAKE_DWORD(A[1], A[2]) / (B1+1)); - - // now subtract Q*B from A - p = (dword) B0*Q; - u = (dword) A[0] - LOW_WORD(p); - A[0] = LOW_WORD(u); - u = (dword) A[1] - HIGH_WORD(p) - (word)(0-HIGH_WORD(u)) - (dword)B1*Q; - A[1] = LOW_WORD(u); - A[2] += HIGH_WORD(u); - - // Q <= actual quotient, so fix it - while (A[2] || A[1] > B1 || (A[1]==B1 && A[0]>=B0)) - { - u = (dword) A[0] - B0; - A[0] = LOW_WORD(u); - u = (dword) A[1] - B1 - (word)(0-HIGH_WORD(u)); - A[1] = LOW_WORD(u); - A[2] += HIGH_WORD(u); - Q++; - assert(Q); // shouldn't overflow - } - - return Q; -} -*/ - - -/* -// do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1 -static inline void AtomicDivide(word *Q, const word *A, const word *B) -{ - if (!B[0] && !B[1]) // if divisor is 0, we assume divisor==2**(2*WORD_BITS) - { - Q[0] = A[2]; - Q[1] = A[3]; - } - else - { - word T[4]; - T[0] = A[0]; T[1] = A[1]; T[2] = A[2]; T[3] = A[3]; - Q[1] = SubatomicDivide(T+1, B[0], B[1]); - Q[0] = SubatomicDivide(T, B[0], B[1]); - -#ifndef NDEBUG - // multiply quotient and divisor and add remainder - // make sure it equals dividend - assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]().Gcd(a, b); + return EuclideanDomainOf().Gcd(a, b); } Integer Integer::InverseMod(const Integer &m) const @@ -3955,7 +3732,7 @@ Integer ModularArithmetic::CascadeExponentiate(const Integer &x, dr.ConvertIn(y), e2)); } else - return AbstractRing::CascadeExponentiate(x, e1, y, e2); + return AbstractRing::CascadeExponentiate(x, e1, y, e2); } void ModularArithmetic::SimultaneousExponentiate(Integer *results, @@ -3971,7 +3748,7 @@ void ModularArithmetic::SimultaneousExponentiate(Integer *results, results[i] = dr.ConvertOut(results[i]); } else - AbstractRing::SimultaneousExponentiate(results, base, + AbstractRing::SimultaneousExponentiate(results, base, exponents, exponentsCount); } @@ -4170,10 +3947,6 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, } #ifdef __GNUC__ -template Integer StringToInteger(char const*); -template Integer StringToInteger(wchar_t const*); -template class EuclideanDomainOf; -template class AbstractEuclideanDomain; template unsigned int DivideThreeWordsByTwo(unsigned int*, unsigned int, unsigned int, DWord*); #endif diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index e4573abac3f..37d1bd1b14d 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -27,36 +27,9 @@ #include // for NewHandler -void* operator new(size_t sz, TaoCrypt::new_t) -{ - void* ptr = ::operator new(sz); - - if (!ptr) abort(); - - return ptr; -} - -void* operator new[](size_t sz, TaoCrypt::new_t tc) -{ -#if defined(_MSC_VER) && (_MSC_VER < 1300) - void* ptr = ::operator new(sz); // no ::operator new[] -#else - void* ptr = ::operator new[](sz); -#endif - - if (!ptr) abort(); - - return ptr; -} - - - namespace TaoCrypt { -new_t tc; // for library new - - inline void XorWords(word* r, const word* a, unsigned int n) { for (unsigned int i=0; i::pointer StdReallocate >(AllocatorWithCleanup&, unsigned char*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, unsigned int*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); -template class AbstractGroup; -template class AbstractRing; template class RSA_Decryptor; template class RSA_Encryptor; template class RSA_Encryptor; @@ -227,11 +224,7 @@ template class RSA_Encryptor; namespace mySTL { template TaoCrypt::Integer* uninit_copy(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*); template TaoCrypt::Integer* uninit_fill_n(TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer const&); -template TaoCrypt::WindowSlider* uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template vector* uninit_fill_n*, unsigned int, vector >(vector*, unsigned int, vector const&); template void destroy(TaoCrypt::Integer*, TaoCrypt::Integer*); -template void destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template void destroy*>(vector*, vector*); } #endif From 9c8b4c93bb08ed3ea3fa85cc311d90f36b484a6b Mon Sep 17 00:00:00 2001 From: "acurtis@xiphis.org" <> Date: Tue, 24 May 2005 22:31:57 +0100 Subject: [PATCH 36/78] Fix after merge --- mysql-test/r/rpl_log.result | 8 ++++++-- mysql-test/r/rpl_rotate_logs.result | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index d32956428a5..e150cf53585 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -70,12 +70,16 @@ master-bin.000002 434 Query 1 510 use `test`; drop table t1 show binary logs; Log_name File_size master-bin.000001 0 -master-bin.000002 276 +master-bin.000002 510 +Warnings: +Error 29 File 'master-bin.000001' not found (Errcode: 2) start slave; show binary logs; Log_name File_size slave-bin.000001 0 -slave-bin.000002 170 +slave-bin.000002 348 +Warnings: +Error 29 File 'slave-bin.000001' not found (Errcode: 2) show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4 diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 098f8e4a5dd..b9724386909 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -29,7 +29,10 @@ show binary logs; Log_name File_size master-bin.000001 0 master-bin.000002 0 -master-bin.000003 4 +master-bin.000003 98 +Warnings: +Error 29 File 'master-bin.000001' not found (Errcode: 2) +Error 29 File 'master-bin.000002' not found (Errcode: 2) create table t3 select * from temp_table; select * from t3; a @@ -44,16 +47,20 @@ purge master logs to 'master-bin.000002'; show master logs; Log_name File_size master-bin.000002 0 -master-bin.000003 229 +master-bin.000003 407 +Warnings: +Error 29 File 'master-bin.000002' not found (Errcode: 2) purge binary logs to 'master-bin.000002'; show binary logs; Log_name File_size master-bin.000002 0 -master-bin.000003 229 +master-bin.000003 407 +Warnings: +Error 29 File 'master-bin.000002' not found (Errcode: 2) purge master logs before now(); show binary logs; Log_name File_size -master-bin.000003 229 +master-bin.000003 407 insert into t2 values (65); show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master @@ -75,8 +82,11 @@ create table t4 select * from temp_table; show binary logs; Log_name File_size master-bin.000003 0 -master-bin.000004 2886 -master-bin.000005 +master-bin.000004 0 +master-bin.000005 2032 +Warnings: +Error 29 File 'master-bin.000003' not found (Errcode: 2) +Error 29 File 'master-bin.000004' not found (Errcode: 2) show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000005 2032 From a6af23a046e8954b7726a5a63f14237b8c685b50 Mon Sep 17 00:00:00 2001 From: "patg@radha.local" <> Date: Wed, 25 May 2005 02:15:09 +0200 Subject: [PATCH 37/78] changes to fix joins not working (bug #10848). New tests, as well as table->status being set in index_read_idx --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/federated.result | 52 +++++++++++++++++++++++++++++++++-- mysql-test/t/federated.test | 34 +++++++++++++++++++++-- sql/ha_federated.cc | 2 ++ 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index d8d16aaa1d8..3230f3c119f 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -205,6 +205,7 @@ patg@krsna. patg@krsna.patg.net patg@patrick-galbraiths-computer.local patg@pc248.lfp.kcls.org +patg@radha.local paul@central.snake.net paul@frost.snake.net paul@ice.local diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 6c815e94b7c..ebf9b144eeb 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -906,9 +906,57 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; +name country_id other country +Kumar 1 11111 India +Lenz 2 22222 Germany +Marizio 3 33333 Italy +Monty 4 33333 Finland +Sanja 5 33333 Ukraine +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; +name country_id other country +Kumar 1 11111 India +Lenz 2 22222 Germany +Marizio 3 33333 Italy +Monty 4 33333 Finland +Sanja 5 33333 Ukraine +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; +name country_id other country +Monty 4 33333 Finland SELECT federated.t1.*, federated.countries.country -FROM federated.t1 left join federated.countries -ON federated.t1.country_id = federated.countries.id; +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; +id country_id name other country +1 1 Kumar 11111 India +2 2 Lenz 22222 Germany +3 3 Marizio 33333 Italy +4 4 Monty 33333 Finland +5 5 Sanja 33333 Ukraine +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; +id country_id name other country +4 4 Monty 33333 Finland +2 2 Lenz 22222 Germany +1 1 Kumar 11111 India +3 3 Marizio 33333 Italy +5 5 Sanja 33333 Ukraine +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; id country_id name other country 1 1 Kumar 11111 India 2 2 Lenz 22222 Germany diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 6a0e0bdac79..da8df543ed0 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -861,9 +861,39 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); +#inner join +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; + +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; + +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; + +#left join SELECT federated.t1.*, federated.countries.country -FROM federated.t1 left join federated.countries -ON federated.t1.country_id = federated.countries.id; +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; + +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; + +#right join +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; DROP TABLE federated.countries; diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 8cb6dcb7285..eab3e55c4a4 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1526,6 +1526,8 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, table->status= STATUS_NOT_FOUND; DBUG_RETURN(mysql_errno(mysql)); } + /* very important - joins will not work without this! */ + table->status=0; DBUG_RETURN(rnd_next(buf)); } From 274fee09c9960a31ae9af53b2abdee4743fafcc5 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Wed, 25 May 2005 12:18:18 +1000 Subject: [PATCH 38/78] BUG#10796 Incorrect check-cpu result for ppc linux gcc --- BUILD/check-cpu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 7619224314b..0283c669fb2 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -72,6 +72,7 @@ case "$cpu_family--$model_name" in ;; *ppc) cpu_flag="powerpc"; + no_march=1; ;; *) cpu_flag=""; @@ -106,6 +107,9 @@ case "$cc_ver--$cc_verno" in cpu_flag="$cpu_flag_old" fi check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag" + if test -n "$no_march"; then + check_cpu_cflags="-mcpu=$cpu_flag" + fi ;; *) check_cpu_cflags="" From 119e500c80ba14d5f6262addc7020c310587207d Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Wed, 25 May 2005 15:35:51 +1000 Subject: [PATCH 39/78] BUG#10831 ndb mgmd LogDestination maxfiles does not rotate logs properly --- ndb/src/common/util/File.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index 937b8c0fa59..e514ad8e122 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -28,29 +28,9 @@ bool File_class::exists(const char* aFileName) { - bool rc = true; -#ifdef USE_MY_STAT_STRUCT - struct my_stat stmp; -#else - struct stat stmp; -#endif - if (my_stat(aFileName, &stmp, MYF(0)) != 0) - { - rc = false; - } - - /* - File f; - if (!f.open(aFileName, "r")) - { - rc = (errno == ENOENT ? false : true); - } - else - { - f.close(); - } - */ - return rc; + MY_STAT stmp; + + return (my_stat(aFileName, &stmp, MYF(0))!=NULL); } long From 0ed2e577318c5121ac3509ce16b829f37f02a8ed Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 25 May 2005 11:10:10 +0200 Subject: [PATCH 40/78] Use one err file for each master --- mysql-test/mysql-test-run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 4fee560ee44..3f7e7d22200 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1181,8 +1181,8 @@ start_master() $NOT_FIRST_MASTER_EXTRA_OPTS" fi - CUR_MYERR=$MASTER_MYERR - CUR_MYSOCK=$MASTER_MYSOCK + CUR_MYERR=$MASTER_MYERR$1 + CUR_MYSOCK=$MASTER_MYSOCK$1 # For embedded server we collect the server flags and return if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then From 5a8cfc1541b8ba07e696f093e840bd2952a1adbe Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Wed, 25 May 2005 12:41:57 +0300 Subject: [PATCH 41/78] srv0start.c: innobase_shutdown_for_mysql(): Do very fast shutdown only if srv_fast_shutdown==2, not if srv_fast_shutdown!=0 (Bug #9673) --- innobase/srv/srv0start.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index e136aee43e8..541b73b831d 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1736,7 +1736,7 @@ innobase_shutdown_for_mysql(void) " InnoDB: MySQL has requested a very fast shutdown without flushing " "the InnoDB buffer pool to data files. At the next mysqld startup " "InnoDB will do a crash recovery!\n"); - } + } #ifdef __NETWARE__ if(!panic_shutdown) @@ -1758,8 +1758,9 @@ innobase_shutdown_for_mysql(void) to die; all which counts is that we flushed the log; a 'very fast' shutdown is essentially a crash. */ - if (srv_fast_shutdown) - return((int) DB_SUCCESS); + if (srv_fast_shutdown == 2) { + return(DB_SUCCESS); + } /* All threads end up waiting for certain events. Put those events to the signaled state. Then the threads will exit themselves in From fb90aaa7b59d7437e9a76bc668e4b57e74d35afa Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Wed, 25 May 2005 12:56:47 +0300 Subject: [PATCH 42/78] Cleanup during code review Faster detection of wrong table names (like PRN) on windows --- include/my_sys.h | 1 + mysys/my_access.c | 120 ++++++++++++++++++++++++++++++++++++---------- mysys/my_fopen.c | 11 +++-- mysys/my_open.c | 13 +++-- sql/sql_lex.cc | 2 +- sql/sql_parse.cc | 5 +- sql/sql_repl.cc | 36 +++++++------- 7 files changed, 132 insertions(+), 56 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index a0a008056ae..70c410e66d8 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -578,6 +578,7 @@ extern int my_access(const char *path, int amode); #else #define my_access access #endif +extern int check_if_legal_filename(const char *path); #ifndef TERMINATE extern void TERMINATE(FILE *file); diff --git a/mysys/my_access.c b/mysys/my_access.c index 6a8887e42a6..28210bdfc7d 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -15,39 +15,107 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "mysys_priv.h" +#include #ifdef __WIN__ /* - * Check a file or path for accessability. - * - * SYNOPSIS - * file_access() - * pathpath to check - * amodemode to check - * - * DESCRIPTION - * This function wraps the normal access method because the access - * available in MSVCRT> +reports that filenames such as LPT1 and - * COM1 are valid (they are but should not be so for us). - * - * RETURN VALUES - * 0 ok - * -1 error - */ + Check a file or path for accessability. + + SYNOPSIS + file_access() + path Path to file + amode Access method + + DESCRIPTION + This function wraps the normal access method because the access + available in MSVCRT> +reports that filenames such as LPT1 and + COM1 are valid (they are but should not be so for us). + + RETURN VALUES + 0 ok + -1 error (We use -1 as my_access is mapped to access on other platforms) +*/ + int my_access(const char *path, int amode) { - WIN32_FILE_ATTRIBUTE_DATA fileinfo; - BOOL result; + WIN32_FILE_ATTRIBUTE_DATA fileinfo; + BOOL result; - result = GetFileAttributesEx(path, GetFileExInfoStandard, - &fileinfo); - if (! result) - return -1; - if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && - (amode & 2)) - return -1; - return 0; + result= GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo); + if (! result || + (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && (amode & W_OK)) + { + my_errno= errno= EACCES; + return -1; + } + return 0; } +#endif /* __WIN__ */ + +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) + +/* + List of file names that causes problem on windows + + NOTE that one can also not have file names of type CON.TXT +*/ + +static const char *reserved_names[]= +{ + "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", + "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", + "LPT7", "LPT8", "LPT9", "CLOCK$", + NullS +}; + +#define MAX_RESERVED_NAME_LENGTH 6 + +/* + Check if a path will access a reserverd file name that may cause problems + + SYNOPSIS + check_if_legal_filename + path Path to file + + RETURN + 0 ok + 1 reserved file name +*/ + +int check_if_legal_filename(const char *path) +{ + const char *end; + const char **reserved_name; + DBUG_ENTER("check_if_legal_filename"); + + path+= dirname_length(path); /* To start of filename */ + if (!(end= strchr(path, FN_EXTCHAR))) + end= strend(path); + if (path == end || (uint) (path - end) > MAX_RESERVED_NAME_LENGTH) + DBUG_RETURN(0); /* Simplify inner loop */ + + for (reserved_name= reserved_names; *reserved_name; reserved_name++) + { + const char *name= path; + while (name != end) + { + if (my_toupper(&my_charset_latin1, *path) != + my_toupper(&my_charset_latin1, *name)) + break; + if (name++ == end) + DBUG_RETURN(1); /* Found wrong path */ + } + } + DBUG_RETURN(0); +} #endif + + +#ifdef OS2 +int check_if_legal_filename(const char *path) +{ + return 0; +} +#endif /* OS2 */ diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 4310250bd0d..3c6f1b15384 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -39,13 +39,16 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) very well */ #ifdef __WIN__ - if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) - fd=0; + if (check_if_legal_filename(FileName)) + { + errno= EACCES; + fd= 0; + } else #endif { - make_ftype(type,Flags); - fd = fopen(FileName, type); + make_ftype(type,Flags); + fd = fopen(FileName, type); } if (fd != 0) diff --git a/mysys/my_open.c b/mysys/my_open.c index ea4d99c3e8c..7cf40b57403 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -47,12 +47,15 @@ File my_open(const char *FileName, int Flags, myf MyFlags) FileName, Flags, MyFlags)); #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) /* - if we are not creating, then we need to use my_access to make - sure the file exists since Windows doesn't handle files like - "com1.sym" very well + Check that we don't try to open or create a file name that may + cause problems for us in the future (like PRN) */ - if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) - return -1; + if (check_if_legal_filename(FileName)) + { + errno= EACCES; + DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN, + EE_FILENOTFOUND, MyFlags)); + } if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d6dcd9ce9ae..904b4675c74 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -420,7 +420,7 @@ static const uint signed_longlong_len=19; static const char *unsigned_longlong_str="18446744073709551615"; static const uint unsigned_longlong_len=20; -inline static uint int_token(const char *str,uint length) +static inline uint int_token(const char *str,uint length) { if (length < long_len) // quick normal case return NUM; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c5b429ec8fc..05838b340b8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2819,8 +2819,8 @@ unsent_create_error: TABLE *table= tables->table; /* Skip first table, which is the table we are inserting in */ - lex->select_lex.table_list.first= (byte*) first_local_table->next; - tables= (TABLE_LIST *) lex->select_lex.table_list.first; + select_lex->table_list.first= (byte*) first_local_table->next; + tables= (TABLE_LIST *) select_lex->table_list.first; first_local_table->next= 0; if (!(res= mysql_prepare_insert(thd, tables, first_local_table, @@ -5389,6 +5389,7 @@ int multi_update_precheck(THD *thd, TABLE_LIST *tables) 1 error (message is sent to user) -1 error (message is not sent to user) */ + int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count) { DBUG_ENTER("multi_delete_precheck"); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 24b78bc9a3d..4249c9e1809 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -152,7 +152,8 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, File file; DBUG_ENTER("open_binlog"); - if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0) + if ((file = my_open(log_file_name, O_RDONLY | O_BINARY | O_SHARE, + MYF(MY_WME))) < 0) { sql_print_error("Failed to open log (\ file '%s', errno %d)", log_file_name, my_errno); @@ -1338,13 +1339,11 @@ int show_binlogs(THD* thd) { IO_CACHE *index_file; LOG_INFO cur; - IO_CACHE log; File file; - const char *errmsg= 0; - MY_STAT stat_area; char fname[FN_REFLEN]; List field_list; uint length; + int cur_dir_len; Protocol *protocol= thd->protocol; DBUG_ENTER("show_binlogs"); @@ -1364,34 +1363,35 @@ int show_binlogs(THD* thd) index_file=mysql_bin_log.get_index_file(); mysql_bin_log.get_current_log(&cur); - int cur_dir_len = dirname_length(cur.log_file_name); + cur_dir_len= dirname_length(cur.log_file_name); reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0); /* The file ends with EOF or empty line */ while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1) { - fname[--length] = '\0'; /* remove the newline */ + int dir_len; + ulonglong file_length= 0; // Length if open fails + fname[--length] = '\0'; // remove the newline protocol->prepare_for_resend(); - int dir_len = dirname_length(fname); - protocol->store(fname + dir_len, length-dir_len, &my_charset_bin); - if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len))) + dir_len= dirname_length(fname); + length-= dir_len; + protocol->store(fname + dir_len, length, &my_charset_bin); + + if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length))) + file_length= cur.pos; /* The active log, use the active position */ + else { - /* this is the active log, use the active position */ - protocol->store((ulonglong) cur.pos); - } else { /* this is an old log, open it and find the size */ - if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0) + if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY, + MYF(0))) >= 0) { - protocol->store((ulonglong) my_b_filelength(&log)); - end_io_cache(&log); + file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0)); my_close(file, MYF(0)); - } else { - /* the file wasn't openable, but 0 is an invalid value anyway */ - protocol->store((ulonglong) 0); } } + protocol->store(file_length); if (protocol->write()) goto err; } From b763679f1c040ac21ac6e58e5272a5f53167af1d Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com" <> Date: Wed, 25 May 2005 19:11:36 +0500 Subject: [PATCH 43/78] WL#2286 - Compile MySQL w/YASSL support Merge with latest yaSSL, fix compilation error for SSE2 processors. --- extra/yassl/include/yassl_int.hpp | 6 ++++-- extra/yassl/src/log.cpp | 6 +++--- extra/yassl/src/yassl_int.cpp | 9 +++++---- extra/yassl/taocrypt/include/integer.hpp | 2 +- extra/yassl/taocrypt/src/integer.cpp | 3 +++ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index c9168254907..876f730a07d 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -122,7 +122,8 @@ public: friend sslFactory& GetSSL_Factory(); // singleton creator private: - static sslFactory instance; + static sslFactory instance_; + sslFactory(const sslFactory&); // hide copy sslFactory& operator=(const sslFactory&); // and assign }; @@ -207,9 +208,10 @@ public: friend Sessions& GetSessions(); // singleton creator private: + static Sessions instance_; + Sessions(const Sessions&); // hide copy Sessions& operator=(const Sessions&); // and assign - static Sessions instance; }; diff --git a/extra/yassl/src/log.cpp b/extra/yassl/src/log.cpp index eb4776d3d19..19072a5e09c 100644 --- a/extra/yassl/src/log.cpp +++ b/extra/yassl/src/log.cpp @@ -26,9 +26,9 @@ #include "log.hpp" #ifdef YASSL_LOG - #include - #include - #include + #include + #include + #include #endif diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index f32a8420b98..718871a598b 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1324,18 +1324,19 @@ SSL_SESSION::~SSL_SESSION() } -Sessions Sessions::instance; // simple singleton +Sessions Sessions::instance_; // simple singleton Sessions& GetSessions() { - return Sessions::instance; + return Sessions::instance_; } -sslFactory sslFactory::instance; + +sslFactory sslFactory::instance_; // simple singleton sslFactory& GetSSL_Factory() { - return sslFactory::instance; + return sslFactory::instance_; } diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp index 6b1984e46ed..e9e4a7218bd 100644 --- a/extra/yassl/taocrypt/include/integer.hpp +++ b/extra/yassl/taocrypt/include/integer.hpp @@ -251,11 +251,11 @@ public: private: friend class ModularArithmetic; friend class MontgomeryRepresentation; - Integer(word value, unsigned int length); static const Integer zero; static const Integer one; static const Integer two; + Integer(word value, unsigned int length); int PositiveCompare(const Integer& t) const; friend void PositiveAdd(Integer& sum, const Integer& a, const Integer& b); diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 37cfe374451..b6a1b72a41f 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -3948,6 +3948,9 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, #ifdef __GNUC__ template unsigned int DivideThreeWordsByTwo(unsigned int*, unsigned int, unsigned int, DWord*); +#if defined(SSE2_INTRINSICS_AVAILABLE) +template AlignedAllocator::pointer StdReallocate >(AlignedAllocator&, unsigned int*, AlignedAllocator::size_type, AlignedAllocator::size_type, bool); +#endif #endif } // namespace From 0d121fe01ac1e784a43bf0833ecab17aac702e64 Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Wed, 25 May 2005 16:24:07 +0200 Subject: [PATCH 44/78] Added a missing "make clean" to the RPM "spec" file which had caused the original 4.1.12 RPMs to be broken. (bug#10674, bug#10681) --- support-files/mysql.spec.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 8b880c32051..2354b44f4fa 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -299,6 +299,9 @@ fi (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) +# Now clean up +make clean + # RPM:s destroys Makefile.in files, so we generate them here # aclocal; autoheader; aclocal; automake; autoconf # (cd innobase && aclocal && autoheader && aclocal && automake && autoconf) @@ -584,6 +587,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Wed May 25 2005 Joerg Bruehe + +- Added a "make clean" between separate calls to "BuildMySQL". + * Wed Apr 13 2005 Lenz Grimmer - removed the MySQL manual files (html/ps/texi) - they have been removed From 5f8f947f343f54d6a03a687ed8bbbf2dd56ceea7 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Wed, 25 May 2005 18:33:32 +0300 Subject: [PATCH 45/78] Cleanup's during review Added ASSERT() to detect wrongly packed fields --- sql/field.h | 10 ++++++---- sql/opt_range.cc | 40 +++++++++++++++++++--------------------- sql/sql_base.cc | 4 ++-- sql/sql_insert.cc | 7 ++++--- sql/sql_select.cc | 11 ++++------- sql/unireg.cc | 9 ++++++--- 6 files changed, 41 insertions(+), 40 deletions(-) diff --git a/sql/field.h b/sql/field.h index f68a2327dff..d58746b6068 100644 --- a/sql/field.h +++ b/sql/field.h @@ -439,10 +439,12 @@ public: /* The maximum number of decimal digits can be stored */ uint precision; uint bin_size; - /* Constructors take max_length of the field as a parameter - not the */ - /* precision as the number of decimal digits allowed */ - /* So for example we need to count length from precision handling */ - /* CREATE TABLE ( DECIMAL(x,y)) */ + /* + Constructors take max_length of the field as a parameter - not the + precision as the number of decimal digits allowed. + So for example we need to count length from precision handling + CREATE TABLE ( DECIMAL(x,y)) + */ Field_new_decimal(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ca3f5c5af87..0aa0468fc36 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3307,32 +3307,35 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param, /* - Build a SEL_TREE for <> predicate + Build a SEL_TREE for <> or NOT BETWEEN predicate SYNOPSIS get_ne_mm_tree() param PARAM from SQL_SELECT::test_quick_select cond_func item for the predicate field field in the predicate - value constant in the predicate + lt_value constant that field should be smaller + gt_value constant that field should be greaterr cmp_type compare type for the field RETURN - Pointer to tree built tree + # Pointer to tree built tree + 0 on error */ static SEL_TREE *get_ne_mm_tree(PARAM *param, Item_func *cond_func, - Field *field, Item *value, + Field *field, + Item *lt_value, Item *gt_value, Item_result cmp_type) { - SEL_TREE *tree= 0; + SEL_TREE *tree; tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC, - value, cmp_type); + lt_value, cmp_type); if (tree) { tree= tree_or(param, tree, get_mm_parts(param, cond_func, field, Item_func::GT_FUNC, - value, cmp_type)); + gt_value, cmp_type)); } return tree; } @@ -3365,21 +3368,14 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func, switch (cond_func->functype()) { case Item_func::NE_FUNC: - tree= get_ne_mm_tree(param, cond_func, field, value, cmp_type); + tree= get_ne_mm_tree(param, cond_func, field, value, value, cmp_type); break; case Item_func::BETWEEN: if (inv) { - tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC, - cond_func->arguments()[1],cmp_type); - if (tree) - { - tree= tree_or(param, tree, get_mm_parts(param, cond_func, field, - Item_func::GT_FUNC, - cond_func->arguments()[2], - cmp_type)); - } + tree= get_ne_mm_tree(param, cond_func, field, cond_func->arguments()[1], + cond_func->arguments()[2], cmp_type); } else { @@ -3402,7 +3398,8 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func, if (inv) { tree= get_ne_mm_tree(param, cond_func, field, - func->arguments()[1], cmp_type); + func->arguments()[1], func->arguments()[1], + cmp_type); if (tree) { Item **arg, **end; @@ -3410,7 +3407,7 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func, arg < end ; arg++) { tree= tree_and(param, tree, get_ne_mm_tree(param, cond_func, field, - *arg, cmp_type)); + *arg, *arg, cmp_type)); } } } @@ -3523,17 +3520,18 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond) Item_func *cond_func= (Item_func*) cond; if (cond_func->functype() == Item_func::NOT_FUNC) { + /* Optimize NOT BETWEEN and NOT IN */ Item *arg= cond_func->arguments()[0]; if (arg->type() == Item::FUNC_ITEM) { cond_func= (Item_func*) arg; if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE) DBUG_RETURN(0); - inv= TRUE; + inv= TRUE; } else DBUG_RETURN(0); - } + } else if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE) DBUG_RETURN(0); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 29d9a7bf9c4..f5c4889cfe4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1607,9 +1607,9 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, trying to discover the table at the same time. */ if (discover_retry_count++ != 0) - goto err; + goto err; if (ha_create_table_from_engine(thd, db, name, TRUE) != 0) - goto err; + goto err; mysql_reset_errors(thd, 1); // Clear warnings thd->clear_error(); // Clear error message diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 0bd9099ede1..ff07588c468 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -872,9 +872,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) if (info->handle_duplicates == DUP_UPDATE) { int res= 0; - /* we don't check for other UNIQUE keys - the first row - that matches, is updated. If update causes a conflict again, - an error is returned + /* + We don't check for other UNIQUE keys - the first row + that matches, is updated. If update causes a conflict again, + an error is returned */ DBUG_ASSERT(table->insert_values != NULL); store_record(table,insert_values); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 26e8b398844..3b4db62d1f4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2825,17 +2825,14 @@ add_key_fields(KEY_FIELD **key_fields,uint *and_level, if (cond_func->functype() == Item_func::NOT_FUNC) { Item *item= cond_func->arguments()[0]; - /* - At this moment all NOT before simple comparison predicates - are eliminated. NOT IN and NOT BETWEEN are treated similar - IN and BETWEEN respectively. + /* + At this moment all NOT before simple comparison predicates + are eliminated. NOT IN and NOT BETWEEN are treated similar + IN and BETWEEN respectively. */ if (item->type() == Item::FUNC_ITEM && ((Item_func *) item)->select_optimize() == Item_func::OPTIMIZE_KEY) - { add_key_fields(key_fields,and_level,item,usable_tables); - return; - } return; } switch (cond_func->select_optimize()) { diff --git a/sql/unireg.cc b/sql/unireg.cc index 57d9fd07e51..123079291c2 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -73,6 +73,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, handler *db_file) { uint reclength,info_length,screens,key_info_length,maxlength; + ulong key_buff_length; File file; ulong filepos, data_offset; uchar fileinfo[64],forminfo[288],*keybuff; @@ -119,7 +120,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, DBUG_RETURN(1); } - uint key_buff_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; + key_buff_length= uint4korr(fileinfo+47); keybuff=(uchar*) my_malloc(key_buff_length, MYF(0)); key_info_length= pack_keys(keybuff, keys, key_info, data_offset); VOID(get_form_pos(file,fileinfo,&formnames)); @@ -128,7 +129,6 @@ bool mysql_create_frm(THD *thd, my_string file_name, maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000)); int2store(forminfo+2,maxlength); int4store(fileinfo+10,(ulong) (filepos+maxlength)); - int4store(fileinfo+47,key_buff_length); fileinfo[26]= (uchar) test((create_info->max_rows == 1) && (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); @@ -411,7 +411,8 @@ static bool pack_header(uchar *forminfo, enum db_type table_type, DBUG_RETURN(1); } - totlength=reclength=0L; + totlength= 0L; + reclength= data_offset; no_empty=int_count=int_parts=int_length=time_stamp_pos=null_fields= com_length=0; n_length=2L; @@ -440,6 +441,8 @@ static bool pack_header(uchar *forminfo, enum db_type table_type, !time_stamp_pos) time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1; length=field->pack_length; + /* Ensure we don't have any bugs when generating offsets */ + DBUG_ASSERT(reclength == field->offset + data_offset); if ((uint) field->offset+ (uint) data_offset+ length > reclength) reclength=(uint) (field->offset+ data_offset + length); n_length+= (ulong) strlen(field->field_name)+1; From cb7cd3322253e52602ae839923a89fafd65edb39 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Wed, 25 May 2005 18:33:36 +0300 Subject: [PATCH 46/78] Fix that we can read tables with the 'older' decimal format used in 5.0.3 & 5.0.4 We will however give a warning when opening such a table that users should use ALTER TABLE ... FORCE to fix the table. In future release we will fix that REPAIR TABLE will be able to handle this case --- sql/sql_lex.h | 1 + sql/sql_table.cc | 17 ++++++++++++-- sql/sql_yacc.yy | 4 ++++ sql/table.cc | 59 +++++++++++++++++++++++++++++++++++++++++++++--- sql/table.h | 2 +- 5 files changed, 77 insertions(+), 6 deletions(-) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index fffb8ff9ae6..269f8b295f9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -635,6 +635,7 @@ typedef class st_select_lex SELECT_LEX; #define ALTER_CHANGE_COLUMN_DEFAULT 256 #define ALTER_KEYS_ONOFF 512 #define ALTER_CONVERT 1024 +#define ALTER_FORCE 2048 typedef struct st_alter_info { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 4ddef3fc653..f44d3191375 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2202,12 +2202,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify) { char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; + uint length; protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); protocol->store(operator_name, system_charset_info); protocol->store("error", 5, system_charset_info); - my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY), table_name); - protocol->store(buff, system_charset_info); + length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY), + table_name); + protocol->store(buff, length, system_charset_info); close_thread_tables(thd); table->table=0; // For query cache if (protocol->write()) @@ -2238,6 +2240,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, open_for_modify= 0; } + if (table->table->s->crashed && operator_func == &handler::check) + { + protocol->prepare_for_resend(); + protocol->store(table_name, system_charset_info); + protocol->store(operator_name, system_charset_info); + protocol->store("warning", 7, system_charset_info); + protocol->store("Table is marked as crashed", 26, system_charset_info); + if (protocol->write()) + goto err; + } + result_code = (table->table->file->*operator_func)(thd, check_opt); send_result: diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f4af0dd1ded..8a37bfebccc 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3512,6 +3512,10 @@ alter_list_item: LEX *lex=Lex; lex->alter_info.flags|= ALTER_OPTIONS; } + | FORCE_SYM + { + Lex->alter_info.flags|= ALTER_FORCE; + } | order_clause { LEX *lex=Lex; diff --git a/sql/table.cc b/sql/table.cc index d3ba4056571..7755217532b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -166,6 +166,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, share->db_type= ha_checktype((enum db_type) (uint) *(head+3)); share->db_create_options= db_create_options=uint2korr(head+30); share->db_options_in_use= share->db_create_options; + share->mysql_version= uint4korr(head+51); null_field_first= 0; if (!head[32]) // New frm file in 3.23 { @@ -572,6 +573,29 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, error= 4; goto err; /* purecov: inspected */ } +#ifndef TO_BE_DELETED_ON_PRODUCTION + if (field_type == FIELD_TYPE_NEWDECIMAL && !share->mysql_version) + { + /* + Fix pack length of old decimal values from 5.0.3 -> 5.0.4 + The difference is that in the old version we stored precision + in the .frm table while we now store the display_length + */ + Field_new_decimal *dec_field= (Field_new_decimal*) reg_field; + dec_field->bin_size= my_decimal_get_binary_size(field_length, + dec_field->dec); + dec_field->precision= field_length; + dec_field->field_length= + my_decimal_precision_to_length(field_length, dec_field->dec, + dec_field->unsigned_flag); + sql_print_error("Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", dec_field->field_name, name, share->table_name); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CRASHED_ON_USAGE, + "Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", dec_field->field_name, name, share->table_name); + share->crashed= 1; // Marker for CHECK TABLE + } +#endif + reg_field->comment=comment; if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag)) { @@ -712,6 +736,28 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } if (field->key_length() != key_part->length) { +#ifndef TO_BE_DELETED_ON_PRODUCTION + if (field->type() == FIELD_TYPE_NEWDECIMAL) + { + /* + Fix a fatal error in decimal key handling that causes crashes + on Innodb. We fix it by reducing the key length so that + InnoDB never gets a too big key when searching. + This allows the end user to do an ALTER TABLE to fix the + error. + */ + keyinfo->key_length-= (key_part->length - field->key_length()); + key_part->store_length-= (key_part->length - field->key_length()); + key_part->length= field->key_length(); + sql_print_error("Found wrong key definition in %s; Please do \"ALTER TABLE '%s' FORCE \" to fix it!", name, share->table_name); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CRASHED_ON_USAGE, + "Found wrong key definition in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", name, share->table_name); + + share->crashed= 1; // Marker for CHECK TABLE + goto to_be_deleted; + } +#endif key_part->key_part_flag|= HA_PART_KEY_SEG; if (!(field->flags & BLOB_FLAG)) { // Create a new field @@ -720,6 +766,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, field->field_length=key_part->length; } } + + to_be_deleted: + /* If the field can be NULL, don't optimize away the test key_part_column = expression from the WHERE clause @@ -1298,7 +1347,6 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys) { register File file; - uint key_length; ulong length; char fill[IO_SIZE]; int create_flags= O_RDWR | O_TRUNC; @@ -1321,6 +1369,8 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, if ((file= my_create(name, CREATE_MODE, create_flags, MYF(MY_WME))) >= 0) { + uint key_length, tmp_key_length; + uint tmp; bzero((char*) fileinfo,64); /* header */ fileinfo[0]=(uchar) 254; @@ -1333,8 +1383,8 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength)); int4store(fileinfo+10,length); - if (key_length > 0xffff) key_length=0xffff; - int2store(fileinfo+14,key_length); + tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff; + int2store(fileinfo+14,tmp_key_length); int2store(fileinfo+16,reclength); int4store(fileinfo+18,create_info->max_rows); int4store(fileinfo+22,create_info->min_rows); @@ -1350,6 +1400,9 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, fileinfo[41]= (uchar) create_info->raid_type; fileinfo[42]= (uchar) create_info->raid_chunks; int4store(fileinfo+43,create_info->raid_chunksize); + int4store(fileinfo+47, key_length); + tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store + int4store(fileinfo+51, tmp); bzero(fill,IO_SIZE); for (; length > IO_SIZE ; length-= IO_SIZE) { diff --git a/sql/table.h b/sql/table.h index 2e397ff95bf..8043429999b 100644 --- a/sql/table.h +++ b/sql/table.h @@ -126,7 +126,7 @@ typedef struct st_table_share key_map keys_for_keyread; ulong avg_row_length; /* create information */ ulong raid_chunksize; - ulong version, flush_version; + ulong version, flush_version, mysql_version; ulong timestamp_offset; /* Set to offset+1 of record */ ulong reclength; /* Recordlength */ From 264de67fc606af9aea193696290a8ad401369cc3 Mon Sep 17 00:00:00 2001 From: "tulin@mysql.com" <> Date: Wed, 25 May 2005 17:54:36 +0200 Subject: [PATCH 47/78] Bug #10838 CREATE TABLE produces strange DEFAULT value --- mysql-test/r/bugs.result | 138 +++++++++++++++++++++++++++++++++++++++ mysql-test/t/bugs.test | 85 ++++++++++++++++++++++++ sql/unireg.cc | 7 +- 3 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 mysql-test/r/bugs.result create mode 100644 mysql-test/t/bugs.test diff --git a/mysql-test/r/bugs.result b/mysql-test/r/bugs.result new file mode 100644 index 00000000000..7db20c2b096 --- /dev/null +++ b/mysql-test/r/bugs.result @@ -0,0 +1,138 @@ +drop table if exists t1,t2,t3,t4,t5,t6; +drop database if exists mysqltest; +CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ', +b varchar(1) binary NOT NULL DEFAULT ' ', +c varchar(4) binary NOT NULL DEFAULT '0000', +d tinyblob NULL, +e tinyblob NULL, +f tinyblob NULL, +g tinyblob NULL, +h tinyblob NULL, +i tinyblob NULL, +j tinyblob NULL, +k tinyblob NULL, +l tinyblob NULL, +m tinyblob NULL, +n tinyblob NULL, +o tinyblob NULL, +p tinyblob NULL, +q varchar(30) binary NOT NULL DEFAULT ' ', +r varchar(30) binary NOT NULL DEFAULT ' ', +s tinyblob NULL, +t varchar(4) binary NOT NULL DEFAULT ' ', +u varchar(1) binary NOT NULL DEFAULT ' ', +v varchar(30) binary NOT NULL DEFAULT ' ', +w varchar(30) binary NOT NULL DEFAULT ' ', +x tinyblob NULL, +y varchar(5) binary NOT NULL DEFAULT ' ', +z varchar(20) binary NOT NULL DEFAULT ' ', +a1 varchar(30) binary NOT NULL DEFAULT ' ', +b1 tinyblob NULL) +ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) collate latin1_bin NOT NULL default ' ', + `b` varchar(1) collate latin1_bin NOT NULL default ' ', + `c` varchar(4) collate latin1_bin NOT NULL default '0000', + `d` tinyblob, + `e` tinyblob, + `f` tinyblob, + `g` tinyblob, + `h` tinyblob, + `i` tinyblob, + `j` tinyblob, + `k` tinyblob, + `l` tinyblob, + `m` tinyblob, + `n` tinyblob, + `o` tinyblob, + `p` tinyblob, + `q` varchar(30) collate latin1_bin NOT NULL default ' ', + `r` varchar(30) collate latin1_bin NOT NULL default ' ', + `s` tinyblob, + `t` varchar(4) collate latin1_bin NOT NULL default ' ', + `u` varchar(1) collate latin1_bin NOT NULL default ' ', + `v` varchar(30) collate latin1_bin NOT NULL default ' ', + `w` varchar(30) collate latin1_bin NOT NULL default ' ', + `x` tinyblob, + `y` varchar(5) collate latin1_bin NOT NULL default ' ', + `z` varchar(20) collate latin1_bin NOT NULL default ' ', + `a1` varchar(30) collate latin1_bin NOT NULL default ' ', + `b1` tinyblob +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin +INSERT into t1 (b) values ('1'); +SHOW WARNINGS; +Level Code Message +SELECT * from t1; +a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1 + 1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ', +b varchar(1) binary NOT NULL DEFAULT ' ', +c varchar(4) binary NOT NULL DEFAULT '0000', +d tinyblob NULL, +e tinyblob NULL, +f tinyblob NULL, +g tinyblob NULL, +h tinyblob NULL, +i tinyblob NULL, +j tinyblob NULL, +k tinyblob NULL, +l tinyblob NULL, +m tinyblob NULL, +n tinyblob NULL, +o tinyblob NULL, +p tinyblob NULL, +q varchar(30) binary NOT NULL DEFAULT ' ', +r varchar(30) binary NOT NULL DEFAULT ' ', +s tinyblob NULL, +t varchar(4) binary NOT NULL DEFAULT ' ', +u varchar(1) binary NOT NULL DEFAULT ' ', +v varchar(30) binary NOT NULL DEFAULT ' ', +w varchar(30) binary NOT NULL DEFAULT ' ', +x tinyblob NULL, +y varchar(5) binary NOT NULL DEFAULT ' ', +z varchar(20) binary NOT NULL DEFAULT ' ', +a1 varchar(30) binary NOT NULL DEFAULT ' ', +b1 tinyblob NULL) +ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(30) collate latin1_bin NOT NULL default ' ', + `b` varchar(1) collate latin1_bin NOT NULL default ' ', + `c` varchar(4) collate latin1_bin NOT NULL default '0000', + `d` tinyblob, + `e` tinyblob, + `f` tinyblob, + `g` tinyblob, + `h` tinyblob, + `i` tinyblob, + `j` tinyblob, + `k` tinyblob, + `l` tinyblob, + `m` tinyblob, + `n` tinyblob, + `o` tinyblob, + `p` tinyblob, + `q` varchar(30) collate latin1_bin NOT NULL default ' ', + `r` varchar(30) collate latin1_bin NOT NULL default ' ', + `s` tinyblob, + `t` varchar(4) collate latin1_bin NOT NULL default ' ', + `u` varchar(1) collate latin1_bin NOT NULL default ' ', + `v` varchar(30) collate latin1_bin NOT NULL default ' ', + `w` varchar(30) collate latin1_bin NOT NULL default ' ', + `x` tinyblob, + `y` varchar(5) collate latin1_bin NOT NULL default ' ', + `z` varchar(20) collate latin1_bin NOT NULL default ' ', + `a1` varchar(30) collate latin1_bin NOT NULL default ' ', + `b1` tinyblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin +INSERT into t2 (b) values ('1'); +SHOW WARNINGS; +Level Code Message +SELECT * from t2; +a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1 + 1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +drop table t1; +drop table t2; diff --git a/mysql-test/t/bugs.test b/mysql-test/t/bugs.test new file mode 100644 index 00000000000..3b842c06561 --- /dev/null +++ b/mysql-test/t/bugs.test @@ -0,0 +1,85 @@ +# +# test of already fixed bugs +# +--disable_warnings +drop table if exists t1,t2,t3,t4,t5,t6; +drop database if exists mysqltest; +--enable_warnings + +# +# Bug 10838 +# Insert causes warnings for no default values and corrupts tables +# +CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ', + b varchar(1) binary NOT NULL DEFAULT ' ', + c varchar(4) binary NOT NULL DEFAULT '0000', + d tinyblob NULL, + e tinyblob NULL, + f tinyblob NULL, + g tinyblob NULL, + h tinyblob NULL, + i tinyblob NULL, + j tinyblob NULL, + k tinyblob NULL, + l tinyblob NULL, + m tinyblob NULL, + n tinyblob NULL, + o tinyblob NULL, + p tinyblob NULL, + q varchar(30) binary NOT NULL DEFAULT ' ', + r varchar(30) binary NOT NULL DEFAULT ' ', + s tinyblob NULL, + t varchar(4) binary NOT NULL DEFAULT ' ', + u varchar(1) binary NOT NULL DEFAULT ' ', + v varchar(30) binary NOT NULL DEFAULT ' ', + w varchar(30) binary NOT NULL DEFAULT ' ', + x tinyblob NULL, + y varchar(5) binary NOT NULL DEFAULT ' ', + z varchar(20) binary NOT NULL DEFAULT ' ', + a1 varchar(30) binary NOT NULL DEFAULT ' ', + b1 tinyblob NULL) +ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; + +SHOW CREATE TABLE t1; +INSERT into t1 (b) values ('1'); +SHOW WARNINGS; +SELECT * from t1; + +CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ', + b varchar(1) binary NOT NULL DEFAULT ' ', + c varchar(4) binary NOT NULL DEFAULT '0000', + d tinyblob NULL, + e tinyblob NULL, + f tinyblob NULL, + g tinyblob NULL, + h tinyblob NULL, + i tinyblob NULL, + j tinyblob NULL, + k tinyblob NULL, + l tinyblob NULL, + m tinyblob NULL, + n tinyblob NULL, + o tinyblob NULL, + p tinyblob NULL, + q varchar(30) binary NOT NULL DEFAULT ' ', + r varchar(30) binary NOT NULL DEFAULT ' ', + s tinyblob NULL, + t varchar(4) binary NOT NULL DEFAULT ' ', + u varchar(1) binary NOT NULL DEFAULT ' ', + v varchar(30) binary NOT NULL DEFAULT ' ', + w varchar(30) binary NOT NULL DEFAULT ' ', + x tinyblob NULL, + y varchar(5) binary NOT NULL DEFAULT ' ', + z varchar(20) binary NOT NULL DEFAULT ' ', + a1 varchar(30) binary NOT NULL DEFAULT ' ', + b1 tinyblob NULL) +ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; + +SHOW CREATE TABLE t2; +INSERT into t2 (b) values ('1'); +SHOW WARNINGS; +SELECT * from t2; + +drop table t1; +drop table t2; + diff --git a/sql/unireg.cc b/sql/unireg.cc index da463885f85..a5c5da6ec26 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -755,8 +755,11 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, } DBUG_ASSERT(data_offset == ((null_count + 7) / 8)); - /* Fill not used startpos */ - if (null_count) + /* + We need to set the unused bits to 1. If the number of bits is a multiple + of 8 there are no unused bits. + */ + if (null_count & 7) *(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1); error=(int) my_write(file,(byte*) buff, (uint) reclength,MYF_RW); From 7daf98db15dc2e203171dd50a915cff8b8c0fac4 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Thu, 26 May 2005 00:18:24 +0300 Subject: [PATCH 48/78] Move function from header file to make it easier to debug --- sql/item.cc | 16 ++++++++++++++++ sql/item.h | 15 +-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 69b1b78a961..182aef4c94c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -297,6 +297,22 @@ longlong Item::val_int_from_decimal() } +void *Item::operator new(size_t size, Item *reuse, uint *rsize) +{ + if (reuse && size <= reuse->rsize) + { + reuse->cleanup(); + TRASH((void *)reuse, size); + if (rsize) + (*rsize)= reuse->rsize; + return (void *)reuse; + } + if (rsize) + (*rsize)= size; + return (void *)sql_alloc((uint)size); +} + + Item::Item(): rsize(0), name(0), orig_name(0), name_length(0), fixed(0), collation(&my_charset_bin, DERIVATION_COERCIBLE) diff --git a/sql/item.h b/sql/item.h index f8fe05cfdb2..18b419dd6d5 100644 --- a/sql/item.h +++ b/sql/item.h @@ -233,20 +233,7 @@ public: static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } /* Special for SP local variable assignment - reusing slots */ - static void *operator new(size_t size, Item *reuse, uint *rsize) - { - if (reuse && size <= reuse->rsize) - { - reuse->cleanup(); - TRASH((void *)reuse, size); - if (rsize) - (*rsize)= reuse->rsize; - return (void *)reuse; - } - if (rsize) - (*rsize)= size; - return (void *)sql_alloc((uint)size); - } + static void *operator new(size_t size, Item *reuse, uint *rsize); static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} From 5905598e164d75ade5acdccd4765fc6ef69ac746 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Wed, 25 May 2005 14:41:50 -0700 Subject: [PATCH 49/78] Fix MERGE tables on Microsoft Windows. This a backport of the fix from the main 5.0 tree. (Bug #10687) --- myisammrg/myrg_open.c | 4 +++- mysys/my_getwd.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 0dc2f4f9768..f9cdc2bb205 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -67,7 +67,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) { if ((end=buff+length)[-1] == '\n') - end[-1]='\0'; + *--end='\0'; if (!buff[0]) continue; /* Skip empty lines */ if (buff[0] == '#') @@ -86,6 +86,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) sizeof(name_buff)-1-dir_length)); VOID(cleanup_dirname(buff,name_buff)); } + else + fn_format(buff, buff, "", "", 0); if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) goto err; if (!m_info) /* First file */ diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 89f949eca27..5663ceaa60e 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -208,7 +208,10 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) + return test(strchr(name, FN_LIBCHAR)) +#if FN_LIBCHAR != '/' + || test(strchr(name,'/')) +#endif #ifdef FN_DEVCHAR || test(strchr(name, FN_DEVCHAR)) #endif From e2955a2f13f4feb74c23a955a7c67e0d90903c2f Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Thu, 26 May 2005 02:07:13 +0200 Subject: [PATCH 50/78] init_db.sql: Updated test data in system tables --- mysql-test/lib/init_db.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql index 18699497b64..9671de49ca5 100644 --- a/mysql-test/lib/init_db.sql +++ b/mysql-test/lib/init_db.sql @@ -50,6 +50,9 @@ CREATE TABLE host ( Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin @@ -489,10 +492,11 @@ CREATE TABLE procs_priv ( Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, + Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, - Timestamp timestamp(14), Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, - PRIMARY KEY (Host,Db,User,Routine_name), + Timestamp timestamp(14), + PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin From f3cc29e93b08f56d9c4fe7fae32fa5217a005f25 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 26 May 2005 11:36:01 +0200 Subject: [PATCH 51/78] Fix compiler warning --- ndb/src/common/debugger/SignalLoggerManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/common/debugger/SignalLoggerManager.cpp b/ndb/src/common/debugger/SignalLoggerManager.cpp index 1f0bd8974e7..d8710d2058f 100644 --- a/ndb/src/common/debugger/SignalLoggerManager.cpp +++ b/ndb/src/common/debugger/SignalLoggerManager.cpp @@ -395,7 +395,7 @@ SignalLoggerManager::log(BlockNumber bno, const char * msg, ...) va_start(ap, msg); fprintf(outputStream, "%s: ", getBlockName(bno, "API")); vfprintf(outputStream, msg, ap); - fprintf(outputStream, "\n", msg); + fprintf(outputStream, "\n"); va_end(ap); } } From 83d430353ea7e95ad83807c7ba079a4eafbd2740 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 26 May 2005 12:09:14 +0200 Subject: [PATCH 52/78] Add ifdefs to control when "#pragma implementation" should be used Added some more ifdefs for "#pragma interface" --- client/sql_string.cc | 2 +- client/sql_string.h | 2 +- include/my_global.h | 5 +++++ mysys/raid.cc | 2 +- sql/field.cc | 2 +- sql/ha_berkeley.cc | 2 +- sql/ha_blackhole.cc | 2 +- sql/ha_heap.cc | 2 +- sql/ha_innodb.cc | 2 +- sql/ha_isam.cc | 2 +- sql/ha_isammrg.cc | 2 +- sql/ha_myisam.cc | 2 +- sql/ha_myisammrg.cc | 2 +- sql/ha_ndbcluster.cc | 2 +- sql/handler.cc | 2 +- sql/hash_filo.cc | 2 +- sql/item.cc | 2 +- sql/item_cmpfunc.cc | 2 +- sql/item_func.cc | 2 +- sql/item_geofunc.cc | 2 +- sql/item_strfunc.cc | 2 +- sql/item_subselect.cc | 2 +- sql/item_sum.cc | 2 +- sql/item_timefunc.cc | 2 +- sql/item_uniq.cc | 2 +- sql/item_uniq.h | 2 +- sql/log_event.cc | 2 +- sql/log_event.h | 2 +- sql/opt_range.cc | 2 +- sql/procedure.cc | 2 +- sql/protocol.cc | 2 +- sql/protocol_cursor.cc | 2 +- sql/set_var.cc | 2 +- sql/sql_analyse.cc | 2 +- sql/sql_analyse.h | 2 +- sql/sql_class.cc | 2 +- sql/sql_crypt.cc | 2 +- sql/sql_crypt.h | 2 +- sql/sql_list.cc | 2 +- sql/sql_map.cc | 2 +- sql/sql_map.h | 2 +- sql/sql_olap.cc | 2 +- sql/sql_select.cc | 2 +- sql/sql_string.cc | 2 +- sql/sql_udf.cc | 2 +- sql/tztime.cc | 2 +- 46 files changed, 50 insertions(+), 45 deletions(-) diff --git a/client/sql_string.cc b/client/sql_string.cc index 9dcf19dad1d..690997152f1 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/client/sql_string.h b/client/sql_string.h index aec40466d2b..fd6d3ef59d9 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/include/my_global.h b/include/my_global.h index f059d603976..0f6d9ac13c6 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -48,6 +48,11 @@ #define USE_PRAGMA_INTERFACE #endif +/* Determine when to use "#pragma implementation" */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3) +#define USE_PRAGMA_IMPLEMENTATION +#endif + #if defined(i386) && !defined(__i386__) #define __i386__ #endif diff --git a/mysys/raid.cc b/mysys/raid.cc index 0b688464fb3..62587c438ca 100644 --- a/mysys/raid.cc +++ b/mysys/raid.cc @@ -70,7 +70,7 @@ tonu@mysql.com & monty@mysql.com */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/field.cc b/sql/field.cc index d73257a673f..adb0368384e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -19,7 +19,7 @@ ** This file implements classes defined in field.h *****************************************************************************/ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 626201a38a6..05cad23b176 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -47,7 +47,7 @@ */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index c9c94b3a9d7..59b3f7102b5 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 033fe86720e..d584c33f061 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2d2a8f2c3b4..bb3c359ccdb 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -28,7 +28,7 @@ have disables the InnoDB inlining in this file. */ in Windows? */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc index 9de532fa7b0..31e9236460f 100644 --- a/sql/ha_isam.cc +++ b/sql/ha_isam.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_isammrg.cc b/sql/ha_isammrg.cc index 367607eef19..c0e6f665f08 100644 --- a/sql/ha_isammrg.cc +++ b/sql/ha_isammrg.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 7ddb7ca25ed..d8608c6a599 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 7a5d4fcf0a1..9ba853c49d0 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 53706b4a9ba..eaa0473df1b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -20,7 +20,7 @@ NDB Cluster */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/handler.cc b/sql/handler.cc index f174f51514e..f14564b6629 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -17,7 +17,7 @@ /* Handler-calling-functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc index b85f8054f10..ec200768222 100644 --- a/sql/hash_filo.cc +++ b/sql/hash_filo.cc @@ -20,7 +20,7 @@ ** to usage. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item.cc b/sql/item.cc index 59785813566..98aeeaa4c99 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 8498ab4800e..337ac949d35 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -17,7 +17,7 @@ /* This file defines all compare functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_func.cc b/sql/item_func.cc index 05b76eb1604..3c50e750b41 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -17,7 +17,7 @@ /* This file defines all numerical functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 2f00416bddf..c58a9e434c7 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -17,7 +17,7 @@ /* This file defines all spatial functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index baba4d9b786..5ca5caf6bdf 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -20,7 +20,7 @@ ** (This shouldn't be needed) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 301740c50ef..2e4c70ecd5f 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -22,7 +22,7 @@ SUBSELECT TODO: (sql_select.h/sql_select.cc) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_sum.cc b/sql/item_sum.cc index dd4cda4ff91..fb88fca9a2d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -17,7 +17,7 @@ /* Sum functions (COUNT, MIN...) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 23cd9c7ced2..a3cf69035f3 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -17,7 +17,7 @@ /* This file defines all time functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_uniq.cc b/sql/item_uniq.cc index 88e0cbbc0e6..0c757c0e3a3 100644 --- a/sql/item_uniq.cc +++ b/sql/item_uniq.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Compability file */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/item_uniq.h b/sql/item_uniq.h index 5582537bdbb..b7e00f9f080 100644 --- a/sql/item_uniq.h +++ b/sql/item_uniq.h @@ -16,7 +16,7 @@ /* Compability file ; This file only contains dummy functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface #endif diff --git a/sql/log_event.cc b/sql/log_event.cc index 8a949b81fc1..f2287857d37 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -16,7 +16,7 @@ #ifndef MYSQL_CLIENT -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif #include "mysql_priv.h" diff --git a/sql/log_event.h b/sql/log_event.h index f848f2ae1b9..7ae4e863fc2 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -22,7 +22,7 @@ #undef write // remove pthread.h macro definition, conflict with write() class member #endif -#if defined(__GNUC__) && !defined(MYSQL_CLIENT) +#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT) #pragma interface /* gcc class implementation */ #endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 33223b83894..bd1befb436f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -23,7 +23,7 @@ */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/procedure.cc b/sql/procedure.cc index 7779f5ce085..a0042dd879e 100644 --- a/sql/procedure.cc +++ b/sql/procedure.cc @@ -17,7 +17,7 @@ /* Procedures (functions with changes output of select) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/protocol.cc b/sql/protocol.cc index 91061426f04..6a17ae2f95b 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -19,7 +19,7 @@ The actual communction is handled by the net_xxx functions in net_serv.cc */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc index 5f35552c562..b225e06ed32 100644 --- a/sql/protocol_cursor.cc +++ b/sql/protocol_cursor.cc @@ -19,7 +19,7 @@ The actual communction is handled by the net_xxx functions in net_serv.cc */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/set_var.cc b/sql/set_var.cc index 9f63188c28a..3d3ba6d6ab7 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -48,7 +48,7 @@ new attribute. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 7ac9a0866df..fb5d0eb0a3f 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -23,7 +23,7 @@ ** - type set is out of optimization yet */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 3d1cffecaef..8523b05a1de 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -17,7 +17,7 @@ /* Analyse database */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c20d5f79277..805db107370 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -22,7 +22,7 @@ ** *****************************************************************************/ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc index b0b8050e311..f21a109e95d 100644 --- a/sql/sql_crypt.cc +++ b/sql/sql_crypt.cc @@ -23,7 +23,7 @@ needs something like 'ssh'. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h index 1b27f0a4d27..25bc2d29e1d 100644 --- a/sql/sql_crypt.h +++ b/sql/sql_crypt.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_list.cc b/sql/sql_list.cc index c99cfb8c918..d57a7dfe4e3 100644 --- a/sql/sql_list.cc +++ b/sql/sql_list.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_map.cc b/sql/sql_map.cc index e7e24f957c6..aac44949d89 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_map.h b/sql/sql_map.h index 632eb6e4f64..bfa6011ac54 100644 --- a/sql/sql_map.h +++ b/sql/sql_map.h @@ -17,7 +17,7 @@ /* interface for memory mapped files */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 46f1e6c156e..024abb6c74b 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -28,7 +28,7 @@ #ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1 -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fb7f10abb52..7b27879ae28 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -17,7 +17,7 @@ /* mysql_select and join optimization */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_string.cc b/sql/sql_string.cc index c1701e7e9bf..ab2db4aaf53 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 126d2e5d894..f5b4775ee0b 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -28,7 +28,7 @@ ** dynamic functions, so this shouldn't be a real problem. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: implement sql_udf.h #endif diff --git a/sql/tztime.cc b/sql/tztime.cc index c45271966f9..8fac054c49c 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -20,7 +20,7 @@ (We will refer to this code as to elsie-code further.) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif From 6c00006d2c4f0875054693fe9fc7a5a1fb6f75d6 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 26 May 2005 12:12:36 +0200 Subject: [PATCH 53/78] Fix icc compiler warning --- ndb/src/kernel/blocks/dbtux/Dbtux.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index 2c96271eb5d..3d78fccb780 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -342,7 +342,6 @@ private: * Complete metadata for one index. The array of attributes has * variable size. */ - struct DescEnt; friend struct DescEnt; struct DescEnt { DescHead m_descHead; From f39f049041db3a4db7bea247955b43687b48254d Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Thu, 26 May 2005 12:55:31 +0200 Subject: [PATCH 54/78] Merge --- mysql-test/t/select.test | 217 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 206 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 3877e67de41..b6132d23d02 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -9,7 +9,8 @@ --disable_warnings drop table if exists t1,t2,t3,t4; # The following may be left from older tests -drop table if exists t1_1,t1_2,t9_1,t9_2; +drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa; +drop view if exists v1; --enable_warnings CREATE TABLE t1 ( @@ -1764,9 +1765,9 @@ DO benchmark(100,1+1),1,1; # Bug #6449: do default; # ---error 1064 +--error ER_PARSE_ERROR do default; ---error 1054 +--error ER_BAD_FIELD_ERROR do foobar; # @@ -1792,7 +1793,10 @@ CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned defa INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); +# Disable PS becasue we get more warnings from PS than from normal execution +--disable_ps_protocol SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; +--enable_ps_protocol # Testing the same select with NULL's instead of invalid datetime values SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; DROP TABLE t1,t2; @@ -1935,6 +1939,205 @@ EXPLAIN SELECT i FROM t1 WHERE i=1; DROP TABLE t1; +# +# Test case for bug 7520: a wrong cost of the index for a BLOB field +# + +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); + +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; + +DROP TABLE t1, t2; + + +# +# Test case for bug 7098: substitution of a constant for a string field +# + +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); + +SELECT * FROM t1 WHERE city='London'; +SELECT * FROM t1 WHERE city='london'; +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +SELECT * FROM t1 WHERE city='London' AND city='london'; +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; + +DROP TABLE t1; + +# +# Bug#7425 inconsistent sort order on unsigned columns result of substraction +# + +create table t1 (a int(11) unsigned, b int(11) unsigned); +insert into t1 values (1,0), (1,1), (1,2); +select a-b from t1 order by 1; +select a-b , (a-b < 0) from t1 order by 1; +select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; +select cast((a - b) as unsigned) from t1 order by 1; +drop table t1; + + +# +# Bug#8733 server accepts malformed query (multiply mentioned distinct) +# +create table t1 (a int(11)); +select all all * from t1; +select distinct distinct * from t1; +--error 1221 +select all distinct * from t1; +--error 1221 +select distinct all * from t1; +drop table t1; + +# + +# +# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX +# + +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +DROP TABLE t1; +# Test for bug #6474 +# + +CREATE TABLE t1 ( +K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', +K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', +F2I4 int(11) NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES +('W%RT', '0100', 1), +('W-RT', '0100', 1), +('WART', '0100', 1), +('WART', '0200', 1), +('WERT', '0100', 2), +('WORT','0200', 2), +('WT', '0100', 2), +('W_RT', '0100', 2), +('WaRT', '0100', 3), +('WART', '0300', 3), +('WRT' , '0400', 3), +('WURM', '0500', 3), +('W%T', '0600', 4), +('WA%T', '0700', 4), +('WA_T', '0800', 4); + +SELECT K2C4, K4N4, F2I4 FROM t1 + WHERE K2C4 = 'WART' AND + (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200')); + +SELECT K2C4, K4N4, F2I4 FROM t1 + WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200'); + +DROP TABLE t1; + +# +# Test case for bug 7520: a wrong cost of the index for a BLOB field +# + +CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); +CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); + +INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); +INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); + +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; +EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; + +DROP TABLE t1, t2; + + +# +# Test case for bug 7098: substitution of a constant for a string field +# + +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); + +SELECT * FROM t1 WHERE city='London'; +SELECT * FROM t1 WHERE city='london'; +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +SELECT * FROM t1 WHERE city='London' AND city='london'; +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; + +DROP TABLE t1; + +# +# Bug#7425 inconsistent sort order on unsigned columns result of substraction +# + +create table t1 (a int(11) unsigned, b int(11) unsigned); +insert into t1 values (1,0), (1,1), (1,2); +select a-b from t1 order by 1; +select a-b , (a-b < 0) from t1 order by 1; +select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; +select cast((a - b) as unsigned) from t1 order by 1; +drop table t1; + +# +# Bug#8670 +# +create table t1 (a int, b int); +create table t2 like t1; +select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1; +select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1; +select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1; +drop table t1,t2; + +# +# Bug#9820 +# + +create table t1 (s1 varchar(5)); +insert into t1 values ('Wall'); +select min(s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9799 +# + +create table t1 (s1 int) engine=myisam; +insert into t1 values (0); +select avg(distinct s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9800 +# + +create table t1 (s1 int); +insert into t1 values (null),(1); +select distinct avg(s1) as x from t1 group by s1 with rollup; +drop table t1; + + +# +# Bug#8733 server accepts malformed query (multiply mentioned distinct) +# +create table t1 (a int(11)); +select all all * from t1; +select distinct distinct * from t1; +--error 1221 +select all distinct * from t1; +--error 1221 +select distinct all * from t1; +drop table t1; + + # # Test case for bug 7520: a wrong cost of the index for a BLOB field # @@ -2052,11 +2255,3 @@ AND FK_firma_id = 2; drop table t1; -# -# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX -# - -CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); -INSERT INTO t1 VALUES (0x8000000000000000); -SELECT b FROM t1 WHERE b=0x8000000000000000; -DROP TABLE t1; From 4572248a84d965f041a62d72cdaf3e03cbe0b7ad Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Thu, 26 May 2005 12:58:55 +0200 Subject: [PATCH 55/78] Correction of merge mishandling in 'client/client_priv.h'. --- client/client_priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client_priv.h b/client/client_priv.h index a2f652af273..c8aa7385276 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif - ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_DROP_DATABASE,OPT_DROP_DATABASE + OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE }; From 206c0ebbc3269869114177cdf89fe49150c6c5a1 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Thu, 26 May 2005 14:00:47 +0300 Subject: [PATCH 56/78] Moved detection of wrong decimal fields before decimal field was created to avoid ASSERT() for DECIMAL(1) --- sql/table.cc | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/sql/table.cc b/sql/table.cc index 7755217532b..db753b2ed1c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -554,6 +554,26 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, unhex_type2(interval); } +#ifndef TO_BE_DELETED_ON_PRODUCTION + if (field_type == FIELD_TYPE_NEWDECIMAL && !share->mysql_version) + { + /* + Fix pack length of old decimal values from 5.0.3 -> 5.0.4 + The difference is that in the old version we stored precision + in the .frm table while we now store the display_length + */ + uint decimals= f_decimals(pack_flag); + field_length= my_decimal_precision_to_length(field_length, + decimals, + f_is_dec(pack_flag) == 0); + sql_print_error("Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", share->fieldnames.type_names[i], name, share->table_name); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_CRASHED_ON_USAGE, + "Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", share->fieldnames.type_names[i], name, share->table_name); + share->crashed= 1; // Marker for CHECK TABLE + } +#endif + *field_ptr=reg_field= make_field(record+recpos, (uint32) field_length, @@ -573,28 +593,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, error= 4; goto err; /* purecov: inspected */ } -#ifndef TO_BE_DELETED_ON_PRODUCTION - if (field_type == FIELD_TYPE_NEWDECIMAL && !share->mysql_version) - { - /* - Fix pack length of old decimal values from 5.0.3 -> 5.0.4 - The difference is that in the old version we stored precision - in the .frm table while we now store the display_length - */ - Field_new_decimal *dec_field= (Field_new_decimal*) reg_field; - dec_field->bin_size= my_decimal_get_binary_size(field_length, - dec_field->dec); - dec_field->precision= field_length; - dec_field->field_length= - my_decimal_precision_to_length(field_length, dec_field->dec, - dec_field->unsigned_flag); - sql_print_error("Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", dec_field->field_name, name, share->table_name); - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_CRASHED_ON_USAGE, - "Found incompatible DECIMAL field '%s' in %s; Please do \"ALTER TABLE '%s' FORCE\" to fix it!", dec_field->field_name, name, share->table_name); - share->crashed= 1; // Marker for CHECK TABLE - } -#endif reg_field->comment=comment; if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag)) From 2d5b96798fe3125e77bf214c2c189d66dd309cfd Mon Sep 17 00:00:00 2001 From: "marko@hundin.mysql.fi" <> Date: Thu, 26 May 2005 15:42:24 +0300 Subject: [PATCH 57/78] InnoDB: Check all referencing tables in DROP DATABASE (Bug #10335). --- innobase/row/row0mysql.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index a915200161f..86557315b71 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -2143,6 +2143,7 @@ row_drop_table_for_mysql( foreign = UT_LIST_GET_FIRST(table->referenced_list); while (foreign && foreign->foreign_table == table) { + check_next_foreign: foreign = UT_LIST_GET_NEXT(referenced_list, foreign); } @@ -2171,6 +2172,10 @@ row_drop_table_for_mysql( goto funct_exit; } + if (foreign && trx->check_foreigns) { + goto check_next_foreign; + } + if (table->n_mysql_handles_opened > 0) { ibool added; From 95edcc48af58f9778cdf2d3f7b50ca443adcce0e Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Thu, 26 May 2005 15:21:01 +0200 Subject: [PATCH 58/78] Added a missing "make clean" to the RPM "spec" file which had caused the original 4.1.12 RPMs to be broken. (bug#10674, bug#10681) --- support-files/mysql.spec.sh | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 5e7499c5e5c..dd25862004a 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -16,8 +16,8 @@ Name: MySQL Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases -Summary(pt_BR): MySQL: Um servidor SQL rápido e confiável. -Group(pt_BR): Aplicações/Banco_de_Dados +Summary(pt_BR): MySQL: Um servidor SQL rápido e confiável. +Group(pt_BR): Aplicações/Banco_de_Dados Version: @MYSQL_NO_DASH_VERSION@ Release: %{release} License: GPL @@ -57,8 +57,8 @@ documentation and the manual for more information. Release: %{release} Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases -Summary(pt_BR): MySQL: Um servidor SQL rápido e confiável. -Group(pt_BR): Aplicações/Banco_de_Dados +Summary(pt_BR): MySQL: Um servidor SQL rápido e confiável. +Group(pt_BR): Aplicações/Banco_de_Dados Requires: fileutils sh-utils Provides: msqlormysql mysql-server mysql MySQL Obsoletes: MySQL mysql mysql-server @@ -92,7 +92,7 @@ Release: %{release} Summary: MySQL - Client Group: Applications/Databases Summary(pt_BR): MySQL - Cliente -Group(pt_BR): Aplicações/Banco_de_Dados +Group(pt_BR): Aplicações/Banco_de_Dados Obsoletes: mysql-client Provides: mysql-client @@ -102,7 +102,7 @@ This package contains the standard MySQL clients and administration tools. %{see_base} %description client -l pt_BR -Este pacote contém os clientes padrão para o MySQL. +Este pacote contém os clientes padrão para o MySQL. %package ndb-storage Release: %{release} @@ -156,8 +156,8 @@ Release: %{release} Requires: %{name}-client perl-DBI perl Summary: MySQL - Benchmarks and test system Group: Applications/Databases -Summary(pt_BR): MySQL - Medições de desempenho -Group(pt_BR): Aplicações/Banco_de_Dados +Summary(pt_BR): MySQL - Medições de desempenho +Group(pt_BR): Aplicações/Banco_de_Dados Provides: mysql-bench Obsoletes: mysql-bench @@ -167,14 +167,14 @@ This package contains MySQL benchmark scripts and data. %{see_base} %description bench -l pt_BR -Este pacote contém medições de desempenho de scripts e dados do MySQL. +Este pacote contém medições de desempenho de scripts e dados do MySQL. %package devel Release: %{release} Summary: MySQL - Development header files and libraries Group: Applications/Databases -Summary(pt_BR): MySQL - Medições de desempenho -Group(pt_BR): Aplicações/Banco_de_Dados +Summary(pt_BR): MySQL - Medições de desempenho +Group(pt_BR): Aplicações/Banco_de_Dados Provides: mysql-devel Obsoletes: mysql-devel @@ -185,8 +185,8 @@ necessary to develop MySQL client applications. %{see_base} %description devel -l pt_BR -Este pacote contém os arquivos de cabeçalho (header files) e bibliotecas -necessárias para desenvolver aplicações clientes do MySQL. +Este pacote contém os arquivos de cabeçalho (header files) e bibliotecas +necessárias para desenvolver aplicações clientes do MySQL. %package shared Release: %{release} @@ -226,8 +226,8 @@ Release: %{release} Requires: %{name}-devel Summary: MySQL - embedded library Group: Applications/Databases -Summary(pt_BR): MySQL - Medições de desempenho -Group(pt_BR): Aplicações/Banco_de_Dados +Summary(pt_BR): MySQL - Medições de desempenho +Group(pt_BR): Aplicações/Banco_de_Dados Obsoletes: mysql-embedded %description embedded @@ -364,6 +364,9 @@ fi (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) +# Now clean up +make clean + # # Only link statically on our i386 build host (which has a specially # patched static glibc installed) - ia64 and x86_64 run glibc-2.3 (unpatched) @@ -686,6 +689,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Wed May 25 2005 Joerg Bruehe + +- Added a "make clean" between separate calls to "BuildMySQL". + * Wed Apr 20 2005 Lenz Grimmer - Enabled the "blackhole" storage engine for the Max RPM From db2ce1edf6e1f7e322b573f01a86bd18d55f9b59 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Thu, 26 May 2005 17:30:12 +0300 Subject: [PATCH 59/78] fixed problem with long string results of expressions in UNIONS (BUG#10025) --- mysql-test/r/union.result | 14 ++++++++++++++ mysql-test/t/union.test | 11 +++++++++++ sql/item.cc | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c140ecd26e1..57dfd48b6bd 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1235,3 +1235,17 @@ show columns from t2; Field Type Null Key Default Extra a varchar(3) YES NULL drop table t2, t1; +CREATE TABLE t1 (a mediumtext); +CREATE TABLE t2 (b varchar(20)); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +left(a,100000000) +a +b +create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `left(a,100000000)` longtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop tables t1,t2,t3; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index b0446e1ea4a..ffc7e718e9d 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -742,3 +742,14 @@ create table t2 select a from t1 union select c from t1; create table t2 select a from t1 union select b from t1; show columns from t2; drop table t2, t1; + +# +# correct conversion long string to TEXT (BUG#10025) +# +CREATE TABLE t1 (a mediumtext); +CREATE TABLE t2 (b varchar(20)); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2; +show create table t3; +drop tables t1,t2,t3; diff --git a/sql/item.cc b/sql/item.cc index 59785813566..8bc26c8c679 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3099,8 +3099,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) enum_set_typelib, collation.collation); case MYSQL_TYPE_VAR_STRING: table->db_create_options|= HA_OPTION_PACK_RECORD; - return new Field_string(max_length, maybe_null, name, table, - collation.collation); + fld_type= MYSQL_TYPE_STRING; + break; default: break; } From 8401cd5d790c02d7ae67137e3a9df88cf06484fd Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 26 May 2005 16:44:46 +0200 Subject: [PATCH 60/78] BUG#9993 2 unexpected warnings when dropping a routine and --skip-grant-tables - Dont perform automatic privilege handling for stored procedures when server is started --skip-grant-tables - Renamed view_skip_grants to skip_grants and added test cases for this --- .../r/{view_skip_grants.result => skip_grants.result} | 4 ++++ ...w_skip_grants-master.opt => skip_grants-master.opt} | 0 .../t/{view_skip_grants.test => skip_grants.test} | 10 +++++++++- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 3 ++- sql/sql_parse.cc | 4 ++-- 6 files changed, 18 insertions(+), 5 deletions(-) rename mysql-test/r/{view_skip_grants.result => skip_grants.result} (61%) rename mysql-test/t/{view_skip_grants-master.opt => skip_grants-master.opt} (100%) rename mysql-test/t/{view_skip_grants.test => skip_grants.test} (59%) diff --git a/mysql-test/r/view_skip_grants.result b/mysql-test/r/skip_grants.result similarity index 61% rename from mysql-test/r/view_skip_grants.result rename to mysql-test/r/skip_grants.result index 48cb9f2aa25..c0c20eb25be 100644 --- a/mysql-test/r/view_skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -1,6 +1,10 @@ drop table if exists t1,v1; drop view if exists t1,v1; +drop procedure if exists f1; use test; create table t1 (field1 INT); CREATE VIEW v1 AS SELECT field1 FROM t1; drop view v1; +drop table t1; +create procedure f1() select 1; +drop procedure f1; diff --git a/mysql-test/t/view_skip_grants-master.opt b/mysql-test/t/skip_grants-master.opt similarity index 100% rename from mysql-test/t/view_skip_grants-master.opt rename to mysql-test/t/skip_grants-master.opt diff --git a/mysql-test/t/view_skip_grants.test b/mysql-test/t/skip_grants.test similarity index 59% rename from mysql-test/t/view_skip_grants.test rename to mysql-test/t/skip_grants.test index bfbaec44eb1..99223fa4756 100644 --- a/mysql-test/t/view_skip_grants.test +++ b/mysql-test/t/skip_grants.test @@ -1,6 +1,7 @@ --disable_warnings drop table if exists t1,v1; drop view if exists t1,v1; +drop procedure if exists f1; --enable_warnings use test; @@ -11,4 +12,11 @@ create table t1 (field1 INT); CREATE VIEW v1 AS SELECT field1 FROM t1; drop view v1; -drop table t1 +drop table t1; + +# +# Test that we can create and drop procedure without warnings +# see bug#9993 +# +create procedure f1() select 1; +drop procedure f1; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 25490b04ab3..7e6a611de2f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1095,7 +1095,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_secure_auth; -extern my_bool sp_automatic_privileges; +extern my_bool sp_automatic_privileges, opt_noacl; extern my_bool opt_old_style_user_limits, trust_routine_creators; extern uint opt_crash_binlog_innodb; extern char *shared_memory_base_name, *mysqld_unix_port; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 84a041167f1..39b6931ffba 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -310,6 +310,7 @@ my_bool opt_old_style_user_limits= 0, trust_routine_creators= 0; changed). False otherwise. */ volatile bool mqh_used = 0; +my_bool opt_noacl; my_bool sp_automatic_privileges= 1; #ifdef HAVE_INITGROUPS @@ -445,7 +446,7 @@ char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher; /* Static variables */ static bool kill_in_progress, segfaulted; -static my_bool opt_do_pstack, opt_noacl, opt_bootstrap, opt_myisam_log; +static my_bool opt_do_pstack, opt_bootstrap, opt_myisam_log; static int cleanup_done; static ulong opt_specialflag, opt_myisam_block_size; static char *opt_logname, *opt_update_logname, *opt_binlog_index_name; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 47ac8d3afc1..4751e8b6aa7 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3982,7 +3982,7 @@ unsent_create_error: lex->sphead= 0; #ifndef NO_EMBEDDED_ACCESS_CHECKS /* only add privileges if really neccessary */ - if (sp_automatic_privileges && + if (sp_automatic_privileges && !opt_noacl && check_procedure_access(thd, DEFAULT_CREATE_PROC_ACLS, db, name, 1)) { @@ -4247,7 +4247,7 @@ unsent_create_error: if (check_procedure_access(thd, ALTER_PROC_ACL, db, name, 0)) goto error; #ifndef NO_EMBEDDED_ACCESS_CHECKS - if (sp_automatic_privileges && + if (sp_automatic_privileges && !opt_noacl && sp_revoke_privileges(thd, db, name)) { push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, From 76b25fc1943e8356db550838950f48dbe78a4ffc Mon Sep 17 00:00:00 2001 From: "joerg@mysql.com" <> Date: Thu, 26 May 2005 16:47:44 +0200 Subject: [PATCH 61/78] Corrected merge error in 'mysql-test/r/select.result': two test blocks inserted in wrong order. --- mysql-test/r/select.result | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 6e19fa09d1b..eaed7719673 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2423,6 +2423,12 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT select distinct all * from t1; ERROR HY000: Incorrect usage of ALL and DISTINCT drop table t1; +CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); +INSERT INTO t1 VALUES (0x8000000000000000); +SELECT b FROM t1 WHERE b=0x8000000000000000; +b +9223372036854775808 +DROP TABLE t1; CREATE TABLE t1 ( K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', @@ -2676,9 +2682,3 @@ AND FK_firma_id = 2; COUNT(*) 0 drop table t1; -CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b)); -INSERT INTO t1 VALUES (0x8000000000000000); -SELECT b FROM t1 WHERE b=0x8000000000000000; -b -9223372036854775808 -DROP TABLE t1; From 41c8f4616014fc7c2d656950c53ea85d97e4db77 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Thu, 26 May 2005 20:54:02 +0200 Subject: [PATCH 62/78] Post-review fixes: rename SHOW_DOUBLE to SHOW_DOUBLE_STATUS --- sql/mysqld.cc | 2 +- sql/sql_show.cc | 2 +- sql/structs.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e45a61b0c04..b6e80402114 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5713,7 +5713,7 @@ struct show_var_st status_vars[]= { {"Key_reads", (char*) &dflt_key_cache_var.global_cache_read, SHOW_KEY_CACHE_LONG}, {"Key_write_requests", (char*) &dflt_key_cache_var.global_cache_w_requests, SHOW_KEY_CACHE_LONG}, {"Key_writes", (char*) &dflt_key_cache_var.global_cache_write, SHOW_KEY_CACHE_LONG}, - {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE}, + {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, #ifdef HAVE_NDBCLUSTER_DB {"Ndb_", (char*) &ndb_status_variables, SHOW_VARS}, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a5d12dffc4b..3d23e22c590 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1356,7 +1356,7 @@ static bool show_status_array(THD *thd, const char *wild, end= strend(pos); break; } - case SHOW_DOUBLE: + case SHOW_DOUBLE_STATUS: { value= ((char *) status_var + (ulong) value); end= buff + sprintf(buff, "%f", *(double*) value); diff --git a/sql/structs.h b/sql/structs.h index 7a70bfc0f4f..306089016bc 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -164,7 +164,8 @@ typedef struct st_known_date_time_format { enum SHOW_TYPE { SHOW_UNDEF, - SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_DOUBLE, + SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, + SHOW_DOUBLE_STATUS, SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION, SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS, SHOW_VARS, From 90f971ae2c17889ba89ccb5af017bd210a904428 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 26 May 2005 21:01:54 +0200 Subject: [PATCH 63/78] Include fix to function open_binlog from 4.1 - Add O_SHARE when opening file. --- sql/log.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 91428cf41be..db592649d13 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -232,7 +232,8 @@ File open_binlog(IO_CACHE *log, const char *log_file_name, const char **errmsg) File file; DBUG_ENTER("open_binlog"); - if ((file = my_open(log_file_name, O_RDONLY | O_BINARY, MYF(MY_WME))) < 0) + if ((file = my_open(log_file_name, O_RDONLY | O_BINARY | O_SHARE, + MYF(MY_WME))) < 0) { sql_print_error("Failed to open log (file '%s', errno %d)", log_file_name, my_errno); From f8cb00640f06230f0d8f200a04ccd91d02bb8bd3 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Thu, 26 May 2005 23:33:20 +0300 Subject: [PATCH 64/78] Fix broken test case (after merge) --- mysql-test/r/union.result | 10 +++++----- mysql-test/t/union.test | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 22417136f67..daa0a428577 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1201,27 +1201,27 @@ concat('value is: ', @val) value is: 6 some text CREATE TABLE t1 ( -a ENUM('ä','ö','ü') character set utf8 not null default 'ü', +a ENUM('ä','ö','ü') character set utf8 not null default 'ü', b ENUM("one", "two") character set utf8, c ENUM("one", "two") ); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('ä','ö','ü') character set utf8 NOT NULL default 'ü', + `a` enum('ä','ö','ü') character set utf8 NOT NULL default 'ü', `b` enum('one','two') character set utf8 default NULL, `c` enum('one','two') default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); +insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); create table t2 select NULL union select a from t1; show columns from t2; Field Type Null Key Default Extra -NULL enum('ä','ö','ü') YES NULL +NULL enum('ä','ö','ü') YES NULL drop table t2; create table t2 select a from t1 union select NULL; show columns from t2; Field Type Null Key Default Extra -a enum('ä','ö','ü') YES NULL +a enum('ä','ö','ü') YES NULL drop table t2; create table t2 select a from t1 union select a from t1; show columns from t2; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 42cdf54544a..af548074aa9 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -740,12 +740,12 @@ select concat('value is: ', @val) union select 'some text'; # Enum merging test # CREATE TABLE t1 ( - a ENUM('ä','ö','ü') character set utf8 not null default 'ü', + a ENUM('ä','ö','ü') character set utf8 not null default 'ü', b ENUM("one", "two") character set utf8, c ENUM("one", "two") ); show create table t1; -insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); +insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); create table t2 select NULL union select a from t1; show columns from t2; drop table t2; From aa99b05be799e34e1756425a124e2023e8909f39 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 27 May 2005 12:01:41 +0200 Subject: [PATCH 65/78] Fix rpl_log and rpl_rotate_logs test result - Remove the expected warrnings when "show binary logs" are called on zero size binary log files. --- mysql-test/r/rpl_log.result | 4 ---- mysql-test/r/rpl_rotate_logs.result | 10 ---------- 2 files changed, 14 deletions(-) diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index e150cf53585..5e0eec6305d 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -71,15 +71,11 @@ show binary logs; Log_name File_size master-bin.000001 0 master-bin.000002 510 -Warnings: -Error 29 File 'master-bin.000001' not found (Errcode: 2) start slave; show binary logs; Log_name File_size slave-bin.000001 0 slave-bin.000002 348 -Warnings: -Error 29 File 'slave-bin.000001' not found (Errcode: 2) show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4 diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index b9724386909..a6d3697987a 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -30,9 +30,6 @@ Log_name File_size master-bin.000001 0 master-bin.000002 0 master-bin.000003 98 -Warnings: -Error 29 File 'master-bin.000001' not found (Errcode: 2) -Error 29 File 'master-bin.000002' not found (Errcode: 2) create table t3 select * from temp_table; select * from t3; a @@ -48,15 +45,11 @@ show master logs; Log_name File_size master-bin.000002 0 master-bin.000003 407 -Warnings: -Error 29 File 'master-bin.000002' not found (Errcode: 2) purge binary logs to 'master-bin.000002'; show binary logs; Log_name File_size master-bin.000002 0 master-bin.000003 407 -Warnings: -Error 29 File 'master-bin.000002' not found (Errcode: 2) purge master logs before now(); show binary logs; Log_name File_size @@ -84,9 +77,6 @@ Log_name File_size master-bin.000003 0 master-bin.000004 0 master-bin.000005 2032 -Warnings: -Error 29 File 'master-bin.000003' not found (Errcode: 2) -Error 29 File 'master-bin.000004' not found (Errcode: 2) show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000005 2032 From 34901082359dd2182343e0b155e172afb156a97f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 27 May 2005 12:03:37 +0200 Subject: [PATCH 66/78] Add USE_PRAGMA_INTERFACE and USE_PRAGMA_IMPLEMENTATION to files not existsing in 4.1 --- sql/hash_filo.h | 2 +- sql/sp_cache.cc | 2 +- sql/sp_cache.h | 2 +- sql/sp_head.cc | 2 +- sql/sp_head.h | 2 +- sql/sp_pcontext.cc | 2 +- sql/sp_pcontext.h | 2 +- sql/sp_rcontext.cc | 2 +- sql/sp_rcontext.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sql/hash_filo.h b/sql/hash_filo.h index d1672e1a60c..fc48c3b1540 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -23,7 +23,7 @@ #ifndef HASH_FILO_H #define HASH_FILO_H -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index 056ac6d7e96..83811e76f9b 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -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 */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/sp_cache.h b/sql/sp_cache.h index 754a987090e..e9efe5b2a8c 100644 --- a/sql/sp_cache.h +++ b/sql/sp_cache.h @@ -18,7 +18,7 @@ #ifndef _SP_CACHE_H_ #define _SP_CACHE_H_ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 988345694b2..cac7a64beea 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -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 */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/sp_head.h b/sql/sp_head.h index ee41b1efc83..955007d1ea4 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -18,7 +18,7 @@ #ifndef _SP_HEAD_H_ #define _SP_HEAD_H_ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 26f576233f3..f95a43eb903 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -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 */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h index 749b99dcf14..0d218bc0538 100644 --- a/sql/sp_pcontext.h +++ b/sql/sp_pcontext.h @@ -18,7 +18,7 @@ #ifndef _SP_PCONTEXT_H_ #define _SP_PCONTEXT_H_ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 49ead5d1585..2e79a1e2533 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -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 */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 417c50d0f0f..ba5fa950dc3 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -18,7 +18,7 @@ #ifndef _SP_RCONTEXT_H_ #define _SP_RCONTEXT_H_ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif From 0ef3267251c4f34d73aace0ddf3910841337ec1b Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Fri, 27 May 2005 14:15:17 +0400 Subject: [PATCH 67/78] Fix for trigger.test failure in --debug mode. We can't have Item_trigger_field as aggregated object inside of sp_instr_set_trigger_field class since in this case its destructor will be called twice. So instead let us create this Item separately and store pointer to it in instruction object. --- sql/sp_head.cc | 6 +++--- sql/sp_head.h | 7 +++---- sql/sql_yacc.yy | 13 ++++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 988345694b2..f680fc17d9a 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1499,8 +1499,8 @@ sp_instr_set_trigger_field::execute(THD *thd, uint *nextp) DBUG_ENTER("sp_instr_set_trigger_field::execute"); /* QQ: Still unsure what should we return in case of error 1 or -1 ? */ if (!value->fixed && value->fix_fields(thd, 0, &value) || - trigger_field.fix_fields(thd, 0, 0) || - (value->save_in_field(trigger_field.field, 0) < 0)) + trigger_field->fix_fields(thd, 0, 0) || + (value->save_in_field(trigger_field->field, 0) < 0)) res= -1; *nextp= m_ip + 1; DBUG_RETURN(res); @@ -1510,7 +1510,7 @@ void sp_instr_set_trigger_field::print(String *str) { str->append("set ", 4); - trigger_field.print(str); + trigger_field->print(str); str->append(":=", 2); value->print(str); } diff --git a/sql/sp_head.h b/sql/sp_head.h index ee41b1efc83..4e940c427bb 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -467,9 +467,9 @@ class sp_instr_set_trigger_field : public sp_instr public: sp_instr_set_trigger_field(uint ip, sp_pcontext *ctx, - LEX_STRING field_name, Item *val) + Item_trigger_field *trg_fld, Item *val) : sp_instr(ip, ctx), - trigger_field(Item_trigger_field::NEW_ROW, field_name.str), + trigger_field(trg_fld), value(val) {} @@ -480,9 +480,8 @@ public: virtual void print(String *str); - Item_trigger_field trigger_field; - private: + Item_trigger_field *trigger_field; Item *value; }; // class sp_instr_trigger_field : public sp_instr diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 99b0f43db2d..88109e61e5d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7565,6 +7565,7 @@ sys_option_value: { /* We are in trigger and assigning value to field of new row */ Item *it; + Item_trigger_field *trg_fld; sp_instr_set_trigger_field *i; if ($1) { @@ -7585,17 +7586,19 @@ sys_option_value: it= new Item_null(); } - if (!(i= new sp_instr_set_trigger_field( - lex->sphead->instructions(), lex->spcont, - $2.base_name, it))) + if (!(trg_fld= new Item_trigger_field(Item_trigger_field::NEW_ROW, + $2.base_name.str)) || + !(i= new sp_instr_set_trigger_field( + lex->sphead->instructions(), lex->spcont, + trg_fld, it))) YYABORT; /* Let us add this item to list of all Item_trigger_field objects in trigger. */ - lex->trg_table_fields.link_in_list((byte *)&i->trigger_field, - (byte **)&i->trigger_field.next_trg_field); + lex->trg_table_fields.link_in_list((byte *)trg_fld, + (byte **)&trg_fld->next_trg_field); lex->sphead->add_instr(i); } From d21b8d10775f1996c6323aeb83d542731ea6faa9 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 27 May 2005 12:38:29 +0200 Subject: [PATCH 68/78] don't downgrade the lock for CREATE ... SELECT (bug#6678) --- sql/ha_innodb.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 2d2a8f2c3b4..f0a25fd4f98 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5420,7 +5420,8 @@ ha_innobase::store_lock( if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) && !thd->in_lock_tables - && !thd->tablespace_op) { + && !thd->tablespace_op + && thd->lex->sql_command != SQLCOM_CREATE_TABLE) { lock_type = TL_WRITE_ALLOW_WRITE; } From f9e9406b4044d5c243a91f3a849e2609d792a06f Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Fri, 27 May 2005 14:15:08 +0200 Subject: [PATCH 69/78] forgotten s/__GNUC__/USE_PRAGMA_INTERFACE/ causes compilation faliures --- sql/hash_filo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/hash_filo.h b/sql/hash_filo.h index d1672e1a60c..fc48c3b1540 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -23,7 +23,7 @@ #ifndef HASH_FILO_H #define HASH_FILO_H -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif From 26e9e13c2618aad057a369c32bbb622fe3b6726d Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Fri, 27 May 2005 18:01:09 +0500 Subject: [PATCH 70/78] Fix for bug #9992: mysql_next_result hangs on error set net->no_send_error to 0 before execution of each element of multiquery statement to provide the sending of error to client --- sql/sql_parse.cc | 1 + tests/mysql_client_test.c | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5a06364cd22..7a3d3073520 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1655,6 +1655,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error) { char *packet= thd->lex->found_semicolon; + net->no_send_error= 0; /* Multiple queries exits, execute them individually in embedded server - just store them to be executed later diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 95db383bbb6..9a8ee44c54c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -233,7 +233,7 @@ mysql_simple_prepare(MYSQL *mysql, const char *query) /* Connect to the server */ -static void client_connect() +static void client_connect(ulong flag) { int rc; myheader_r("client_connect"); @@ -251,7 +251,7 @@ static void client_connect() if (!(mysql_real_connect(mysql, opt_host, opt_user, opt_password, opt_db ? opt_db:"test", opt_port, - opt_unix_socket, 0))) + opt_unix_socket, flag))) { opt_silent= 0; myerror("connection failed"); @@ -13478,6 +13478,22 @@ static void print_test_output() } +static void check_mupltiquery_bug9992() +{ + + MYSQL_RES* res ; + mysql_query(mysql,"SHOW TABLES;SHOW DATABASE;SELECT 1;"); + + fprintf(stdout, "\n\n!!! check_mupltiquery_bug9992 !!!\n"); + do + { + if (!(res= mysql_store_result(mysql))) + return; + mysql_free_result(res); + } while (!mysql_next_result(mysql)); + fprintf(stdout, "\n\n!!! SUCCESS !!!\n"); + return; +} /*************************************************************************** main routine ***************************************************************************/ @@ -13499,7 +13515,7 @@ int main(int argc, char **argv) (char**) embedded_server_groups)) DIE("Can't initialize MySQL server"); - client_connect(); /* connect to server */ + client_connect(0); /* connect to server */ total_time= 0; for (iter_count= 1; iter_count <= opt_count; iter_count++) @@ -13543,6 +13559,10 @@ int main(int argc, char **argv) } client_disconnect(); /* disconnect from server */ + + client_connect(CLIENT_MULTI_STATEMENTS); + check_mupltiquery_bug9992(); + client_disconnect(); free_defaults(defaults_argv); print_test_output(); From 4ea3ec87f3233051793eba5788f2c579a213a279 Mon Sep 17 00:00:00 2001 From: "heikki@hundin.mysql.fi" <> Date: Fri, 27 May 2005 17:04:50 +0300 Subject: [PATCH 71/78] ha_innodb.cc: Check in Jan's fix to bug #10746 and also add a note to ::start_stmt() that stored procs in 5.0 call it --- sql/ha_innodb.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 7614744ddf6..9f07532c227 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5764,7 +5764,12 @@ MySQL calls this function at the start of each SQL statement inside LOCK TABLES. Inside LOCK TABLES the ::external_lock method does not work to mark SQL statement borders. Note also a special case: if a temporary table is created inside LOCK TABLES, MySQL has not called external_lock() at all -on that table. */ +on that table. +MySQL-5.0 also calls this before each statement in an execution of a stored +procedure. To make the execution more deterministic for binlogging, MySQL-5.0 +locks all tables involved in a stored procedure with full explicit table +locks (thd->in_lock_tables is true in ::store_lock()) before executing the +procedure. */ int ha_innobase::start_stmt( @@ -6443,10 +6448,8 @@ ha_innobase::store_lock( if (srv_locks_unsafe_for_binlog && prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && - thd->lex->sql_command != SQLCOM_SELECT && - thd->lex->sql_command != SQLCOM_UPDATE_MULTI && - thd->lex->sql_command != SQLCOM_DELETE_MULTI && - thd->lex->sql_command != SQLCOM_LOCK_TABLES) { + (thd->lex->sql_command == SQLCOM_INSERT_SELECT || + thd->lex->sql_command == SQLCOM_UPDATE)) { /* In case we have innobase_locks_unsafe_for_binlog option set and isolation level of the transaction From 8e09a3b8d1c35ad8dde5549a7558c1f4dc2c6382 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Fri, 27 May 2005 19:20:29 +0200 Subject: [PATCH 72/78] - fixed the "test-force" target in the toplevel Makefile.am for systems on which "." is not in the PATH... --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index eec27484710..b5ebe8eb8ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -104,8 +104,8 @@ test: test-force: cd mysql-test; \ - mysql-test-run --force ;\ - mysql-test-run --ps-protocol --force + ./mysql-test-run --force ;\ + ./mysql-test-run --ps-protocol --force # Don't update the files from bitkeeper %::SCCS/s.% From d3d727e32874b2c3392baab8188ebe17da7cc8b9 Mon Sep 17 00:00:00 2001 From: "patg@radha.local" <> Date: Fri, 27 May 2005 22:07:46 +0200 Subject: [PATCH 73/78] Comment and test changes per review request by Timour. All tests pass on production with this code. --- mysql-test/r/federated.result | 43 +++++++++++++++++++++++++++++++++++ mysql-test/t/federated.test | 33 ++++++++++++++++++++++++++- sql/ha_federated.cc | 6 ++++- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index ebf9b144eeb..d9c86a89c75 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -906,6 +906,13 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5 +1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1, federated.countries WHERE @@ -916,6 +923,13 @@ Lenz 2 22222 Germany Marizio 3 33333 Italy Monty 4 33333 Finland Sanja 5 33333 Ukraine +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5 +1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1 INNER JOIN federated.countries ON @@ -926,6 +940,14 @@ Lenz 2 22222 Germany Marizio 3 33333 Italy Monty 4 33333 Finland Sanja 5 33333 Ukraine +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5 +1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 Using where SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1 INNER JOIN federated.countries ON @@ -933,6 +955,13 @@ federated.t1.country_id = federated.countries.id WHERE federated.t1.name = 'Monty'; name country_id other country Monty 4 33333 Finland +EXPLAIN SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort +1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1 SELECT federated.t1.*, federated.countries.country FROM federated.t1 LEFT JOIN federated.countries ON federated.t1.country_id = federated.countries.id @@ -943,6 +972,13 @@ id country_id name other country 3 3 Marizio 33333 Italy 4 4 Monty 33333 Finland 5 5 Sanja 33333 Ukraine +EXPLAIN SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort +1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1 SELECT federated.t1.*, federated.countries.country FROM federated.t1 LEFT JOIN federated.countries ON federated.t1.country_id = federated.countries.id @@ -953,6 +989,13 @@ id country_id name other country 1 1 Kumar 11111 India 3 3 Marizio 33333 Italy 5 5 Sanja 33333 Ukraine +EXPLAIN SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE countries ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 SELECT federated.t1.*, federated.countries.country FROM federated.t1 RIGHT JOIN federated.countries ON federated.t1.country_id = federated.countries.id diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index da8df543ed0..1e33efe1c0e 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -862,16 +862,32 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); #inner join +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; + SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1, federated.countries WHERE federated.t1.country_id = federated.countries.id; +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; + SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1 INNER JOIN federated.countries ON federated.t1.country_id = federated.countries.id; +EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; + SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, federated.t1.other AS other, federated.countries.country AS country FROM federated.t1 INNER JOIN federated.countries ON @@ -879,17 +895,32 @@ federated.t1.country_id = federated.countries.id WHERE federated.t1.name = 'Monty'; #left join -SELECT federated.t1.*, federated.countries.country +EXPLAIN SELECT federated.t1.*, federated.countries.country FROM federated.t1 LEFT JOIN federated.countries ON federated.t1.country_id = federated.countries.id ORDER BY federated.countries.id; +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; + +EXPLAIN SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; + SELECT federated.t1.*, federated.countries.country FROM federated.t1 LEFT JOIN federated.countries ON federated.t1.country_id = federated.countries.id ORDER BY federated.countries.country; #right join +EXPLAIN SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; + SELECT federated.t1.*, federated.countries.country FROM federated.t1 RIGHT JOIN federated.countries ON federated.t1.country_id = federated.countries.id diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index eab3e55c4a4..c76034c7986 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1526,7 +1526,11 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key, table->status= STATUS_NOT_FOUND; DBUG_RETURN(mysql_errno(mysql)); } - /* very important - joins will not work without this! */ + /* + This basically says that the record in table->record[0] is legal, and that it is + ok to use this record, for whatever reason, such as with a join (without it, joins + will not work) + */ table->status=0; DBUG_RETURN(rnd_next(buf)); From 077086cd964a68eb826321e5e29ff2c7a1d0aa56 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Mon, 30 May 2005 03:32:50 +0400 Subject: [PATCH 74/78] Fix bug #9593 "The combination of COUNT, DISTINCT and CONCAT seems to lock the server" Bug appears only on Windows platform. Freeing memory in TMP_TABLE_PARAM::cleanup() allocated by new Copy_fields[0] in setup_copy_fields() results in memory destruction. In test IF used instead of CONCAT because IF have more stable crash. --- mysql-test/r/count_distinct.result | 6 ++++++ mysql-test/t/count_distinct.test | 12 ++++++++++++ sql/sql_select.cc | 17 +++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/count_distinct.result b/mysql-test/r/count_distinct.result index 1bc1ad6a31e..a21748359b9 100644 --- a/mysql-test/r/count_distinct.result +++ b/mysql-test/r/count_distinct.result @@ -60,3 +60,9 @@ count(distinct a) 1 1 drop table t1; +create table t1 (f1 int, f2 int); +insert into t1 values (0,1),(1,2); +select count(distinct if(f1,3,f2)) from t1; +count(distinct if(f1,3,f2)) +2 +drop table t1; diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test index 73c6951e78f..be67026e268 100644 --- a/mysql-test/t/count_distinct.test +++ b/mysql-test/t/count_distinct.test @@ -63,3 +63,15 @@ create table t1 (a char(3), b char(20), primary key (a, b)); insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English'); select count(distinct a) from t1 group by b; drop table t1; + +# +# Bug #9593 "The combination of COUNT, DISTINCT and CONCAT +# seems to lock the server" +# Bug appears only on Windows system +# + +create table t1 (f1 int, f2 int); +insert into t1 values (0,1),(1,2); +select count(distinct if(f1,3,f2)) from t1; +drop table t1; + diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c68379baa75..ffad69654ea 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12313,7 +12313,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, { Item *pos; List_iterator_fast li(all_fields); - Copy_field *copy; + Copy_field *copy= NULL; res_selected_fields.empty(); res_all_fields.empty(); List_iterator_fast itr(res_all_fields); @@ -12321,7 +12321,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, uint i, border= all_fields.elements - elements; DBUG_ENTER("setup_copy_fields"); - if (!(copy=param->copy_field= new Copy_field[param->field_count])) + if (param->field_count && + !(copy=param->copy_field= new Copy_field[param->field_count])) goto err2; param->copy_funcs.empty(); @@ -12360,9 +12361,12 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, char *tmp=(char*) sql_alloc(field->pack_length()+1); if (!tmp) goto err; - copy->set(tmp, item->result_field); - item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1); - copy++; + if (copy) + { + copy->set(tmp, item->result_field); + item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1); + copy++; + } } } else if ((pos->type() == Item::FUNC_ITEM || @@ -12405,7 +12409,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, DBUG_RETURN(0); err: - delete [] param->copy_field; // This is never 0 + if (copy) + delete [] param->copy_field; // This is never 0 param->copy_field=0; err2: DBUG_RETURN(TRUE); From abfc5b3903a99410acbd90b5d88cae06d618db5c Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Mon, 30 May 2005 18:55:56 +0400 Subject: [PATCH 75/78] Added test for bug #5894 "Triggers with altered tables cause corrupt databases" and basic handling of errors which happen in triggers. (The bug itself was fixed by several previous patches). Fixed bug in multi-delete which were exposed by these tests. --- mysql-test/r/trigger.result | 167 ++++++++++++++++++++++++++++++++++++ mysql-test/t/trigger.test | 127 +++++++++++++++++++++++++++ sql/sql_delete.cc | 4 +- 3 files changed, 296 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 1d2fb5989a5..996a692d531 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -315,3 +315,170 @@ i j k @b 3 4 3 Fired 5 6 5 Fired drop table t1; +create table t1 (i int, at int, k int, key(k)) engine=myisam; +create table t2 (i int); +insert into t1 values (1, 1, 1); +insert into t2 values (1), (2), (3); +create trigger ai after insert on t1 for each row set @a:= new.at; +create trigger au after update on t1 for each row set @a:= new.at; +create trigger ad after delete on t1 for each row set @a:= old.at; +alter table t1 drop column at; +select * from t1; +i k +1 1 +insert into t1 values (2, 1); +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 1 +2 1 +update t1 set k = 2 where i = 2; +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 1 +2 2 +delete from t1 where i = 2; +ERROR 42S22: Unknown column 'at' in 'OLD' +select * from t1; +i k +1 1 +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 1 +1 2 +insert into t1 select 3, 3; +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 1 +1 2 +3 3 +update t1, t2 set k = k + 10 where t1.i = t2.i; +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 11 +1 2 +3 3 +update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3; +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +1 11 +1 12 +3 3 +delete t1, t2 from t1 straight_join t2 where t1.i = t2.i; +ERROR 42S22: Unknown column 'at' in 'OLD' +select * from t1; +i k +1 12 +3 3 +delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; +ERROR 42S22: Unknown column 'at' in 'OLD' +select * from t1; +i k +3 3 +alter table t1 add primary key (i); +insert into t1 values (3, 4) on duplicate key update k= k + 10; +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +3 13 +replace into t1 values (3, 3); +ERROR 42S22: Unknown column 'at' in 'NEW' +select * from t1; +i k +3 3 +alter table t1 add ts timestamp default now(); +replace into t1 (i, k) values (3, 13); +ERROR 42S22: Unknown column 'at' in 'OLD' +select * from t1; +i k ts +drop table t1, t2; +create table t1 (i int, bt int, k int, key(k)) engine=myisam; +create table t2 (i int); +insert into t1 values (1, 1, 1), (2, 2, 2); +insert into t2 values (1), (2), (3); +create trigger bi before insert on t1 for each row set @a:= new.bt; +create trigger bu before update on t1 for each row set @a:= new.bt; +create trigger bd before delete on t1 for each row set @a:= old.bt; +alter table t1 drop column bt; +insert into t1 values (3, 3); +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +update t1 set i = 2; +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +delete from t1; +ERROR 42S22: Unknown column 'bt' in 'OLD' +select * from t1; +i k +1 1 +2 2 +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +insert into t1 select 3, 3; +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +update t1, t2 set k = k + 10 where t1.i = t2.i; +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2; +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +delete t1, t2 from t1 straight_join t2 where t1.i = t2.i; +ERROR 42S22: Unknown column 'bt' in 'OLD' +select * from t1; +i k +1 1 +2 2 +delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; +ERROR 42S22: Unknown column 'bt' in 'OLD' +select * from t1; +i k +1 1 +2 2 +alter table t1 add primary key (i); +drop trigger t1.bi; +insert into t1 values (2, 4) on duplicate key update k= k + 10; +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +replace into t1 values (2, 4); +ERROR 42S22: Unknown column 'bt' in 'NEW' +select * from t1; +i k +1 1 +2 2 +alter table t1 add ts timestamp default now(); +replace into t1 (i, k) values (2, 11); +ERROR 42S22: Unknown column 'bt' in 'OLD' +select * from t1; +i k ts +1 1 0000-00-00 00:00:00 +2 2 0000-00-00 00:00:00 +drop table t1, t2; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 79f65bba678..0c5ef077159 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -367,3 +367,130 @@ load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated select *, @b from t1; # This also will drop triggers drop table t1; + +# Test for bug #5894 "Triggers with altered tables cause corrupt databases" +# Also tests basic error handling for various kinds of triggers. +create table t1 (i int, at int, k int, key(k)) engine=myisam; +create table t2 (i int); +insert into t1 values (1, 1, 1); +# We need at least 3 elements in t2 to test multi-update properly +insert into t2 values (1), (2), (3); +# Create and then break "after" triggers +create trigger ai after insert on t1 for each row set @a:= new.at; +create trigger au after update on t1 for each row set @a:= new.at; +create trigger ad after delete on t1 for each row set @a:= old.at; +alter table t1 drop column at; +# We still should be able select data from tables. +select * from t1; +# The following statements changing t1 should fail, but still cause +# their main effect. This is because operation on the table row is +# executed before "after" trigger and its effect cannot be rolled back +# when whole statement fails, because t1 is MyISAM table. +--error 1054 +insert into t1 values (2, 1); +select * from t1; +--error 1054 +update t1 set k = 2 where i = 2; +select * from t1; +--error 1054 +delete from t1 where i = 2; +select * from t1; +# Should fail and insert only 1 row +--error 1054 +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +select * from t1; +--error 1054 +insert into t1 select 3, 3; +select * from t1; +# Multi-update working on the fly, again it will update only +# one row even if more matches +--error 1054 +update t1, t2 set k = k + 10 where t1.i = t2.i; +select * from t1; +# The same for multi-update via temp table +--error 1054 +update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3; +select * from t1; +# Multi-delete on the fly +--error 1054 +delete t1, t2 from t1 straight_join t2 where t1.i = t2.i; +select * from t1; +# And via temporary storage +--error 1054 +delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; +select * from t1; +# Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE +alter table t1 add primary key (i); +--error 1054 +insert into t1 values (3, 4) on duplicate key update k= k + 10; +select * from t1; +--error 1054 +replace into t1 values (3, 3); +select * from t1; +# Change table in such way that REPLACE will delete row +alter table t1 add ts timestamp default now(); +--error 1054 +replace into t1 (i, k) values (3, 13); +select * from t1; +# Also drops all triggers +drop table t1, t2; + +create table t1 (i int, bt int, k int, key(k)) engine=myisam; +create table t2 (i int); +insert into t1 values (1, 1, 1), (2, 2, 2); +insert into t2 values (1), (2), (3); +# Create and then break "before" triggers +create trigger bi before insert on t1 for each row set @a:= new.bt; +create trigger bu before update on t1 for each row set @a:= new.bt; +create trigger bd before delete on t1 for each row set @a:= old.bt; +alter table t1 drop column bt; +# The following statements changing t1 should fail and should not +# cause any effect on table, since "before" trigger is executed +# before operation on the table row. +--error 1054 +insert into t1 values (3, 3); +select * from t1; +--error 1054 +update t1 set i = 2; +select * from t1; +--error 1054 +delete from t1; +select * from t1; +--error 1054 +load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k); +select * from t1; +--error 1054 +insert into t1 select 3, 3; +select * from t1; +# Both types of multi-update (on the fly and via temp table) +--error 1054 +update t1, t2 set k = k + 10 where t1.i = t2.i; +select * from t1; +--error 1054 +update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2; +select * from t1; +# Both types of multi-delete +--error 1054 +delete t1, t2 from t1 straight_join t2 where t1.i = t2.i; +select * from t1; +--error 1054 +delete t2, t1 from t2 straight_join t1 where t1.i = t2.i; +select * from t1; +# Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE. +# To test properly code-paths different from those that are used +# in ordinary INSERT we need to drop "before insert" trigger. +alter table t1 add primary key (i); +drop trigger t1.bi; +--error 1054 +insert into t1 values (2, 4) on duplicate key update k= k + 10; +select * from t1; +--error 1054 +replace into t1 values (2, 4); +select * from t1; +# Change table in such way that REPLACE will delete row +alter table t1 add ts timestamp default now(); +--error 1054 +replace into t1 (i, k) values (2, 11); +select * from t1; +# Also drops all triggers +drop table t1, t2; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 97830f7ec8f..672972ccb72 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -696,11 +696,11 @@ bool multi_delete::send_eof() Note that if we deleted nothing we don't write to the binlog (TODO: fix this). */ - if (deleted && (error <= 0 || normal_tables)) + if (deleted && ((error <= 0 && !local_error) || normal_tables)) { if (mysql_bin_log.is_open()) { - if (error <= 0) + if (error <= 0 && !local_error) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, transactional_tables, FALSE); From 2d6a70c42a4c63abb3653dd1b8f3287d4adc68f8 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Mon, 30 May 2005 20:54:37 +0400 Subject: [PATCH 76/78] Preparatory (and the most problematic) patch for Bug#7306 "the server side preparedStatement error for LIMIT placeholder", which moves all uses of LIMIT clause from PREPARE to OPTIMIZE and later steps. After-review fixes. --- mysql-test/r/group_min_max.result | 12 +++++------ sql/item_subselect.cc | 21 ++++++++---------- sql/mysql_priv.h | 3 +-- sql/opt_range.cc | 11 +++++++++- sql/sp.cc | 2 +- sql/sql_base.cc | 19 +++++++--------- sql/sql_delete.cc | 5 ++--- sql/sql_help.cc | 2 +- sql/sql_insert.cc | 2 +- sql/sql_lex.cc | 8 ++----- sql/sql_lex.h | 4 ++-- sql/sql_load.cc | 2 +- sql/sql_olap.cc | 3 +-- sql/sql_parse.cc | 4 ++-- sql/sql_select.cc | 32 ++++++++++----------------- sql/sql_union.cc | 36 +++++++------------------------ sql/sql_update.cc | 7 +++--- 17 files changed, 69 insertions(+), 104 deletions(-) diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index dea6bca2cdd..a43f1ee88a6 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -133,13 +133,13 @@ Table Op Msg_type Msg_text test.t3 analyze status Table is already up to date explain select a1, min(a2) from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, max(a2) from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by explain select a1, min(a2), max(a2) from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by @@ -151,13 +151,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select min(a2) from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by +1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a2, min(c), max(c) from t1 group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by @@ -1404,7 +1404,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; a1 a2 b min(c) max(c) a a b e112 h112 @@ -1838,7 +1838,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 9 Using index for group-by +1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using index for group-by select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b; a1 a2 b concat(min(c), max(c)) a a a a111d111 diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 0fbcf32a83c..8e5ae7c6a42 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -537,8 +537,6 @@ Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex): null_value= 0; //can't be NULL maybe_null= 0; //can't be NULL value= 0; - // We need only 1 row to determinate existence - select_lex->master_unit()->global_parameters->select_limit= 1; DBUG_VOID_RETURN; } @@ -605,6 +603,8 @@ void Item_exists_subselect::fix_length_and_dec() decimals= 0; max_length= 1; max_columns= engine->cols(); + /* We need only 1 row to determinate existence */ + unit->global_parameters->select_limit= 1; } double Item_exists_subselect::val_real() @@ -854,9 +854,6 @@ Item_in_subselect::single_value_transformer(JOIN *join, else { Item_maxmin_subselect *item; - // remove LIMIT placed by ALL/ANY subquery - select_lex->master_unit()->global_parameters->select_limit= - HA_POS_ERROR; subs= item= new Item_maxmin_subselect(thd, this, select_lex, func->l_op()); if (upper_item) upper_item->set_sub_test(item); @@ -1286,13 +1283,10 @@ subselect_single_select_engine(st_select_lex *select, select_subselect *result, Item_subselect *item) :subselect_engine(item, result), - prepared(0), optimized(0), executed(0), join(0) + prepared(0), optimized(0), executed(0), + select_lex(select), join(0) { - select_lex= select; - SELECT_LEX_UNIT *unit= select_lex->master_unit(); - unit->set_limit(unit->global_parameters, select_lex); - unit->item= item; - this->select_lex= select_lex; + select_lex->master_unit()->item= item; } @@ -1440,7 +1434,10 @@ int subselect_single_select_engine::exec() thd->lex->current_select= select_lex; if (!optimized) { - optimized=1; + SELECT_LEX_UNIT *unit= select_lex->master_unit(); + + optimized= 1; + unit->set_limit(unit->global_parameters); if (join->optimize()) { thd->where= save_where; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5d11a047a8f..b1618adbfc5 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -884,8 +884,7 @@ bool insert_fields(THD *thd,TABLE_LIST *tables, List_iterator *it, bool any_privileges, bool allocate_view_names); bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds, - TABLE_LIST **leaves, bool refresh_only, - bool select_insert); + TABLE_LIST **leaves, bool select_insert); int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, List *sum_func_list, uint wild_num); bool setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ca3f5c5af87..51da5783a04 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7982,8 +7982,17 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat() } } } - else if (have_min && min_max_arg_part && min_max_arg_part->field->is_null()) + else if (have_min && min_max_arg_part && + min_max_arg_part->field->real_maybe_null()) { + /* + If a MIN/MAX argument value is NULL, we can quickly determine + that we're in the beginning of the next group, because NULLs + are always < any other value. This allows us to quickly + determine the end of the current group and jump to the next + group (see next_min()) and thus effectively increases the + usable key length. + */ max_used_key_length+= min_max_arg_len; ++used_key_parts; } diff --git a/sql/sp.cc b/sql/sp.cc index 9a816f277ed..a5b1f062456 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -667,7 +667,7 @@ db_show_routine_status(THD *thd, int type, const char *wild) tables is not VIEW for sure => we can pass 0 as condition */ - setup_tables(thd, &tables, 0, &leaves, FALSE, FALSE); + setup_tables(thd, &tables, 0, &leaves, FALSE); for (used_field= &used_fields[0]; used_field->field_name; used_field++) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2e9cf1ae40d..eb212e49aae 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3208,7 +3208,7 @@ TABLE_LIST **make_leaves_list(TABLE_LIST **list, TABLE_LIST *tables) */ bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds, - TABLE_LIST **leaves, bool refresh, bool select_insert) + TABLE_LIST **leaves, bool select_insert) { uint tablenr= 0; DBUG_ENTER("setup_tables"); @@ -3261,17 +3261,14 @@ bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds, my_error(ER_TOO_MANY_TABLES,MYF(0),MAX_TABLES); DBUG_RETURN(1); } - if (!refresh) + for (TABLE_LIST *table_list= tables; + table_list; + table_list= table_list->next_local) { - for (TABLE_LIST *table_list= tables; - table_list; - table_list= table_list->next_local) - { - if (table_list->ancestor && - table_list->setup_ancestor(thd, conds, - table_list->effective_with_check)) - DBUG_RETURN(1); - } + if (table_list->ancestor && + table_list->setup_ancestor(thd, conds, + table_list->effective_with_check)) + DBUG_RETURN(1); } DBUG_RETURN(0); } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 97830f7ec8f..4ec4258f412 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -300,8 +300,7 @@ bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) SELECT_LEX *select_lex= &thd->lex->select_lex; DBUG_ENTER("mysql_prepare_delete"); - if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, - FALSE, FALSE) || + if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, FALSE) || setup_conds(thd, table_list, select_lex->leaf_tables, conds) || setup_ftfuncs(select_lex)) DBUG_RETURN(TRUE); @@ -358,7 +357,7 @@ bool mysql_multi_delete_prepare(THD *thd) lex->query_tables also point on local list of DELETE SELECT_LEX */ if (setup_tables(thd, lex->query_tables, &lex->select_lex.where, - &lex->select_lex.leaf_tables, FALSE, FALSE)) + &lex->select_lex.leaf_tables, FALSE)) DBUG_RETURN(TRUE); diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 3c8e8e55c1f..0cf8d1e93a7 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -651,7 +651,7 @@ bool mysqld_help(THD *thd, const char *mask) tables do not contain VIEWs => we can pass 0 as conds */ - setup_tables(thd, tables, 0, &leaves, FALSE, FALSE); + setup_tables(thd, tables, 0, &leaves, FALSE); memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields)); if (init_fields(thd, tables, used_fields, array_elements(used_fields))) goto error; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6db7e6a6b18..4727f071c39 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -699,7 +699,7 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, DBUG_ENTER("mysql_prepare_insert_check_table"); if (setup_tables(thd, table_list, where, &thd->lex->select_lex.leaf_tables, - FALSE, select_insert)) + select_insert)) DBUG_RETURN(TRUE); if (insert_into_view && !fields.elements) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7c7939eaf60..ec98bb38762 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1369,8 +1369,6 @@ bool st_select_lex::test_limit() "LIMIT & IN/ALL/ANY/SOME subquery"); return(1); } - // We need only 1 row to determinate existence - select_limit= 1; // no sense in ORDER BY without LIMIT order_list.empty(); return(0); @@ -1553,7 +1551,7 @@ void st_select_lex::print_limit(THD *thd, String *str) item->substype() == Item_subselect::IN_SUBS || item->substype() == Item_subselect::ALL_SUBS)) { - DBUG_ASSERT(select_limit == 1L && offset_limit == 0L); + DBUG_ASSERT(!item->fixed || select_limit == 1L && offset_limit == 0L); return; } @@ -1756,11 +1754,9 @@ bool st_lex::need_correct_ident() SYNOPSIS st_select_lex_unit::set_limit() values - SELECT_LEX with initial values for counters - sl - SELECT_LEX for options set */ -void st_select_lex_unit::set_limit(SELECT_LEX *values, - SELECT_LEX *sl) +void st_select_lex_unit::set_limit(SELECT_LEX *values) { offset_limit_cnt= values->offset_limit; select_limit_cnt= values->select_limit+values->offset_limit; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 3e463cb35ce..06da735c0f2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -445,10 +445,10 @@ public: void print(String *str); - ulong init_prepare_fake_select_lex(THD *thd); + void init_prepare_fake_select_lex(THD *thd); inline bool is_prepared() { return prepared; } bool change_result(select_subselect *result, select_subselect *old_result); - void set_limit(st_select_lex *values, st_select_lex *sl); + void set_limit(st_select_lex *values); friend void lex_start(THD *thd, uchar *buf, uint length); friend int subselect_union_engine::exec(); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 1545055f475..cc25839bcc9 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -150,7 +150,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (open_and_lock_tables(thd, table_list)) DBUG_RETURN(TRUE); if (setup_tables(thd, table_list, &unused_conds, - &thd->lex->select_lex.leaf_tables, FALSE, FALSE)) + &thd->lex->select_lex.leaf_tables, FALSE)) DBUG_RETURN(-1); if (!table_list->table || // do not suport join view !table_list->updatable || // and derived tables diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 07271d40492..06d66f8dfd2 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -153,8 +153,7 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex) if (setup_tables(lex->thd, (TABLE_LIST *)select_lex->table_list.first - &select_lex->where, &select_lex->leaf_tables, - FALSE, FALSE) || + &select_lex->where, &select_lex->leaf_tables, FALSE) || setup_fields(lex->thd, 0, (TABLE_LIST *)select_lex->table_list.first, select_lex->item_list, 1, &all_fields,1) || setup_fields(lex->thd, 0, (TABLE_LIST *)select_lex->table_list.first, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7078c8e7181..84bf8f76d18 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2777,7 +2777,7 @@ mysql_execute_command(THD *thd) select_result *result; select_lex->options|= SELECT_NO_UNLOCK; - unit->set_limit(select_lex, select_lex); + unit->set_limit(select_lex); if (!(res= open_and_lock_tables(thd, select_tables))) { @@ -3175,7 +3175,7 @@ unsent_create_error: select_lex->options|= SELECT_NO_UNLOCK; select_result *result; - unit->set_limit(select_lex, select_lex); + unit->set_limit(select_lex); if (!(res= open_and_lock_tables(thd, all_tables))) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 26e8b398844..1a06f80920e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -233,7 +233,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, else { SELECT_LEX_UNIT *unit= &lex->unit; - unit->set_limit(unit->global_parameters, select_lex); + unit->set_limit(unit->global_parameters); /* 'options' of mysql_select will be set in JOIN, as far as JOIN for every PS/SP execution new, we will not need reset this flag if @@ -342,7 +342,7 @@ JOIN::prepare(Item ***rref_pointer_array, if ((!(select_options & OPTION_SETUP_TABLES_DONE) && setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables, - FALSE, FALSE)) || + FALSE)) || setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) || select_lex->setup_ref_array(thd, og_num) || setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1, @@ -465,13 +465,6 @@ JOIN::prepare(Item ***rref_pointer_array, count_field_types(&tmp_table_param, all_fields, 0); ref_pointer_array_size= all_fields.elements*sizeof(Item*); this->group= group_list != 0; - row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR : - unit_arg->select_limit_cnt); - /* select_limit is used to decide if we are likely to scan the whole table */ - select_limit= unit_arg->select_limit_cnt; - if (having || (select_options & OPTION_FOUND_ROWS)) - select_limit= HA_POS_ERROR; - do_send_rows = (unit_arg->select_limit_cnt) ? 1 : 0; unit= unit_arg; #ifdef RESTRICTED_GROUP @@ -550,6 +543,13 @@ JOIN::optimize() DBUG_RETURN(0); optimized= 1; + row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR : + unit->select_limit_cnt); + /* select_limit is used to decide if we are likely to scan the whole table */ + select_limit= unit->select_limit_cnt; + if (having || (select_options & OPTION_FOUND_ROWS)) + select_limit= HA_POS_ERROR; + do_send_rows = (unit->select_limit_cnt) ? 1 : 0; // Ignore errors of execution if option IGNORE present if (thd->lex->ignore) thd->lex->current_select->no_error= 1; @@ -1110,18 +1110,7 @@ int JOIN::reinit() { DBUG_ENTER("JOIN::reinit"); - /* TODO move to unit reinit */ - unit->set_limit(select_lex, select_lex); - /* conds should not be used here, it is added just for safety */ - if (tables_list) - { - if (setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables, - TRUE, FALSE)) - DBUG_RETURN(1); - } - - /* Reset of sum functions */ first_record= 0; if (exec_tmp_table1) @@ -1147,6 +1136,7 @@ JOIN::reinit() if (tmp_join) restore_tmp(); + /* Reset of sum functions */ if (sum_funcs) { Item_sum *func, **func_ptr= sum_funcs; @@ -13485,7 +13475,7 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) else { thd->lex->current_select= first; - unit->set_limit(unit->global_parameters, first); + unit->set_limit(unit->global_parameters); res= mysql_select(thd, &first->ref_pointer_array, (TABLE_LIST*) first->table_list.first, first->with_wild, first->item_list, diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 00770ba02a2..21549f76350 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -115,27 +115,15 @@ bool select_union::flush() options of SELECT */ -ulong +void st_select_lex_unit::init_prepare_fake_select_lex(THD *thd) { - ulong options_tmp= thd->options | fake_select_lex->options; thd->lex->current_select= fake_select_lex; - offset_limit_cnt= global_parameters->offset_limit; - select_limit_cnt= global_parameters->select_limit + - global_parameters->offset_limit; - - if (select_limit_cnt < global_parameters->select_limit) - select_limit_cnt= HA_POS_ERROR; // no limit - if (select_limit_cnt == HA_POS_ERROR) - options_tmp&= ~OPTION_FOUND_ROWS; - else if (found_rows_for_union && !thd->lex->describe) - options_tmp|= OPTION_FOUND_ROWS; fake_select_lex->ftfunc_list_alloc.empty(); fake_select_lex->ftfunc_list= &fake_select_lex->ftfunc_list_alloc; fake_select_lex->table_list.link_in_list((byte *)&result_table_list, (byte **) &result_table_list.next_local); - return options_tmp; } @@ -217,10 +205,9 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, goto err; thd_arg->lex->current_select= sl; - set_limit(sl, sl); can_skip_order_by= is_union && - (!sl->braces || select_limit_cnt == HA_POS_ERROR); + (!sl->braces || sl->select_limit == HA_POS_ERROR); res= join->prepare(&sl->ref_pointer_array, (TABLE_LIST*) sl->table_list.first, sl->with_wild, @@ -340,7 +327,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, if (arena->is_stmt_prepare()) { /* prepare fake select to initialize it correctly */ - (void) init_prepare_fake_select_lex(thd); + init_prepare_fake_select_lex(thd); /* Should be done only once (the only item_list per statement). */ @@ -429,12 +416,8 @@ bool st_select_lex_unit::exec() res= sl->join->reinit(); else { - if (sl != global_parameters && !describe) - { - offset_limit_cnt= sl->offset_limit; - select_limit_cnt= sl->select_limit+sl->offset_limit; - } - else + set_limit(sl); + if (sl == global_parameters || describe) { offset_limit_cnt= 0; /* @@ -443,11 +426,7 @@ bool st_select_lex_unit::exec() */ if (sl->order_list.first || describe) select_limit_cnt= HA_POS_ERROR; - else - select_limit_cnt= sl->select_limit+sl->offset_limit; - } - if (select_limit_cnt < sl->select_limit) - select_limit_cnt= HA_POS_ERROR; // no limit + } /* When using braces, SQL_CALC_FOUND_ROWS affects the whole query: @@ -512,7 +491,8 @@ bool st_select_lex_unit::exec() if (!thd->is_fatal_error) // Check if EOM { - ulong options_tmp= init_prepare_fake_select_lex(thd); + set_limit(global_parameters); + init_prepare_fake_select_lex(thd); JOIN *join= fake_select_lex->join; if (!join) { diff --git a/sql/sql_update.cc b/sql/sql_update.cc index a19a3e46798..0d00c38f638 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -557,8 +557,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list, tables.table= table; tables.alias= table_list->alias; - if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, - FALSE, FALSE) || + if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, FALSE) || setup_conds(thd, table_list, select_lex->leaf_tables, conds) || select_lex->setup_ref_array(thd, order_num) || setup_order(thd, select_lex->ref_pointer_array, @@ -644,7 +643,7 @@ bool mysql_multi_update_prepare(THD *thd) */ if (setup_tables(thd, table_list, &lex->select_lex.where, - &lex->select_lex.leaf_tables, FALSE, FALSE)) + &lex->select_lex.leaf_tables, FALSE)) DBUG_RETURN(TRUE); leaves= lex->select_lex.leaf_tables; @@ -764,7 +763,7 @@ bool mysql_multi_update_prepare(THD *thd) tbl->cleanup_items(); if (setup_tables(thd, table_list, &lex->select_lex.where, - &lex->select_lex.leaf_tables, FALSE, FALSE) || + &lex->select_lex.leaf_tables, FALSE) || (lex->select_lex.no_wrap_view_item= 1, res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0), lex->select_lex.no_wrap_view_item= 0, From 19b8379af6d35ea6c0767b8ed05ebc49339bd7be Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Mon, 30 May 2005 21:49:59 +0400 Subject: [PATCH 77/78] One more post-review fix. --- sql/sql_union.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 21549f76350..8d36889df76 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -206,9 +206,8 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, thd_arg->lex->current_select= sl; - can_skip_order_by= is_union && - (!sl->braces || sl->select_limit == HA_POS_ERROR); - + can_skip_order_by= is_union && !(sl->braces && sl->explicit_limit); + res= join->prepare(&sl->ref_pointer_array, (TABLE_LIST*) sl->table_list.first, sl->with_wild, sl->where, From ddf91f0689d6e066cd356e997a7aebd2aadc1c7b Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Tue, 31 May 2005 13:15:23 +0500 Subject: [PATCH 78/78] Fix for bug#10059: SHOW TABLE STATUS FROM `information_schema`; reports uppercase table names information schema table names are always upper case table names --- mysql-test/r/information_schema.result | 4 ++-- sql/sql_show.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index ab57a918e98..872d1f6ea7f 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -470,7 +470,7 @@ s1 drop table t1; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table -character_sets CREATE TEMPORARY TABLE `character_sets` ( +CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( `CHARACTER_SET_NAME` varchar(64) NOT NULL default '', `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '', `DESCRIPTION` varchar(60) NOT NULL default '', @@ -479,7 +479,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` ( set names latin2; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table -character_sets CREATE TEMPORARY TABLE `character_sets` ( +CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( `CHARACTER_SET_NAME` varchar(64) NOT NULL default '', `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '', `DESCRIPTION` varchar(60) NOT NULL default '', diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c873b9be369..32ad85b88f7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -396,7 +396,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) else { if (table_list->schema_table) - protocol->store(table_list->schema_table_name, system_charset_info); + protocol->store(table_list->schema_table->table_name, + system_charset_info); else protocol->store(table->alias, system_charset_info); if (store_create_info(thd, table_list, &buffer)) @@ -757,7 +758,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) else packet->append("CREATE TABLE ", 13); if (table_list->schema_table) - alias= table_list->schema_table_name; + alias= table_list->schema_table->table_name; else alias= (lower_case_table_names == 2 ? table->alias : share->table_name);