summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-06-07 00:31:53 +0300
committerunknown <monty@mysql.com>2005-06-07 00:31:53 +0300
commitbd47a7df597db377aeaa95b6f47f4c24b26d16f0 (patch)
tree1a560cda860f9d9f422087da93fcdc67cd9f66d0 /sql
parentf21e23646991b04ff88efd669a4531a7989b6aec (diff)
parent936b9319b8219daffab3bc6650a02801bf53c8bd (diff)
downloadmariadb-git-bd47a7df597db377aeaa95b6f47f4c24b26d16f0.tar.gz
Merge with 4.1
BitKeeper/etc/logging_ok: auto-union client/sql_string.cc: Auto merged configure.in: Auto merged include/my_global.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/warnings.test: Auto merged mysys/raid.cc: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/field.cc: Auto merged BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e: Auto merged BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_blackhole.cc: Auto merged sql/ha_heap.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_geofunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.cc: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.h: Auto merged sql/procedure.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol_cursor.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_map.cc: Auto merged sql/sql_olap.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/examples/ha_archive.cc: Auto merged sql/examples/ha_example.cc: Auto merged sql/examples/ha_tina.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/tztime.cc: Auto merged strings/ctype-win1250ch.c: Auto merged mysql-test/r/func_gconcat.result: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/r/innodb.result: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/t/func_gconcat.test: merge & ensure that 4.1 and 5.0 source have tests in same order mysql-test/t/innodb.test: merge & ensure that 4.1 and 5.0 source have tests in same order sql/item_func.cc: merge sql/mysqld.cc: merge sql/opt_range.cc: merge sql/sql_parse.cc: merge Give better name to goto labels sql/sql_select.cc: merge
Diffstat (limited to 'sql')
-rw-r--r--sql/examples/ha_archive.cc2
-rw-r--r--sql/examples/ha_example.cc2
-rw-r--r--sql/examples/ha_tina.cc2
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_berkeley.cc3
-rw-r--r--sql/ha_blackhole.cc5
-rw-r--r--sql/ha_heap.cc2
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/ha_myisammrg.cc2
-rw-r--r--sql/ha_ndbcluster.cc4
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/hash_filo.cc2
-rw-r--r--sql/item.cc3
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/item_geofunc.cc3
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_subselect.cc2
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/item_uniq.cc4
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/opt_range.h8
-rw-r--r--sql/procedure.cc2
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/protocol_cursor.cc2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sql_analyse.cc2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_crypt.cc2
-rw-r--r--sql/sql_error.cc4
-rw-r--r--sql/sql_insert.cc8
-rw-r--r--sql/sql_list.cc2
-rw-r--r--sql/sql_map.cc2
-rw-r--r--sql/sql_olap.cc2
-rw-r--r--sql/sql_parse.cc27
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_select.cc88
-rw-r--r--sql/sql_string.cc3
-rw-r--r--sql/sql_table.cc8
-rw-r--r--sql/sql_udf.cc4
-rw-r--r--sql/tztime.cc3
47 files changed, 102 insertions, 148 deletions
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index 4f0cfb91d20..93cedcbf251 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -14,8 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index 66d1a801333..9da297ccd1f 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -63,8 +63,6 @@
-Brian
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 6ca7f67ef66..a030960d08a 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -38,8 +38,6 @@ TODO:
-Brian
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/field.cc b/sql/field.cc
index c87b613cb12..38fdfe4c3b3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -19,8 +19,6 @@
** This file implements classes defined in field.h
*****************************************************************************/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 46f510bb905..16cbd782f0c 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -47,13 +47,12 @@
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
+
#ifdef HAVE_BERKELEY_DB
#include <m_ctype.h>
#include <myisampack.h>
diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
index 00128d3d3b6..6abbe983f48 100644
--- a/sql/ha_blackhole.cc
+++ b/sql/ha_blackhole.cc
@@ -15,14 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
+#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
-
#ifdef HAVE_BLACKHOLE_DB
#include "ha_blackhole.h"
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 3581b26a585..cd655eeb0a9 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index d956e692152..ecd7a8d42c2 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -27,8 +27,6 @@ have disables the InnoDB inlining in this file. */
in Windows?
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 3b17512c6c2..1352fd84d9d 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index d4dc365a163..0796ded3ac0 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index e4345f87c48..b727609f7ef 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -20,10 +20,8 @@
NDB Cluster
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
+#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
diff --git a/sql/handler.cc b/sql/handler.cc
index ffd6fbc5916..965c3d26f49 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -17,8 +17,6 @@
/* Handler-calling-functions */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc
index 34f3cd6b035..ec200768222 100644
--- a/sql/hash_filo.cc
+++ b/sql/hash_filo.cc
@@ -20,8 +20,6 @@
** to usage.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item.cc b/sql/item.cc
index 4f971d952fd..5f6fa6bd50f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -15,12 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
-
#include "mysql_priv.h"
#include <m_ctype.h>
#include "my_dir.h"
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3f25d473792..28ab38c5aed 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -17,8 +17,6 @@
/* This file defines all compare functions */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 432675f90dc..bf202124d1e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -17,8 +17,6 @@
/* This file defines all numerical functions */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
@@ -2373,7 +2371,7 @@ longlong Item_func_field::val_int()
return 0;
for (uint i=1; i < arg_count ; i++)
{
- if (!args[i]->is_null() && val == args[i]->val_int())
+ if (val == args[i]->val_int() && !args[i]->null_value)
return (longlong) (i);
}
}
@@ -2386,7 +2384,7 @@ longlong Item_func_field::val_int()
for (uint i=1; i < arg_count; i++)
{
dec_arg= args[i]->val_decimal(&dec_arg_buf);
- if (!args[i]->is_null() && !my_decimal_cmp(dec_arg, dec))
+ if (!args[i]->null_value && !my_decimal_cmp(dec_arg, dec))
return (longlong) (i);
}
}
@@ -2397,7 +2395,7 @@ longlong Item_func_field::val_int()
return 0;
for (uint i=1; i < arg_count ; i++)
{
- if (!args[i]->is_null() && val == args[i]->val_real())
+ if (val == args[i]->val() && !args[i]->null_value)
return (longlong) (i);
}
}
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 3173994f90f..4a6ceb4bf7d 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -17,14 +17,11 @@
/* This file defines all spatial functions */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
-
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c43f65c731c..d3327a0e41f 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -20,8 +20,6 @@
** (This shouldn't be needed)
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 4c2f17e94e0..1569b6f2f12 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -22,8 +22,6 @@ SUBSELECT TODO:
(sql_select.h/sql_select.cc)
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 6d5b3248fc3..9da915c8c2a 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -17,8 +17,6 @@
/* Sum functions (COUNT, MIN...) */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index b07de7eb21d..564c5e4b9cc 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -17,8 +17,6 @@
/* This file defines all time functions */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_uniq.cc b/sql/item_uniq.cc
index f6cf83ebb10..79b2ca68f4f 100644
--- a/sql/item_uniq.cc
+++ b/sql/item_uniq.cc
@@ -16,10 +16,8 @@
/* Compability file */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation
+#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
diff --git a/sql/log_event.cc b/sql/log_event.cc
index d4225b39704..db631f756bd 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -17,11 +17,10 @@
#ifndef MYSQL_CLIENT
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
+
#include "mysql_priv.h"
#include "slave.h"
#include <my_dir.h>
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 87d27a4bea2..cf60a33e70d 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -53,7 +53,7 @@ inline query_id_t next_query_id() { return query_id++; }
/* useful constants */
extern const key_map key_map_empty;
-extern const key_map key_map_full;
+extern key_map key_map_full; /* Should be threaded as const */
extern const char *primary_key_name;
#include "mysql_com.h"
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6625696c911..a0c35b58a4d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -381,6 +381,9 @@ char mysql_real_data_home[FN_REFLEN],
*opt_init_file, *opt_tc_log_file,
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
+const key_map key_map_empty(0);
+key_map key_map_full(0); // Will be initialized later
+
const char *opt_date_time_formats[3];
char *mysql_data_home= mysql_real_data_home;
@@ -5931,7 +5934,8 @@ static void mysql_init_variables(void)
bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
bzero((char *) &global_status_var, sizeof(global_status_var));
opt_large_pages= 0;
-
+ key_map_full.set_all();
+
/* Character sets */
system_charset_info= &my_charset_utf8_general_ci;
files_charset_info= &my_charset_utf8_general_ci;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0e034564bf7..b3301d17655 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -36,8 +36,6 @@
QUICK_RANGEs are also created in this step.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/opt_range.h b/sql/opt_range.h
index b639ba6efa7..37d77033c8d 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -691,10 +691,14 @@ class SQL_SELECT :public Sql_alloc {
~SQL_SELECT();
void cleanup();
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
- { return test_quick_select(thd, key_map(~(uint)0), 0, limit, force_quick_range) < 0; }
+ {
+ key_map tmp;
+ tmp.set_all();
+ return test_quick_select(thd, tmp, 0, limit, force_quick_range) < 0;
+ }
inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; }
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
- ha_rows limit, bool force_quick_range=0);
+ ha_rows limit, bool force_quick_range);
};
diff --git a/sql/procedure.cc b/sql/procedure.cc
index 38a043300bc..554e2cd0565 100644
--- a/sql/procedure.cc
+++ b/sql/procedure.cc
@@ -17,8 +17,6 @@
/* Procedures (functions with changes output of select) */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 8019f3a123b..57922cdc677 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -19,8 +19,6 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc
index c38a7cdecae..ed2d0b583d0 100644
--- a/sql/protocol_cursor.cc
+++ b/sql/protocol_cursor.cc
@@ -19,8 +19,6 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 0d743f99b73..3f8c8ea2508 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -48,8 +48,6 @@
new attribute.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 55e6dfb3cbe..6706cee8e9d 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -23,8 +23,6 @@
** - type set is out of optimization yet
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 96700e96363..37236735460 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2096,7 +2096,7 @@ bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
SYNOPSIS
open_normal_and_derived_tables
thd - thread handler
- tables - list of tables for open&locking
+ tables - list of tables for open
RETURN
FALSE - ok
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 862cf940173..438bfdbcb73 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -22,8 +22,6 @@
**
*****************************************************************************/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc
index eda7f0f6bbb..f21a109e95d 100644
--- a/sql/sql_crypt.cc
+++ b/sql/sql_crypt.cc
@@ -23,8 +23,6 @@
needs something like 'ssh'.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 3bda16202b9..293b695d199 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -239,6 +239,8 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
offset--;
continue;
}
+ if (limit-- == 0)
+ break;
protocol->prepare_for_resend();
protocol->store(warning_level_names[err->level],
warning_level_length[err->level], system_charset_info);
@@ -246,8 +248,6 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
protocol->store(err->msg, strlen(err->msg), system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
- if (!--limit)
- break;
}
send_eof(thd);
DBUG_RETURN(FALSE);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 6fb871cbc9d..5ca75554c6f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1094,7 +1094,7 @@ public:
volatile bool status,dead;
COPY_INFO info;
I_List<delayed_row> rows;
- uint group_count;
+ ulong group_count;
TABLE_LIST table_list; // Argument
delayed_insert()
@@ -1766,7 +1766,7 @@ static void free_delayed_insert_blobs(register TABLE *table)
bool delayed_insert::handle_inserts(void)
{
int error;
- uint max_rows;
+ ulong max_rows;
bool using_ignore=0, using_bin_log=mysql_bin_log.is_open();
delayed_row *row;
DBUG_ENTER("handle_inserts");
@@ -1785,11 +1785,11 @@ bool delayed_insert::handle_inserts(void)
}
thd.proc_info="insert";
- max_rows=delayed_insert_limit;
+ max_rows= delayed_insert_limit;
if (thd.killed || table->s->version != refresh_version)
{
thd.killed= THD::KILL_CONNECTION;
- max_rows= ~(uint)0; // Do as much as possible
+ max_rows= ~(ulong)0; // Do as much as possible
}
/*
diff --git a/sql/sql_list.cc b/sql/sql_list.cc
index 485c569f49c..d57a7dfe4e3 100644
--- a/sql/sql_list.cc
+++ b/sql/sql_list.cc
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 556d37a405c..9346f3df305 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -15,8 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index b349eda0e2e..831b15cf7ef 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -28,8 +28,6 @@
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 91db0f50f24..7957c9388c6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2747,7 +2747,7 @@ mysql_execute_command(THD *thd)
TABLE_LIST *select_tables= lex->query_tables;
if ((res= create_table_precheck(thd, select_tables, create_table)))
- goto unsent_create_error;
+ goto end_with_restore_list;
#ifndef HAVE_READLINK
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
@@ -2757,7 +2757,7 @@ mysql_execute_command(THD *thd)
create_table->table_name) ||
append_file_to_dir(thd, &lex->create_info.index_file_name,
create_table->table_name))
- goto unsent_create_error;
+ goto end_with_restore_list;
#endif
/*
If we are using SET CHARSET without DEFAULT, add an implicit
@@ -2787,8 +2787,8 @@ mysql_execute_command(THD *thd)
*/
if (wait_if_global_read_lock(thd, 0, 1))
{
- res= -1;
- goto unsent_create_error;
+ res= 1;
+ goto end_with_restore_list;
}
if (select_lex->item_list.elements) // With select
{
@@ -2807,7 +2807,8 @@ mysql_execute_command(THD *thd)
unique_table(create_table, select_tables))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), create_table->table_name);
- goto unsent_create_error1;
+ res= 1;
+ goto end_with_restart_wait;
}
/* If we create merge table, we have to test tables in merge, too */
if (lex->create_info.used_fields & HA_CREATE_USED_UNION)
@@ -2820,7 +2821,8 @@ mysql_execute_command(THD *thd)
if (unique_table(tab, select_tables))
{
my_error(ER_UPDATE_TABLE_USED, MYF(0), tab->table_name);
- goto unsent_create_error1;
+ res= 1;
+ goto end_with_restart_wait;
}
}
}
@@ -2863,15 +2865,8 @@ mysql_execute_command(THD *thd)
if (!res)
send_ok(thd);
}
- /*
- Release the protection against the global read lock and wake
- everyone, who might want to set a global read lock.
- */
- start_waiting_global_read_lock(thd);
- lex->link_first_table_back(create_table, link_to_local);
- break;
-unsent_create_error1:
+end_with_restart_wait:
/*
Release the protection against the global read lock and wake
everyone, who might want to set a global read lock.
@@ -2879,9 +2874,9 @@ unsent_create_error1:
start_waiting_global_read_lock(thd);
/* put tables back for PS rexecuting */
-unsent_create_error:
+end_with_restore_list:
lex->link_first_table_back(create_table, link_to_local);
- goto error;
+ break;
}
case SQLCOM_CREATE_INDEX:
DBUG_ASSERT(first_table == all_tables && first_table != 0);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 71cebb61ae6..9e82661d790 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -84,7 +84,7 @@ static int send_file(THD *thd)
char fname[FN_REFLEN+1];
const char *errmsg = 0;
int old_timeout;
- uint packet_len;
+ unsigned long packet_len;
char buf[IO_SIZE]; // It's safe to alloc this
DBUG_ENTER("send_file");
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2f1761387ae..e6702faa4e3 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -17,8 +17,6 @@
/* mysql_select and join optimization */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
@@ -36,9 +34,6 @@ const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
"index_merge"
};
-const key_map key_map_empty(0);
-const key_map key_map_full(~(uint)0);
-
static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
static bool make_join_statistics(JOIN *join, TABLE_LIST *leaves, COND *conds,
DYNAMIC_ARRAY *keyuse);
@@ -88,7 +83,7 @@ static bool only_eq_ref_tables(JOIN *join, ORDER *order, table_map tables);
static void update_depend_map(JOIN *join);
static void update_depend_map(JOIN *join, ORDER *order);
static ORDER *remove_const(JOIN *join,ORDER *first_order,COND *cond,
- bool *simple_order);
+ bool change_list, bool *simple_order);
static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
List<Item> &fields, bool send_row,
uint select_options, const char *info,
@@ -749,7 +744,7 @@ JOIN::optimize()
/* Optimize distinct away if possible */
{
ORDER *org_order= order;
- order=remove_const(this, order,conds,&simple_order);
+ order=remove_const(this, order,conds,1, &simple_order);
/*
If we are using ORDER BY NULL or ORDER BY const_expression,
return result in any order (even if we are using a GROUP BY)
@@ -817,8 +812,9 @@ JOIN::optimize()
DBUG_RETURN(1);
}
simple_group= 0;
- if (rollup.state == ROLLUP::STATE_NONE)
- group_list= remove_const(this, group_list, conds, &simple_group);
+ group_list= remove_const(this, group_list, conds,
+ rollup.state == ROLLUP::STATE_NONE,
+ &simple_group);
if (!group_list && group)
{
order=0; // The output has only one row
@@ -830,7 +826,7 @@ JOIN::optimize()
if (procedure && procedure->group)
{
group_list= procedure->group= remove_const(this, procedure->group, conds,
- &simple_group);
+ 1, &simple_group);
calc_group_buffer(this, group_list);
}
@@ -2088,8 +2084,8 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
{
select->head=table;
table->reginfo.impossible_range=0;
- if ((error=select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
- limit)) == 1)
+ if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0,
+ limit, 0)) == 1)
DBUG_RETURN(select->quick->records);
if (error == -1)
{
@@ -5091,7 +5087,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->select_cond=0;
join_tab->quick=0;
join_tab->type= JT_ALL; /* Map through all records */
- join_tab->keys.init(~(uint)0); /* test everything in quick */
+ join_tab->keys.init();
+ join_tab->keys.set_all(); /* test everything in quick */
join_tab->info=0;
join_tab->on_expr_ref=0;
join_tab->last_inner= 0;
@@ -5540,7 +5537,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
- join->unit->select_limit_cnt)) < 0)
+ join->unit->select_limit_cnt), 0) < 0)
{
/*
Before reporting "Impossible WHERE" for the whole query
@@ -5553,7 +5550,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
(join->select_options &
OPTION_FOUND_ROWS ?
HA_POS_ERROR :
- join->unit->select_limit_cnt)) < 0)
+ join->unit->select_limit_cnt),0) < 0)
DBUG_RETURN(1); // Impossible WHERE
}
else
@@ -6122,20 +6119,39 @@ static void update_depend_map(JOIN *join, ORDER *order)
/*
- simple_order is set to 1 if sort_order only uses fields from head table
- and the head table is not a LEFT JOIN table
+ Remove all constants and check if ORDER only contains simple expressions
+
+ SYNOPSIS
+ remove_const()
+ join Join handler
+ first_order List of SORT or GROUP order
+ cond WHERE statement
+ change_list Set to 1 if we should remove things from list
+ If this is not set, then only simple_order is
+ calculated
+ simple_order Set to 1 if we are only using simple expressions
+
+ RETURN
+ Returns new sort order
+
+ simple_order is set to 1 if sort_order only uses fields from head table
+ and the head table is not a LEFT JOIN table
+
*/
static ORDER *
-remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
+remove_const(JOIN *join,ORDER *first_order, COND *cond,
+ bool change_list, bool *simple_order)
{
if (join->tables == join->const_tables)
- return 0; // No need to sort
- DBUG_ENTER("remove_const");
+ return change_list ? 0 : first_order; // No need to sort
+
ORDER *order,**prev_ptr;
table_map first_table= join->join_tab[join->const_tables].table->map;
table_map not_const_tables= ~join->const_table_map;
table_map ref;
+ DBUG_ENTER("remove_const");
+
prev_ptr= &first_order;
*simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1;
@@ -6166,7 +6182,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
}
if ((ref=order_tables & (not_const_tables ^ first_table)))
{
- if (!(order_tables & first_table) && only_eq_ref_tables(join,first_order,ref))
+ if (!(order_tables & first_table) &&
+ only_eq_ref_tables(join,first_order, ref))
{
DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
continue;
@@ -6175,11 +6192,13 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond, bool *simple_order)
}
}
}
- *prev_ptr= order; // use this entry
+ if (change_list)
+ *prev_ptr= order; // use this entry
prev_ptr= &order->next;
}
- *prev_ptr=0;
- if (!first_order) // Nothing to sort/group
+ if (change_list)
+ *prev_ptr=0;
+ if (prev_ptr == &first_order) // Nothing to sort/group
*simple_order=1;
DBUG_PRINT("exit",("simple_order: %d",(int) *simple_order));
DBUG_RETURN(first_order);
@@ -9829,7 +9848,7 @@ test_if_quick_select(JOIN_TAB *tab)
delete tab->select->quick;
tab->select->quick=0;
return tab->select->test_quick_select(tab->join->thd, tab->keys,
- (table_map) 0, HA_POS_ERROR);
+ (table_map) 0, HA_POS_ERROR, 0);
}
@@ -10865,12 +10884,15 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
parameres are set correctly by the range optimizer.
*/
key_map new_ref_key_map;
- new_ref_key_map.clear_all(); /* Force the creation of quick select */
- new_ref_key_map.set_bit(new_ref_key); /* only for new_ref_key. */
+ new_ref_key_map.clear_all(); // Force the creation of quick select
+ new_ref_key_map.set_bit(new_ref_key); // only for new_ref_key.
if (select->test_quick_select(tab->join->thd, new_ref_key_map, 0,
- (tab->join->select_options & OPTION_FOUND_ROWS) ?
- HA_POS_ERROR : tab->join->unit->select_limit_cnt) <= 0)
+ (tab->join->select_options &
+ OPTION_FOUND_ROWS) ?
+ HA_POS_ERROR :
+ tab->join->unit->select_limit_cnt,0) <=
+ 0)
DBUG_RETURN(0);
}
ref_key= new_ref_key;
@@ -12528,6 +12550,8 @@ bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &send_fields,
for (uint i=0 ; i <= send_group_parts ;i++)
sum_funcs_end[i]= func;
}
+ else if (rollup.state == ROLLUP::STATE_READY)
+ DBUG_RETURN(FALSE); // Don't put end marker
*func=0; // End marker
DBUG_RETURN(FALSE);
}
@@ -13070,12 +13094,12 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields,
This is an element that is used by the GROUP BY and should be
set to NULL in this level
*/
+ Item_null_result *null_item;
item->maybe_null= 1; // Value will be null sometimes
null_item= rollup.null_items[i];
DBUG_ASSERT(null_item->result_field == 0 ||
- null_item->result_field ==
- ((Item_field *) item)->result_field);
- null_item->result_field= ((Item_field *) item)->result_field;
+ null_item->result_field == item->get_tmp_table_field());
+ null_item->result_field= item->get_tmp_table_field();
item= null_item;
break;
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index be4354227a5..51f802e7465 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -16,12 +16,11 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
+#include <my_global.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_ctype.h>
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index d98ae778bcf..dcc307ff813 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -346,7 +346,7 @@ int quick_rm_table(enum db_type base,const char *db,
build_table_path(path, sizeof(path), db, table_name, reg_ext);
if (my_delete(path,MYF(0)))
error=1; /* purecov: inspected */
- build_table_path(path, sizeof(path), db, table_name, "");
+ *fn_ext(path)= 0; // Remove reg_ext
return ha_delete_table(current_thd, base, path, table_name, 0) || error;
}
@@ -1556,7 +1556,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
/* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
- char tmp_table_name[NAME_LEN+1];
+ char tmp_table_name[tmp_file_prefix_length+22+22+22+3];
my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x",
tmp_file_prefix, current_pid, thd->thread_id,
thd->tmp_table++);
@@ -2909,7 +2909,7 @@ int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ?
table_list->alias : table_list->table_name,
- reg_ext) != 0 ||
+ reg_ext) == 0 ||
mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file))
/* don't need to free((gptr) key_info_buffer);*/
@@ -3010,7 +3010,7 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ?
table_list->alias : table_list->table_name,
- reg_ext) != 0 ||
+ reg_ext) == 0 ||
mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file))
/*don't need to free((gptr) key_numbers);*/
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 7c6e88306d9..e0c3034a58a 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -28,10 +28,8 @@
dynamic functions, so this shouldn't be a real problem.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: implement sql_udf.h
+#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
diff --git a/sql/tztime.cc b/sql/tztime.cc
index a52b9701e8e..f5111459da2 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -25,12 +25,11 @@
it creates unsolved link dependencies on some platforms.
*/
-#include <my_global.h>
-
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
+#include <my_global.h>
#if !defined(TZINFO2SQL) && !defined(TESTTIME)
#include "mysql_priv.h"
#else