Commit f8a1a341 authored by unknown's avatar unknown

Merge jlindstrom@bk-internal.mysql.com:/home/bk/mysql-4.1

into hundin.mysql.fi:/home/jan/mysql-4.1

parents ca8fcc00 8191a28b
......@@ -11,7 +11,7 @@ $opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
$opt_embedded_test=$opt_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
$opt_skip_embedded_test=$opt_skip_ps_test=$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
GetOptions(
"bdb",
......@@ -25,7 +25,6 @@ GetOptions(
"delete",
"distribution=s",
"enable-shared",
"embedded-test",
"fast-benchmark",
"help|Information",
"innodb",
......@@ -41,9 +40,10 @@ GetOptions(
"one-error",
"perl-files=s",
"perl-options=s",
"ps-test",
"raid",
"readline",
"skip-embedded-test",
"skip-ps-test",
"stage=i",
"static-client",
"static-perl",
......@@ -57,8 +57,8 @@ GetOptions(
"version-suffix=s",
"with-archive",
"with-cluster",
"with-csv",
"with-example",
"with-csv",
"with-example",
"with-debug",
"with-low-memory",
"with-other-libc=s",
......@@ -278,7 +278,7 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-libedit";
}
$opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded);
$opt_embedded_test= 0 if ($opt_without_embedded);
$opt_skip_embedded_test= 1 if ($opt_without_embedded);
$opt_config_options.= " --with-archive-storage-engine" if ($opt_with_archive);
$opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster);
$opt_config_options.= " --with-csv-storage-engine" if ($opt_with_csv);
......@@ -391,14 +391,14 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
if ($opt_ps_test)
unless ($opt_skip_ps_test)
{
log_timestamp();
info("Running test suite using prepared statements");
check_system("./mysql-test-run $flags --ps-protocol --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
if ($opt_embedded_test)
unless ($opt_skip_embedded_test)
{
log_timestamp();
info("Running embedded server test suite");
......@@ -551,9 +551,6 @@ Delete the distribution file.
--distribution=<distribution_file>
Name of the MySQL source distribution file.
--embedded-test
Run the test suite against the embedded server
--enable-shared
Compile with shared libraries
......@@ -602,15 +599,18 @@ Compile and install the given perl modules.
--perl-options=<options>
Build Perl modules with the additional options
--ps-test
Run an additional test run, using prepared statements
--raid
Compile with RAID support
--readline
Compile against readline library instead of libedit
--skip-embedded-test
Skip running the test suite against the embedded server
--skip-ps-test
Skip running the additional test run that uses the prepared statement protocol
--stage=[1-6]
Start script from some specific point.
......
......@@ -146,3 +146,4 @@ EXPORTS
mysql_rpl_query_type
mysql_slave_query
mysql_embedded
get_defaults_files
......@@ -157,3 +157,4 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
get_defaults_files
......@@ -38,6 +38,11 @@ select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
#
# Bug#2813 - analyse does not quote string values in enums from string
#
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
......
......@@ -98,6 +98,7 @@ static bool fixDepricated(InitConfigFileParser::Context & ctx, const char *);
static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *);
static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data);
static bool fixBackupDataDir(InitConfigFileParser::Context & ctx, const char * data);
static bool fixShmUniqueId(InitConfigFileParser::Context & ctx, const char * data);
const ConfigInfo::SectionRule
ConfigInfo::m_SectionRules[] = {
......@@ -111,6 +112,8 @@ ConfigInfo::m_SectionRules[] = {
{ "REP", transformNode, 0 },
{ "EXTERNAL REP", transformExtNode, 0 },
{ MGM_TOKEN, fixShmUniqueId, 0 },
{ "TCP", checkConnectionSupport, 0 },
{ "SHM", checkConnectionSupport, 0 },
{ "SCI", checkConnectionSupport, 0 },
......@@ -3155,19 +3158,39 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){
DBUG_RETURN(true);
}
static bool
fixShmUniqueId(InitConfigFileParser::Context & ctx, const char * data)
{
DBUG_ENTER("fixShmUniqueId");
Uint32 nodes= 0;
ctx.m_userProperties.get(ctx.fname, &nodes);
if (nodes == 1) // first management server
{
Uint32 portno= atoi(NDB_PORT);
ctx.m_currentSection->get("PortNumber", &portno);
ctx.m_userProperties.put("ShmUniqueId", portno);
}
DBUG_RETURN(true);
}
static
bool
fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
Uint32 id1= 0, id2= 0, key= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
if(ctx.m_currentSection->get("ShmKey", &key))
return true;
{
DBUG_RETURN(true);
}
key= (id1 > id2 ? id1 << 16 | id2 : id2 << 16 | id1);
require(ctx.m_userProperties.get("ShmUniqueId", &key));
key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
ctx.m_currentSection->put("ShmKey", key);
return true;
DBUG_PRINT("info",("Added ShmKey=0x%x", key));
DBUG_RETURN(true);
}
/**
......
......@@ -30,7 +30,7 @@
0, 0, \
0, \
(desc), \
(void *)(value) }
(value) }
#define CPC_ARG(name, type, opt, desc) \
{ (name), \
......@@ -351,17 +351,12 @@ SimpleCpcClient::define_process(Process & p, Properties& reply){
int
SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
enum Proclist {
Proclist_Start,
Proclist_End,
Proclist_Entry
};
int start, end, entry;
const ParserRow_t list_reply[] = {
CPC_CMD("start processes", Proclist_Start, ""),
CPC_CMD("end processes", Proclist_End, ""),
CPC_CMD("start processes", &start, ""),
CPC_CMD("end processes", &end, ""),
CPC_CMD("process", Proclist_Entry, ""),
CPC_CMD("process", &entry, ""),
CPC_ARG("id", Int, Mandatory, "Id of process."),
CPC_ARG("name", String, Mandatory, "Name of process"),
CPC_ARG("group", String, Mandatory, "Group of process"),
......@@ -390,26 +385,29 @@ SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
bool done = false;
while(!done) {
const Properties *proc;
enum Proclist p;
cpc_recv(list_reply, &proc, (void **)&p);
void *p;
cpc_recv(list_reply, &proc, &p);
switch(p) {
case Proclist_Start:
if(p == &start)
{
/* do nothing */
break;
case Proclist_End:
}
else if(p == &end)
{
done = true;
break;
case Proclist_Entry:
}
else if(p == &entry)
{
if(proc != NULL){
Process p;
convert(* proc, p);
procs.push_back(p);
}
break;
default:
/* ignore */
break;
}
else
{
ndbout_c("internal error: %d", __LINE__);
return -1;
}
}
return 0;
......
......@@ -1029,20 +1029,19 @@ uint check_ulonglong(const char *str, uint length)
} /* check_ulonlong */
/*
FUNCTION: append_escaped()
Quote special characters in a string.
SYNOPSIS
append_escaped(to_str, from_str)
to_str (in) A pointer to a String.
from_str (to) A pointer to an allocated string
DESCRIPTION
append_escaped() takes a String type variable, where it appends
escaped the second argument. Only characters that require escaping
will be escaped.
ARGUMENTS
A pointer to a String variable, where results will be appended
A pointer to a String variable, which is appended to the result
String, escaping those characters that require it.
RETURN VALUES
0 Success
1 Out of memory
......
......@@ -64,7 +64,7 @@ const char *command_name[]={
"Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist",
"Connect","Kill","Debug","Ping","Time","Delayed insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave",
"Prepare", "Prepare Execute", "Long Data", "Close stmt",
"Prepare", "Execute", "Long Data", "Close stmt",
"Reset stmt", "Set option",
"Error" // Last command number
};
......@@ -1547,7 +1547,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
packet, (uint) (pend-packet), thd->charset());
table_list.alias= table_list.real_name= conv_name.str;
packet= pend+1;
// command not cachable => no gap for data base name
thd->query_length= strlen(packet); // for simplicity: don't optimize
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
break;
mysql_log.write(thd,command,"%s %s",table_list.real_name,fields);
......
......@@ -1592,7 +1592,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
DBUG_RETURN(1);
}
mysql_log.write(thd, COM_PREPARE, "%s", packet);
mysql_log.write(thd, COM_PREPARE, "[%lu] %s", stmt->id, packet);
thd->current_arena= stmt;
mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
......@@ -1792,6 +1792,9 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
if (stmt->param_count && stmt->set_params_data(stmt, &expanded_query))
goto set_params_data_err;
#endif
mysql_log.write(thd, COM_EXECUTE, "[%lu] %s", stmt->id,
expanded_query.length() ? expanded_query.c_ptr() :
stmt->query);
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
execute_stmt(thd, stmt, &expanded_query, TRUE);
thd->protocol= &thd->protocol_simple; // Use normal protocol
......
......@@ -11503,6 +11503,29 @@ static void test_rewind(void)
rc= mysql_stmt_close(stmt);
}
/* Bug#6761 - mysql_list_fields doesn't work */
static void test_bug6761(void)
{
const char *stmt_text;
MYSQL_RES *res;
int rc;
myheader("test_bug6761");
stmt_text= "CREATE TABLE t1 (a int, b char(255), c decimal)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
res= mysql_list_fields(mysql, "t1", "%");
DIE_UNLESS(res && mysql_num_fields(res) == 3);
mysql_free_result(res);
stmt_text= "DROP TABLE t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
......@@ -11709,6 +11732,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug4172", test_bug4172 },
{ "test_conversion", test_conversion },
{ "test_rewind", test_rewind },
{ "test_bug6761", test_bug6761 },
{ 0, 0 }
};
......
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