summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-08-22 04:07:40 +0300
committerunknown <monty@narttu.mysql.fi>2003-08-22 04:07:40 +0300
commit64393d7e24fe90f5badf3f25f25cc5a24f34b70e (patch)
tree69f51d9d40e937b7da442d9523c0a0a66d5ba847
parent7b9018920bde4eebd52d272f198c4aec53bdf581 (diff)
downloadmariadb-git-64393d7e24fe90f5badf3f25f25cc5a24f34b70e.tar.gz
Move test that uses many tables (in query_cache.test) to separate test so that we can get it 'skipped' instead of 'failed' on system where we can't open many files.
client/mysqltest.c: Fix that LET can be used with queries that return multiple columns libmysql/errmsg.c: Extend socket name to 100 characters in error messages libmysql/libmysql.c: Reset some variables to make ensure that we can call mysql_server_init()/mysql_server_end() many times mysql-test/mysql-test-run.sh: Set open-files-limit to 1024 mysql-test/r/loaddata.result: Add test case for LOAD DATA bug report (was not a bug) mysql-test/r/query_cache.result: Move test with many tables to separate test mysql-test/r/select_safe.result: Make test repeatable mysql-test/t/loaddata.test: Add test case for LOAD DATA bug report (was not a bug) mysql-test/t/query_cache.test: Move test with many tables to separate test mysql-test/t/select_safe.test: Make test repeatable sql/field.cc: Portability fix for gcc 3.3 sql/mysqld.cc: Store in open_files_limit the true number of files we can open (if system supports it) sql/sql_load.cc: Safety fix
-rw-r--r--client/mysqltest.c29
-rw-r--r--libmysql/errmsg.c36
-rw-r--r--libmysql/libmysql.c7
-rw-r--r--mysql-test/include/check_var_limit.inc9
-rw-r--r--mysql-test/mysql-test-run.sh8
-rw-r--r--mysql-test/r/check_var_limit.require2
-rw-r--r--mysql-test/r/loaddata.result10
-rw-r--r--mysql-test/r/query_cache.result20
-rw-r--r--mysql-test/r/query_cache_merge.result20
-rw-r--r--mysql-test/r/select_safe.result4
-rw-r--r--mysql-test/std_data/loaddata2.dat5
-rw-r--r--mysql-test/t/loaddata.test7
-rw-r--r--mysql-test/t/query_cache.test24
-rw-r--r--mysql-test/t/query_cache_merge.test38
-rw-r--r--mysql-test/t/select_safe.test4
-rw-r--r--sql/field.cc9
-rw-r--r--sql/mysqld.cc16
-rw-r--r--sql/sql_load.cc8
18 files changed, 180 insertions, 76 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index f5afa0fa0df..7a5712cc597 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "1.27"
+#define MTEST_VERSION "1.28"
#include <my_global.h>
#include <mysql_embed.h>
@@ -845,7 +845,28 @@ int var_query_set(VAR* v, const char* p, const char** p_end)
}
if ((row = mysql_fetch_row(res)) && row[0])
- eval_expr(v, row[0], 0);
+ {
+ /*
+ Concatenate all row results with tab in between to allow us to work
+ with results from many columns (for example from SHOW VARIABLES)
+ */
+ DYNAMIC_STRING result;
+ uint i;
+ ulong *lengths;
+ char *end;
+
+ init_dynamic_string(&result, "", 16384, 65536);
+ lengths= mysql_fetch_lengths(res);
+ for (i=0; i < mysql_num_fields(res); i++)
+ {
+ if (row[0])
+ dynstr_append_mem(&result, row[i], lengths[i]);
+ dynstr_append_mem(&result, "\t", 1);
+ }
+ end= result.str + result.length-1;
+ eval_expr(v, result.str, (const char**) &end);
+ dynstr_free(&result);
+ }
else
eval_expr(v, "", 0);
@@ -902,8 +923,6 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
return 0;
}
- if (p_end)
- *p_end = 0;
die("Invalid expr: %s", p);
return 1;
}
@@ -1197,7 +1216,7 @@ static char *get_string(char **to_ptr, char **from_ptr,
VAR *var=var_get(start, &end, 0, 1);
if (var && to == (char*) end+1)
{
- DBUG_PRINT("info",("var: %s -> %s", start, var->str_val));
+ DBUG_PRINT("info",("var: '%s' -> '%s'", start, var->str_val));
DBUG_RETURN(var->str_val); /* return found variable value */
}
}
diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c
index 375ca7329c0..7accbf8f1d2 100644
--- a/libmysql/errmsg.c
+++ b/libmysql/errmsg.c
@@ -26,24 +26,24 @@ const char *client_errors[]=
{
"Unbekannter MySQL Fehler",
"Kann UNIX-Socket nicht anlegen (%d)",
- "Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)",
- "Keine Verbindung zu MySQL Server auf %-.64s (%d)",
+ "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)",
+ "Keine Verbindung zu MySQL Server auf %-.100s (%d)",
"Kann TCP/IP-Socket nicht anlegen (%d)",
- "Unbekannter MySQL Server Host (%-.64s) (%d)",
+ "Unbekannter MySQL Server Host (%-.100s) (%d)",
"MySQL Server nicht vorhanden",
"Protokolle ungleich. Server Version = % d Client Version = %d",
"MySQL client got out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%-.64s via TCP/IP",
+ "%-.100s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
- "Verbindung ueber Named Pipe; Host: %-.64s",
+ "Verbindung ueber Named Pipe; Host: %-.100s",
"Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
"Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
"Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
+ "Can't initialize character set %-.32s (path: %-.100s)",
"Got packet bigger than 'max_allowed_packet'",
"Embedded server",
"Error on SHOW SLAVE STATUS:",
@@ -61,24 +61,24 @@ const char *client_errors[]=
{
"Erro desconhecido do MySQL",
"Não pode criar 'UNIX socket' (%d)",
- "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.64s' (%d)",
- "Não pode se conectar ao servidor MySQL em '%-.64s' (%d)",
+ "Não pode se conectar ao servidor MySQL local através do 'socket' '%-.100s' (%d)",
+ "Não pode se conectar ao servidor MySQL em '%-.100s' (%d)",
"Não pode criar 'socket TCP/IP' (%d)",
- "'Host' servidor MySQL '%-.64s' (%d) desconhecido",
+ "'Host' servidor MySQL '%-.100s' (%d) desconhecido",
"Servidor MySQL desapareceu",
"Incompatibilidade de protocolos. Versão do Servidor: %d - Versão do Cliente: %d",
"Cliente do MySQL com falta de memória",
"Informação inválida de 'host'",
"Localhost via 'UNIX socket'",
- "%-.64s via 'TCP/IP'",
+ "%-.100s via 'TCP/IP'",
"Erro na negociação de acesso ao servidor",
"Conexão perdida com servidor MySQL durante 'query'",
"Comandos fora de sincronismo. Você não pode executar este comando agora",
- "%-.64s via 'named pipe'",
+ "%-.100s via 'named pipe'",
"Não pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"Não pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"Não pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
- "Não pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)",
+ "Não pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)",
"Obteve pacote maior do que 'max_allowed_packet'",
"Embedded server"
"Error on SHOW SLAVE STATUS:",
@@ -94,24 +94,24 @@ const char *client_errors[]=
{
"Unknown MySQL error",
"Can't create UNIX socket (%d)",
- "Can't connect to local MySQL server through socket '%-.64s' (%d)",
- "Can't connect to MySQL server on '%-.64s' (%d)",
+ "Can't connect to local MySQL server through socket '%-.100s' (%d)",
+ "Can't connect to MySQL server on '%-.100s' (%d)",
"Can't create TCP/IP socket (%d)",
- "Unknown MySQL Server Host '%-.64s' (%d)",
+ "Unknown MySQL Server Host '%-.100s' (%d)",
"MySQL server has gone away",
"Protocol mismatch. Server Version = %d Client Version = %d",
"MySQL client run out of memory",
"Wrong host info",
"Localhost via UNIX socket",
- "%-.64s via TCP/IP",
+ "%-.100s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
- "%-.64s via named pipe",
+ "%-.100s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
+ "Can't initialize character set %-.32s (path: %-.100s)",
"Got packet bigger than 'max_allowed_packet'",
"Embedded server",
"Error on SHOW SLAVE STATUS:",
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index aa169335dfb..9e32e60f7da 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -110,9 +110,16 @@ void STDCALL mysql_server_end()
{
/* If library called my_init(), free memory allocated by it */
if (!org_my_init_done)
+ {
my_end(0);
+#ifndef THREAD
+ /* Remove TRACING, if enabled by mysql_debug() */
+ DBUG_POP();
+#endif
+ }
else
mysql_thread_end();
+ mysql_client_init= org_my_init_done= 0;
}
my_bool STDCALL mysql_thread_init()
diff --git a/mysql-test/include/check_var_limit.inc b/mysql-test/include/check_var_limit.inc
new file mode 100644
index 00000000000..5f26e2b99a9
--- /dev/null
+++ b/mysql-test/include/check_var_limit.inc
@@ -0,0 +1,9 @@
+#
+# Check that second part of $LIMIT is between $MIN_LIMIT and $MAX_LIMIT
+# This is useful to check that a variable from SHOW_VARIABLES is within
+# certain limits. Check query_cache_merge.test for an example of using this.
+#
+-- require r/check_var_limit.require
+disable_query_log;
+eval select SUBSTRING_INDEX($LIMIT, "\t", 2) BETWEEN $MIN_LIMIT AND $MAX_LIMIT as "limit";
+enable_query_log;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index bf5546483d3..1d1293f81d2 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -16,6 +16,9 @@ USE_MANAGER=0
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
+# For query_cache test
+ulimit -n 1024
+
#++
# Program Definitions
#--
@@ -829,7 +832,6 @@ start_master()
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
- #start master
if [ -z "$DO_BENCH" ]
then
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
@@ -848,6 +850,7 @@ start_master()
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \
+ --open-files-limit=1024 \
$MASTER_40_ARGS \
$SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
@@ -1363,6 +1366,9 @@ fi
$ECHO "Starting Tests"
+#
+# This can probably be deleted
+#
if [ "$DO_BENCH" = 1 ]
then
BENCHDIR=$BASEDIR/sql-bench/
diff --git a/mysql-test/r/check_var_limit.require b/mysql-test/r/check_var_limit.require
new file mode 100644
index 00000000000..01a59782180
--- /dev/null
+++ b/mysql-test/r/check_var_limit.require
@@ -0,0 +1,2 @@
+limit
+1
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 59153f3353a..0b7925de1c5 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -16,3 +16,13 @@ NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+select concat('|',a,'|'), concat('|',b,'|') from t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 48df3b4b563..0b86c79afbf 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -2,7 +2,7 @@ flush query cache;
flush query cache;
reset query cache;
flush status;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1;
+drop table if exists t1,t2,t3;
drop database if exists mysqltest;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
@@ -640,21 +640,3 @@ Variable_name Value
Qcache_queries_in_cache 2
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
-flush status;
-select count(*) from t00;
-count(*)
-514
-select count(*) from t00;
-count(*)
-514
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 1
-show status like "Qcache_hits";
-Variable_name Value
-Qcache_hits 1
-delete from t256;
-show status like "Qcache_queries_in_cache";
-Variable_name Value
-Qcache_queries_in_cache 0
-drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
diff --git a/mysql-test/r/query_cache_merge.result b/mysql-test/r/query_cache_merge.result
new file mode 100644
index 00000000000..c6df4266de2
--- /dev/null
+++ b/mysql-test/r/query_cache_merge.result
@@ -0,0 +1,20 @@
+SET @@global.query_cache_size=1355776;
+flush status;
+select count(*) from t00;
+count(*)
+514
+select count(*) from t00;
+count(*)
+514
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 1
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 1
+delete from t256;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
+SET @@global.query_cache_size=0;
diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result
index ca5c03bdb50..c4e5984d360 100644
--- a/mysql-test/r/select_safe.result
+++ b/mysql-test/r/select_safe.result
@@ -67,12 +67,12 @@ analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21
t2 ALL b NULL NULL NULL 16 Using where
set MAX_SEEKS_FOR_KEY=1;
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21
t2 ref b b 21 t1.b 6 Using where
diff --git a/mysql-test/std_data/loaddata2.dat b/mysql-test/std_data/loaddata2.dat
new file mode 100644
index 00000000000..6e9d6745b8d
--- /dev/null
+++ b/mysql-test/std_data/loaddata2.dat
@@ -0,0 +1,5 @@
+Field A,'Field B'
+Field 1,'Field 2'
+Field 3,'Field 4'
+'Field 5' ,'Field 6'
+Field 6, 'Field 7'
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index e63f0780e3e..732ed248702 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -14,6 +14,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated
SELECT * from t1;
drop table t1;
-
-
-
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+select concat('|',a,'|'), concat('|',b,'|') from t1;
+drop table t1;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index f72a4a504a0..9e1c22ac642 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions
reset query cache;
flush status;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00,mysqltest.t1;
+drop table if exists t1,t2,t3;
drop database if exists mysqltest;
#
@@ -450,25 +450,3 @@ select * from t1;
show status like "Qcache_queries_in_cache";
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1;
-
-#
-# more then 255 (257) merged tables test
-#
-flush status;
-disable_query_log;
-let $1 = 257;
-while ($1)
-{
- eval create table t$1(a int);
- eval insert into t$1 values (1),(2);
- dec $1;
-}
-create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
-enable_query_log;
-select count(*) from t00;
-select count(*) from t00;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-delete from t256;
-show status like "Qcache_queries_in_cache";
-drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test
new file mode 100644
index 00000000000..9d9e311af06
--- /dev/null
+++ b/mysql-test/t/query_cache_merge.test
@@ -0,0 +1,38 @@
+# Test query cache with many tables
+
+--source include/have_query_cache.inc
+let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`;
+let $MIN_LIMIT=100
+let $MAX_LIMIT=65536
+--source include/check_var_limit.inc
+
+SET @@global.query_cache_size=1355776;
+
+#
+# more then 255 (257) merged tables test
+#
+
+flush status;
+disable_query_log;
+--disable_warnings
+let $1 = 257;
+while ($1)
+{
+ eval drop table if exists t$1;
+ eval create table t$1(a int);
+ eval insert into t$1 values (1),(2);
+ dec $1;
+}
+--enable_warnings
+
+create table t00 (a int) type=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
+enable_query_log;
+select count(*) from t00;
+select count(*) from t00;
+show status like "Qcache_queries_in_cache";
+show status like "Qcache_hits";
+delete from t256;
+show status like "Qcache_queries_in_cache";
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
+
+SET @@global.query_cache_size=0;
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
index 206f911d028..904479635c2 100644
--- a/mysql-test/t/select_safe.test
+++ b/mysql-test/t/select_safe.test
@@ -56,9 +56,9 @@ SELECT * from t1;
SELECT @@MAX_SEEKS_FOR_KEY;
analyze table t1;
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
set MAX_SEEKS_FOR_KEY=1;
-explain select * from t1,t1 as t2 where t1.b=t2.b;
+explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
diff --git a/sql/field.cc b/sql/field.cc
index 592252bb294..43481ca0963 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1836,9 +1836,16 @@ double Field_longlong::val_real(void)
else
#endif
longlongget(j,ptr);
- return unsigned_flag ? ulonglong2double((ulonglong) j) : (double) j;
+ /* The following is open coded to avoid a bug in gcc 3.3 */
+ if (unsigned_flag)
+ {
+ ulonglong tmp= (ulonglong) j;
+ return ulonglong2double(tmp);
+ }
+ return (double) j;
}
+
longlong Field_longlong::val_int(void)
{
longlong j;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b90ab1a4a3a..ae5b46671a5 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2158,7 +2158,10 @@ int main(int argc, char **argv)
max_connections,table_cache_size));
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
}
+ open_files_limit= files;
}
+#else
+ open_files_limit= 0; /* Can't set or detect limit */
#endif
unireg_init(opt_specialflag); /* Set up extern variabels */
init_errmessage(); /* Read error messages from file */
@@ -4903,6 +4906,19 @@ static void fix_paths(void)
}
+/*
+ set how many open files we want to be able to handle
+
+ SYNOPSIS
+ set_maximum_open_files()
+ max_file_limit Files to open
+
+ NOTES
+ The request may not fulfilled becasue of system limitations
+
+ RETURN
+ Files available to open
+*/
#ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit)
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index ee573672c35..4911b1a6b75 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -767,9 +767,13 @@ int READ_INFO::read_field()
row_end= to;
return 0;
}
- /* Copy the found '"' character */
+ /*
+ The string didn't terminate yet.
+ Store back next character for the loop
+ */
PUSH(chr);
- chr='"';
+ /* copy the found term character to 'to' */
+ chr= found_enclosed_char;
}
else if (chr == field_term_char && found_enclosed_char == INT_MAX)
{