mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge shellback.(none):/home/msvensson/mysql/mysql-5.0
into shellback.(none):/home/msvensson/mysql/mysql-5.1 sql/sql_db.cc: Auto merged strings/decimal.c: Auto merged tests/mysql_client_test.c: Auto merged
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
# Embedded server doesn't support external clients
|
# Embedded server doesn't support external clients
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
|
# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY
|
||||||
|
--source include/not_windows.inc
|
||||||
|
|
||||||
# test for Bug #4998 "--protocol doesn't reject bad values"
|
# test for Bug #4998 "--protocol doesn't reject bad values"
|
||||||
|
|
||||||
|
@ -1116,6 +1116,13 @@ public:
|
|||||||
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
||||||
const char *func_name() const { return "group_concat"; }
|
const char *func_name() const { return "group_concat"; }
|
||||||
virtual Item_result result_type () const { return STRING_RESULT; }
|
virtual Item_result result_type () const { return STRING_RESULT; }
|
||||||
|
enum_field_types field_type() const
|
||||||
|
{
|
||||||
|
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
|
||||||
|
return FIELD_TYPE_BLOB;
|
||||||
|
else
|
||||||
|
return MYSQL_TYPE_VARCHAR;
|
||||||
|
}
|
||||||
void clear();
|
void clear();
|
||||||
bool add();
|
bool add();
|
||||||
void reset_field() { DBUG_ASSERT(0); } // not used
|
void reset_field() { DBUG_ASSERT(0); } // not used
|
||||||
|
@ -229,8 +229,12 @@ static int net_data_is_ready(my_socket sd)
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
#ifndef __WIN__
|
||||||
|
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
|
||||||
if (sd >= FD_SETSIZE)
|
if (sd >= FD_SETSIZE)
|
||||||
return -1;
|
return -1;
|
||||||
|
#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
|
||||||
|
#endif
|
||||||
|
|
||||||
FD_ZERO(&sfds);
|
FD_ZERO(&sfds);
|
||||||
FD_SET(sd, &sfds);
|
FD_SET(sd, &sfds);
|
||||||
@ -271,7 +275,7 @@ void net_clear(NET *net)
|
|||||||
int count, ready;
|
int count, ready;
|
||||||
DBUG_ENTER("net_clear");
|
DBUG_ENTER("net_clear");
|
||||||
#if !defined(EMBEDDED_LIBRARY)
|
#if !defined(EMBEDDED_LIBRARY)
|
||||||
while((ready= net_data_is_ready(net->vio->sd)) != 0)
|
while((ready= net_data_is_ready(net->vio->sd)) > 0)
|
||||||
{
|
{
|
||||||
/* The socket is ready */
|
/* The socket is ready */
|
||||||
if ((count= vio_read(net->vio, (char*) (net->buff),
|
if ((count= vio_read(net->vio, (char*) (net->buff),
|
||||||
@ -286,15 +290,27 @@ void net_clear(NET *net)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No data to read and 'net_data_is_ready' returned "don't know" */
|
|
||||||
if (ready == -1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
|
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
|
||||||
net->error= 2;
|
net->error= 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
|
||||||
|
/* 'net_data_is_ready' returned "don't know" */
|
||||||
|
if (ready == -1)
|
||||||
|
{
|
||||||
|
/* Read unblocking to clear net */
|
||||||
|
my_bool old_mode;
|
||||||
|
if (!vio_blocking(net->vio, FALSE, &old_mode))
|
||||||
|
{
|
||||||
|
while ((count= vio_read(net->vio, (char*) (net->buff),
|
||||||
|
(uint32) net->max_packet)) > 0)
|
||||||
|
DBUG_PRINT("info",("skipped %d bytes from file: %s",
|
||||||
|
count, vio_description(net->vio)));
|
||||||
|
vio_blocking(net->vio, TRUE, &old_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
|
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
|
||||||
net->write_pos=net->buff;
|
net->write_pos=net->buff;
|
||||||
|
@ -1226,7 +1226,8 @@ err:
|
|||||||
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||||
{
|
{
|
||||||
int length, db_length;
|
int length, db_length;
|
||||||
char *dbname=my_strdup((char*) name,MYF(MY_WME));
|
char *dbname= thd->slave_thread ? (char *) name :
|
||||||
|
my_strdup((char *) name, MYF(MY_WME));
|
||||||
char path[FN_REFLEN];
|
char path[FN_REFLEN];
|
||||||
HA_CREATE_INFO create;
|
HA_CREATE_INFO create;
|
||||||
bool system_db= 0;
|
bool system_db= 0;
|
||||||
@ -1249,7 +1250,8 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
|||||||
system_db= 1;
|
system_db= 1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
x_free(dbname); /* purecov: inspected */
|
if (!(thd->slave_thread))
|
||||||
|
x_free(dbname); /* purecov: inspected */
|
||||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
|
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
|
||||||
MYF(0)); /* purecov: inspected */
|
MYF(0)); /* purecov: inspected */
|
||||||
DBUG_RETURN(1); /* purecov: inspected */
|
DBUG_RETURN(1); /* purecov: inspected */
|
||||||
@ -1257,7 +1259,8 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
|||||||
if (check_db_name(dbname))
|
if (check_db_name(dbname))
|
||||||
{
|
{
|
||||||
my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
|
my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
|
||||||
my_free(dbname, MYF(0));
|
if (!(thd->slave_thread))
|
||||||
|
my_free(dbname, MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info",("Use database: %s", dbname));
|
DBUG_PRINT("info",("Use database: %s", dbname));
|
||||||
@ -1287,7 +1290,8 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
|||||||
dbname);
|
dbname);
|
||||||
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
||||||
sctx->priv_user, sctx->priv_host, dbname);
|
sctx->priv_user, sctx->priv_host, dbname);
|
||||||
my_free(dbname,MYF(0));
|
if (!(thd->slave_thread))
|
||||||
|
my_free(dbname,MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1298,7 +1302,8 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
|||||||
if (my_access(path,F_OK))
|
if (my_access(path,F_OK))
|
||||||
{
|
{
|
||||||
my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
|
my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
|
||||||
my_free(dbname,MYF(0));
|
if (!(thd->slave_thread))
|
||||||
|
my_free(dbname,MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
@ -1306,7 +1311,8 @@ end:
|
|||||||
x_free(thd->db);
|
x_free(thd->db);
|
||||||
if (dbname && dbname[0] == 0)
|
if (dbname && dbname[0] == 0)
|
||||||
{
|
{
|
||||||
my_free(dbname, MYF(0));
|
if (!(thd->slave_thread))
|
||||||
|
my_free(dbname, MYF(0));
|
||||||
thd->db= NULL;
|
thd->db= NULL;
|
||||||
thd->db_length= 0;
|
thd->db_length= 0;
|
||||||
}
|
}
|
||||||
|
@ -1353,6 +1353,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
|||||||
}
|
}
|
||||||
from+=i;
|
from+=i;
|
||||||
*buf=x ^ mask;
|
*buf=x ^ mask;
|
||||||
|
if (((uint32)*buf) >= powers10[intg0x+1])
|
||||||
|
goto err;
|
||||||
if (buf > to->buf || *buf != 0)
|
if (buf > to->buf || *buf != 0)
|
||||||
buf++;
|
buf++;
|
||||||
else
|
else
|
||||||
@ -1362,6 +1364,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(sizeof(dec1) == 4);
|
DBUG_ASSERT(sizeof(dec1) == 4);
|
||||||
*buf=mi_sint4korr(from) ^ mask;
|
*buf=mi_sint4korr(from) ^ mask;
|
||||||
|
if (((uint32)*buf) > DIG_MAX)
|
||||||
|
goto err;
|
||||||
if (buf > to->buf || *buf != 0)
|
if (buf > to->buf || *buf != 0)
|
||||||
buf++;
|
buf++;
|
||||||
else
|
else
|
||||||
@ -1372,6 +1376,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(sizeof(dec1) == 4);
|
DBUG_ASSERT(sizeof(dec1) == 4);
|
||||||
*buf=mi_sint4korr(from) ^ mask;
|
*buf=mi_sint4korr(from) ^ mask;
|
||||||
|
if (((uint32)*buf) > DIG_MAX)
|
||||||
|
goto err;
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
if (frac0x)
|
if (frac0x)
|
||||||
@ -1387,10 +1393,17 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
|||||||
default: DBUG_ASSERT(0);
|
default: DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
*buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x];
|
*buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x];
|
||||||
|
if (((uint32)*buf) > DIG_MAX)
|
||||||
|
goto err;
|
||||||
buf++;
|
buf++;
|
||||||
}
|
}
|
||||||
my_afree(d_copy);
|
my_afree(d_copy);
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
err:
|
||||||
|
my_afree(d_copy);
|
||||||
|
decimal_make_zero(((decimal_t*) to));
|
||||||
|
return(E_DEC_BAD_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -14840,6 +14840,40 @@ static void test_bug15613()
|
|||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
Bug#14169: type of group_concat() result changed to blob if tmp_table was used
|
||||||
|
*/
|
||||||
|
static void test_bug14169()
|
||||||
|
{
|
||||||
|
MYSQL_STMT *stmt;
|
||||||
|
const char *stmt_text;
|
||||||
|
MYSQL_RES *res;
|
||||||
|
MYSQL_FIELD *field;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
myheader("test_bug14169");
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "drop table if exists t1");
|
||||||
|
myquery(rc);
|
||||||
|
rc= mysql_query(mysql, "set session group_concat_max_len=1024");
|
||||||
|
myquery(rc);
|
||||||
|
rc= mysql_query(mysql, "create table t1 (f1 int unsigned, f2 varchar(255))");
|
||||||
|
myquery(rc);
|
||||||
|
rc= mysql_query(mysql, "insert into t1 values (1,repeat('a',255)),"
|
||||||
|
"(2,repeat('b',255))");
|
||||||
|
myquery(rc);
|
||||||
|
stmt= mysql_stmt_init(mysql);
|
||||||
|
stmt_text= "select f2,group_concat(f1) from t1 group by f2";
|
||||||
|
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
|
||||||
|
myquery(rc);
|
||||||
|
res= mysql_stmt_result_metadata(stmt);
|
||||||
|
field= mysql_fetch_fields(res);
|
||||||
|
if (!opt_silent)
|
||||||
|
printf("GROUP_CONCAT() result type %i", field[1].type);
|
||||||
|
DIE_UNLESS(field[1].type == MYSQL_TYPE_BLOB);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "drop table t1");
|
||||||
|
myquery(rc);
|
||||||
|
}/*
|
||||||
Read and parse arguments and MySQL options from my.cnf
|
Read and parse arguments and MySQL options from my.cnf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -15104,6 +15138,7 @@ static struct my_tests_st my_tests[]= {
|
|||||||
{ "test_bug16143", test_bug16143 },
|
{ "test_bug16143", test_bug16143 },
|
||||||
{ "test_bug16144", test_bug16144 },
|
{ "test_bug16144", test_bug16144 },
|
||||||
{ "test_bug15613", test_bug15613 },
|
{ "test_bug15613", test_bug15613 },
|
||||||
|
{ "test_bug14169", test_bug14169 },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user