mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1 sql/item.h: Auto merged
This commit is contained in:
@ -1731,9 +1731,9 @@ alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
|
|||||||
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
|
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
|
||||||
select * from t1;
|
select * from t1;
|
||||||
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
|
||||||
def test t1 t1 a a 254 3 1 Y 384 0 8
|
def test t1 t1 a a 254 1 1 Y 384 0 8
|
||||||
def test t1 t1 b b 254 9 0 Y 2176 0 8
|
def test t1 t1 b b 254 3 0 Y 2176 0 8
|
||||||
def test t1 t1 c c 254 3 0 Y 384 0 8
|
def test t1 t1 c c 254 1 0 Y 384 0 8
|
||||||
a b c
|
a b c
|
||||||
Y NULL NULL
|
Y NULL NULL
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -765,7 +765,7 @@ class Item_empty_string :public Item_string
|
|||||||
public:
|
public:
|
||||||
Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) :
|
Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) :
|
||||||
Item_string("",0, cs ? cs : &my_charset_bin)
|
Item_string("",0, cs ? cs : &my_charset_bin)
|
||||||
{ name=(char*) header; max_length=length;}
|
{ name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; }
|
||||||
void make_field(Send_field *field);
|
void make_field(Send_field *field);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -549,10 +549,18 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||||||
pos= (char*) local_packet->ptr()+local_packet->length();
|
pos= (char*) local_packet->ptr()+local_packet->length();
|
||||||
*pos++= 12; // Length of packed fields
|
*pos++= 12; // Length of packed fields
|
||||||
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
|
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
|
||||||
|
{
|
||||||
|
/* No conversion */
|
||||||
int2store(pos, field.charsetnr);
|
int2store(pos, field.charsetnr);
|
||||||
|
int4store(pos+2, field.length);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
int2store(pos, thd_charset->number);
|
{
|
||||||
int4store(pos+2, field.length);
|
/* With conversion */
|
||||||
|
int2store(pos, thd_charset->number);
|
||||||
|
uint char_len= field.length / item->collation.collation->mbmaxlen;
|
||||||
|
int4store(pos+2, char_len * thd_charset->mbmaxlen);
|
||||||
|
}
|
||||||
pos[6]= field.type;
|
pos[6]= field.type;
|
||||||
int2store(pos+7,field.flags);
|
int2store(pos+7,field.flags);
|
||||||
pos[9]= (char) field.decimals;
|
pos[9]= (char) field.decimals;
|
||||||
|
@ -1101,7 +1101,8 @@ static void test_prepare_simple()
|
|||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
|
|
||||||
/* update */
|
/* update */
|
||||||
strmov(query, "UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?");
|
strmov(query, "UPDATE test_prepare_simple SET id=? "
|
||||||
|
"WHERE id=? AND CONVERT(name USING utf8)= ?");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -1129,7 +1130,8 @@ static void test_prepare_simple()
|
|||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
|
|
||||||
/* select */
|
/* select */
|
||||||
strmov(query, "SELECT * FROM test_prepare_simple WHERE id=? AND name= ?");
|
strmov(query, "SELECT * FROM test_prepare_simple WHERE id=? "
|
||||||
|
"AND CONVERT(name USING utf8)= ?");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -1158,7 +1160,7 @@ static void test_prepare_field_result()
|
|||||||
|
|
||||||
rc= mysql_query(mysql, "CREATE TABLE test_prepare_field_result(int_c int, "
|
rc= mysql_query(mysql, "CREATE TABLE test_prepare_field_result(int_c int, "
|
||||||
"var_c varchar(50), ts_c timestamp(14), "
|
"var_c varchar(50), ts_c timestamp(14), "
|
||||||
"char_c char(3), date_c date, extra tinyint)");
|
"char_c char(4), date_c date, extra tinyint)");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
/* insert */
|
/* insert */
|
||||||
@ -1184,8 +1186,8 @@ static void test_prepare_field_result()
|
|||||||
"t1", "test_prepare_field_result", current_db, 10, 0);
|
"t1", "test_prepare_field_result", current_db, 10, 0);
|
||||||
verify_prepare_field(result, 3, "ts_c", "ts_c", MYSQL_TYPE_TIMESTAMP,
|
verify_prepare_field(result, 3, "ts_c", "ts_c", MYSQL_TYPE_TIMESTAMP,
|
||||||
"t1", "test_prepare_field_result", current_db, 19, 0);
|
"t1", "test_prepare_field_result", current_db, 19, 0);
|
||||||
verify_prepare_field(result, 4, "char_c", "char_c", MYSQL_TYPE_STRING,
|
verify_prepare_field(result, 4, "char_c", "char_c", MYSQL_TYPE_VAR_STRING,
|
||||||
"t1", "test_prepare_field_result", current_db, 3, 0);
|
"t1", "test_prepare_field_result", current_db, 4, 0);
|
||||||
|
|
||||||
verify_field_count(result, 5);
|
verify_field_count(result, 5);
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
@ -1921,7 +1923,8 @@ static void test_select()
|
|||||||
rc= mysql_commit(mysql);
|
rc= mysql_commit(mysql);
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
strmov(query, "SELECT * FROM test_select WHERE id= ? AND name=?");
|
strmov(query, "SELECT * FROM test_select WHERE id= ? "
|
||||||
|
"AND CONVERT(name USING utf8) =?");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -1981,7 +1984,8 @@ static void test_ps_conj_select()
|
|||||||
"(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')");
|
"(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
strmov(query, "select id1, value1 from t1 where id1= ? or value1= ?");
|
strmov(query, "select id1, value1 from t1 where id1= ? or "
|
||||||
|
"CONVERT(value1 USING utf8)= ?");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -2060,7 +2064,8 @@ session_id char(9) NOT NULL, \
|
|||||||
"(\"abx\", 1, 2, 3, 2003-08-30)");
|
"(\"abx\", 1, 2, 3, 2003-08-30)");
|
||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
strmov(query, "SELECT * FROM test_select WHERE session_id= ?");
|
strmov(query, "SELECT * FROM test_select WHERE "
|
||||||
|
"CONVERT(session_id USING utf8)= ?");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -2898,7 +2903,8 @@ static void test_simple_delete()
|
|||||||
myquery(rc);
|
myquery(rc);
|
||||||
|
|
||||||
/* insert by prepare */
|
/* insert by prepare */
|
||||||
strmov(query, "DELETE FROM test_simple_delete WHERE col1= ? AND col2= ? AND col3= 100");
|
strmov(query, "DELETE FROM test_simple_delete WHERE col1= ? AND "
|
||||||
|
"CONVERT(col2 USING utf8)= ? AND col3= 100");
|
||||||
stmt= mysql_simple_prepare(mysql, query);
|
stmt= mysql_simple_prepare(mysql, query);
|
||||||
check_stmt(stmt);
|
check_stmt(stmt);
|
||||||
|
|
||||||
@ -4866,7 +4872,8 @@ static void test_multi_stmt()
|
|||||||
|
|
||||||
/* alter the table schema now */
|
/* alter the table schema now */
|
||||||
stmt1= mysql_simple_prepare(mysql, "DELETE FROM test_multi_table "
|
stmt1= mysql_simple_prepare(mysql, "DELETE FROM test_multi_table "
|
||||||
"WHERE id= ? AND name=?");
|
"WHERE id= ? AND "
|
||||||
|
"CONVERT(name USING utf8)=?");
|
||||||
check_stmt(stmt1);
|
check_stmt(stmt1);
|
||||||
|
|
||||||
verify_param_count(stmt1, 2);
|
verify_param_count(stmt1, 2);
|
||||||
@ -6632,7 +6639,7 @@ static void test_field_misc()
|
|||||||
"@@table_type", "", /* field and its org name */
|
"@@table_type", "", /* field and its org name */
|
||||||
MYSQL_TYPE_STRING, /* field type */
|
MYSQL_TYPE_STRING, /* field type */
|
||||||
"", "", /* table and its org name */
|
"", "", /* table and its org name */
|
||||||
"", type_length*3, 0); /* db name, length */
|
"", type_length, 0); /* db name, length */
|
||||||
|
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
|
Reference in New Issue
Block a user