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
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--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"
|
||||
|
||||
|
@ -1116,6 +1116,13 @@ public:
|
||||
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
||||
const char *func_name() const { return "group_concat"; }
|
||||
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();
|
||||
bool add();
|
||||
void reset_field() { DBUG_ASSERT(0); } // not used
|
||||
|
@ -229,8 +229,12 @@ static int net_data_is_ready(my_socket sd)
|
||||
struct timeval tv;
|
||||
int res;
|
||||
|
||||
#ifndef __WIN__
|
||||
/* Windows uses an _array_ of 64 fd's as default, so it's safe */
|
||||
if (sd >= FD_SETSIZE)
|
||||
return -1;
|
||||
#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
|
||||
#endif
|
||||
|
||||
FD_ZERO(&sfds);
|
||||
FD_SET(sd, &sfds);
|
||||
@ -271,7 +275,7 @@ void net_clear(NET *net)
|
||||
int count, ready;
|
||||
DBUG_ENTER("net_clear");
|
||||
#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 */
|
||||
if ((count= vio_read(net->vio, (char*) (net->buff),
|
||||
@ -286,15 +290,27 @@ void net_clear(NET *net)
|
||||
}
|
||||
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"));
|
||||
net->error= 2;
|
||||
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
|
||||
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
|
||||
net->write_pos=net->buff;
|
||||
|
@ -1226,7 +1226,8 @@ err:
|
||||
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||
{
|
||||
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];
|
||||
HA_CREATE_INFO create;
|
||||
bool system_db= 0;
|
||||
@ -1249,6 +1250,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||
system_db= 1;
|
||||
goto end;
|
||||
}
|
||||
if (!(thd->slave_thread))
|
||||
x_free(dbname); /* purecov: inspected */
|
||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR),
|
||||
MYF(0)); /* purecov: inspected */
|
||||
@ -1257,6 +1259,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||
if (check_db_name(dbname))
|
||||
{
|
||||
my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
|
||||
if (!(thd->slave_thread))
|
||||
my_free(dbname, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -1287,6 +1290,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||
dbname);
|
||||
general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR),
|
||||
sctx->priv_user, sctx->priv_host, dbname);
|
||||
if (!(thd->slave_thread))
|
||||
my_free(dbname,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -1298,6 +1302,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
|
||||
if (my_access(path,F_OK))
|
||||
{
|
||||
my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
|
||||
if (!(thd->slave_thread))
|
||||
my_free(dbname,MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
@ -1306,6 +1311,7 @@ end:
|
||||
x_free(thd->db);
|
||||
if (dbname && dbname[0] == 0)
|
||||
{
|
||||
if (!(thd->slave_thread))
|
||||
my_free(dbname, MYF(0));
|
||||
thd->db= NULL;
|
||||
thd->db_length= 0;
|
||||
|
@ -1353,6 +1353,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
||||
}
|
||||
from+=i;
|
||||
*buf=x ^ mask;
|
||||
if (((uint32)*buf) >= powers10[intg0x+1])
|
||||
goto err;
|
||||
if (buf > to->buf || *buf != 0)
|
||||
buf++;
|
||||
else
|
||||
@ -1362,6 +1364,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
||||
{
|
||||
DBUG_ASSERT(sizeof(dec1) == 4);
|
||||
*buf=mi_sint4korr(from) ^ mask;
|
||||
if (((uint32)*buf) > DIG_MAX)
|
||||
goto err;
|
||||
if (buf > to->buf || *buf != 0)
|
||||
buf++;
|
||||
else
|
||||
@ -1372,6 +1376,8 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
||||
{
|
||||
DBUG_ASSERT(sizeof(dec1) == 4);
|
||||
*buf=mi_sint4korr(from) ^ mask;
|
||||
if (((uint32)*buf) > DIG_MAX)
|
||||
goto err;
|
||||
buf++;
|
||||
}
|
||||
if (frac0x)
|
||||
@ -1387,10 +1393,17 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
|
||||
default: DBUG_ASSERT(0);
|
||||
}
|
||||
*buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x];
|
||||
if (((uint32)*buf) > DIG_MAX)
|
||||
goto err;
|
||||
buf++;
|
||||
}
|
||||
my_afree(d_copy);
|
||||
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);
|
||||
}
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
@ -15104,6 +15138,7 @@ static struct my_tests_st my_tests[]= {
|
||||
{ "test_bug16143", test_bug16143 },
|
||||
{ "test_bug16144", test_bug16144 },
|
||||
{ "test_bug15613", test_bug15613 },
|
||||
{ "test_bug14169", test_bug14169 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user