Commit 64393d7e authored by unknown's avatar unknown

Move test that uses many tables (in query_cache.test) to separate test so that...

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
parent 7b901892
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.27" #define MTEST_VERSION "1.28"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -845,7 +845,28 @@ int var_query_set(VAR* v, const char* p, const char** p_end) ...@@ -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]) 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 else
eval_expr(v, "", 0); eval_expr(v, "", 0);
...@@ -902,8 +923,6 @@ int eval_expr(VAR* v, const char* p, const char** p_end) ...@@ -902,8 +923,6 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
return 0; return 0;
} }
if (p_end)
*p_end = 0;
die("Invalid expr: %s", p); die("Invalid expr: %s", p);
return 1; return 1;
} }
...@@ -1197,7 +1216,7 @@ static char *get_string(char **to_ptr, char **from_ptr, ...@@ -1197,7 +1216,7 @@ static char *get_string(char **to_ptr, char **from_ptr,
VAR *var=var_get(start, &end, 0, 1); VAR *var=var_get(start, &end, 0, 1);
if (var && to == (char*) end+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 */ DBUG_RETURN(var->str_val); /* return found variable value */
} }
} }
......
...@@ -26,24 +26,24 @@ const char *client_errors[]= ...@@ -26,24 +26,24 @@ const char *client_errors[]=
{ {
"Unbekannter MySQL Fehler", "Unbekannter MySQL Fehler",
"Kann UNIX-Socket nicht anlegen (%d)", "Kann UNIX-Socket nicht anlegen (%d)",
"Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)", "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)",
"Keine Verbindung zu MySQL Server auf %-.64s (%d)", "Keine Verbindung zu MySQL Server auf %-.100s (%d)",
"Kann TCP/IP-Socket nicht anlegen (%d)", "Kann TCP/IP-Socket nicht anlegen (%d)",
"Unbekannter MySQL Server Host (%-.64s) (%d)", "Unbekannter MySQL Server Host (%-.100s) (%d)",
"MySQL Server nicht vorhanden", "MySQL Server nicht vorhanden",
"Protokolle ungleich. Server Version = % d Client Version = %d", "Protokolle ungleich. Server Version = % d Client Version = %d",
"MySQL client got out of memory", "MySQL client got out of memory",
"Wrong host info", "Wrong host info",
"Localhost via UNIX socket", "Localhost via UNIX socket",
"%-.64s via TCP/IP", "%-.100s via TCP/IP",
"Error in server handshake", "Error in server handshake",
"Lost connection to MySQL server during query", "Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now", "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 nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
"Kann Named Pipe nicht oeffnen. 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)", "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'", "Got packet bigger than 'max_allowed_packet'",
"Embedded server", "Embedded server",
"Error on SHOW SLAVE STATUS:", "Error on SHOW SLAVE STATUS:",
...@@ -61,24 +61,24 @@ const char *client_errors[]= ...@@ -61,24 +61,24 @@ const char *client_errors[]=
{ {
"Erro desconhecido do MySQL", "Erro desconhecido do MySQL",
"No pode criar 'UNIX socket' (%d)", "No pode criar 'UNIX socket' (%d)",
"No pode se conectar ao servidor MySQL local atravs do 'socket' '%-.64s' (%d)", "No pode se conectar ao servidor MySQL local atravs do 'socket' '%-.100s' (%d)",
"No pode se conectar ao servidor MySQL em '%-.64s' (%d)", "No pode se conectar ao servidor MySQL em '%-.100s' (%d)",
"No pode criar 'socket TCP/IP' (%d)", "No pode criar 'socket TCP/IP' (%d)",
"'Host' servidor MySQL '%-.64s' (%d) desconhecido", "'Host' servidor MySQL '%-.100s' (%d) desconhecido",
"Servidor MySQL desapareceu", "Servidor MySQL desapareceu",
"Incompatibilidade de protocolos. Verso do Servidor: %d - Verso do Cliente: %d", "Incompatibilidade de protocolos. Verso do Servidor: %d - Verso do Cliente: %d",
"Cliente do MySQL com falta de memria", "Cliente do MySQL com falta de memria",
"Informao invlida de 'host'", "Informao invlida de 'host'",
"Localhost via 'UNIX socket'", "Localhost via 'UNIX socket'",
"%-.64s via 'TCP/IP'", "%-.100s via 'TCP/IP'",
"Erro na negociao de acesso ao servidor", "Erro na negociao de acesso ao servidor",
"Conexo perdida com servidor MySQL durante 'query'", "Conexo perdida com servidor MySQL durante 'query'",
"Comandos fora de sincronismo. Voc no pode executar este comando agora", "Comandos fora de sincronismo. Voc no pode executar este comando agora",
"%-.64s via 'named pipe'", "%-.100s via 'named pipe'",
"No pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", "No pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", "No pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", "No pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)", "No pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)",
"Obteve pacote maior do que 'max_allowed_packet'", "Obteve pacote maior do que 'max_allowed_packet'",
"Embedded server" "Embedded server"
"Error on SHOW SLAVE STATUS:", "Error on SHOW SLAVE STATUS:",
...@@ -94,24 +94,24 @@ const char *client_errors[]= ...@@ -94,24 +94,24 @@ const char *client_errors[]=
{ {
"Unknown MySQL error", "Unknown MySQL error",
"Can't create UNIX socket (%d)", "Can't create UNIX socket (%d)",
"Can't connect to local MySQL server through socket '%-.64s' (%d)", "Can't connect to local MySQL server through socket '%-.100s' (%d)",
"Can't connect to MySQL server on '%-.64s' (%d)", "Can't connect to MySQL server on '%-.100s' (%d)",
"Can't create TCP/IP socket (%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", "MySQL server has gone away",
"Protocol mismatch. Server Version = %d Client Version = %d", "Protocol mismatch. Server Version = %d Client Version = %d",
"MySQL client run out of memory", "MySQL client run out of memory",
"Wrong host info", "Wrong host info",
"Localhost via UNIX socket", "Localhost via UNIX socket",
"%-.64s via TCP/IP", "%-.100s via TCP/IP",
"Error in server handshake", "Error in server handshake",
"Lost connection to MySQL server during query", "Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now", "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 wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open 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 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'", "Got packet bigger than 'max_allowed_packet'",
"Embedded server", "Embedded server",
"Error on SHOW SLAVE STATUS:", "Error on SHOW SLAVE STATUS:",
......
...@@ -110,9 +110,16 @@ void STDCALL mysql_server_end() ...@@ -110,9 +110,16 @@ void STDCALL mysql_server_end()
{ {
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
{
my_end(0); my_end(0);
#ifndef THREAD
/* Remove TRACING, if enabled by mysql_debug() */
DBUG_POP();
#endif
}
else else
mysql_thread_end(); mysql_thread_end();
mysql_client_init= org_my_init_done= 0;
} }
my_bool STDCALL mysql_thread_init() my_bool STDCALL mysql_thread_init()
......
#
# 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;
...@@ -16,6 +16,9 @@ USE_MANAGER=0 ...@@ -16,6 +16,9 @@ USE_MANAGER=0
MY_TZ=GMT-3 MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
# For query_cache test
ulimit -n 1024
#++ #++
# Program Definitions # Program Definitions
#-- #--
...@@ -829,7 +832,6 @@ start_master() ...@@ -829,7 +832,6 @@ start_master()
/bin/sh $master_init_script /bin/sh $master_init_script
fi fi
cd $BASEDIR # for gcov cd $BASEDIR # for gcov
#start master
if [ -z "$DO_BENCH" ] if [ -z "$DO_BENCH" ]
then then
master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \
...@@ -848,6 +850,7 @@ start_master() ...@@ -848,6 +850,7 @@ start_master()
--tmpdir=$MYSQL_TMP_DIR \ --tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \ --language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \ --innodb_data_file_path=ibdata1:50M \
--open-files-limit=1024 \
$MASTER_40_ARGS \ $MASTER_40_ARGS \
$SMALL_SERVER \ $SMALL_SERVER \
$EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT"
...@@ -1363,6 +1366,9 @@ fi ...@@ -1363,6 +1366,9 @@ fi
$ECHO "Starting Tests" $ECHO "Starting Tests"
#
# This can probably be deleted
#
if [ "$DO_BENCH" = 1 ] if [ "$DO_BENCH" = 1 ]
then then
BENCHDIR=$BASEDIR/sql-bench/ BENCHDIR=$BASEDIR/sql-bench/
......
...@@ -16,3 +16,13 @@ NULL NULL 0000-00-00 0000-00-00 ...@@ -16,3 +16,13 @@ NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00 NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL NULL 2003-03-03 2003-03-03 NULL
drop table 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;
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;
...@@ -2,7 +2,7 @@ flush query cache; ...@@ -2,7 +2,7 @@ flush query cache;
flush query cache; flush query cache;
reset query cache; reset query cache;
flush status; 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; drop database if exists mysqltest;
create table t1 (a int not null); create table t1 (a int not null);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
...@@ -640,21 +640,3 @@ Variable_name Value ...@@ -640,21 +640,3 @@ Variable_name Value
Qcache_queries_in_cache 2 Qcache_queries_in_cache 2
SET OPTION SQL_SELECT_LIMIT=DEFAULT; SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1; 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;
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;
...@@ -67,12 +67,12 @@ analyze table t1; ...@@ -67,12 +67,12 @@ analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK 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"); 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 table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21 t1 ALL b NULL NULL NULL 21
t2 ALL b NULL NULL NULL 16 Using where t2 ALL b NULL NULL NULL 16 Using where
set MAX_SEEKS_FOR_KEY=1; 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 table type possible_keys key key_len ref rows Extra
t1 ALL b NULL NULL NULL 21 t1 ALL b NULL NULL NULL 21
t2 ref b b 21 t1.b 6 Using where t2 ref b b 21 t1.b 6 Using where
......
Field A,'Field B'
Field 1,'Field 2'
Field 3,'Field 4'
'Field 5' ,'Field 6'
Field 6, 'Field 7'
...@@ -14,6 +14,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated ...@@ -14,6 +14,7 @@ load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated
SELECT * from t1; SELECT * from t1;
drop table 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;
...@@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions ...@@ -10,7 +10,7 @@ flush query cache; # This crashed in some versions
flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions
reset query cache; reset query cache;
flush status; 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; drop database if exists mysqltest;
# #
...@@ -450,25 +450,3 @@ select * from t1; ...@@ -450,25 +450,3 @@ select * from t1;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
SET OPTION SQL_SELECT_LIMIT=DEFAULT; SET OPTION SQL_SELECT_LIMIT=DEFAULT;
drop table t1; 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;
# 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;
...@@ -56,9 +56,9 @@ SELECT * from t1; ...@@ -56,9 +56,9 @@ SELECT * from t1;
SELECT @@MAX_SEEKS_FOR_KEY; SELECT @@MAX_SEEKS_FOR_KEY;
analyze table t1; 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"); 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; 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; SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1; drop table t1;
......
...@@ -1836,9 +1836,16 @@ double Field_longlong::val_real(void) ...@@ -1836,9 +1836,16 @@ double Field_longlong::val_real(void)
else else
#endif #endif
longlongget(j,ptr); 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 Field_longlong::val_int(void)
{ {
longlong j; longlong j;
......
...@@ -2158,7 +2158,10 @@ int main(int argc, char **argv) ...@@ -2158,7 +2158,10 @@ int main(int argc, char **argv)
max_connections,table_cache_size)); max_connections,table_cache_size));
sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",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 #endif
unireg_init(opt_specialflag); /* Set up extern variabels */ unireg_init(opt_specialflag); /* Set up extern variabels */
init_errmessage(); /* Read error messages from file */ init_errmessage(); /* Read error messages from file */
...@@ -4903,6 +4906,19 @@ static void fix_paths(void) ...@@ -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 #ifdef SET_RLIMIT_NOFILE
static uint set_maximum_open_files(uint max_file_limit) static uint set_maximum_open_files(uint max_file_limit)
......
...@@ -767,9 +767,13 @@ int READ_INFO::read_field() ...@@ -767,9 +767,13 @@ int READ_INFO::read_field()
row_end= to; row_end= to;
return 0; return 0;
} }
/* Copy the found '"' character */ /*
The string didn't terminate yet.
Store back next character for the loop
*/
PUSH(chr); 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) else if (chr == field_term_char && found_enclosed_char == INT_MAX)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment