Loading client/mysql.cc +2 −2 Original line number Diff line number Diff line Loading @@ -993,13 +993,13 @@ static int read_lines(bool execute_commands) unsigned long clen; do { line= my_cgets(tmpbuf.c_ptr(), tmpbuf.alloced_length(), &clen); line= my_cgets(tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen); buffer.append(line, clen); /* if we got buffer fully filled than there is a chance that something else is still in console input buffer */ } while (tmpbuf.alloced_length() <= clen + 1); } while (tmpbuf.alloced_length() <= clen); line= buffer.c_ptr(); #else /* OS2 */ buffer.length(0); Loading mysql-test/r/cast.result +12 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,18 @@ CONVERT(DATE "2004-01-22 21:45:33",BINARY(4)) select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)); CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)) 2004 select CAST(0xb3 as signed); CAST(0xb3 as signed) 179 select CAST(0x8fffffffffffffff as signed); CAST(0x8fffffffffffffff as signed) -8070450532247928833 select CAST(0xffffffffffffffff as unsigned); CAST(0xffffffffffffffff as unsigned) 18446744073709551615 select CAST(0xfffffffffffffffe as signed); CAST(0xfffffffffffffffe as signed) -2 select cast('18446744073709551616' as unsigned); cast('18446744073709551616' as unsigned) 18446744073709551615 Loading sql/opt_sum.cc +7 −7 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) WHERE t2.field IS NULL; */ if (tl->table->map & where_tables) const_result= 0; return 0; } else used_tables|= tl->table->map; Loading @@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) may be used as the real count. */ if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT) { is_exact_count= FALSE; count= 1; // ensure count != 0 } else { tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); Loading @@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) } } if (!const_result) return 0; /* Iterate through all items in the SELECT clause and replace COUNT(), MIN() and MAX() with constants (if possible). Loading Loading @@ -234,7 +234,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) } if (!count) { /* If count != 1, then we know that is_exact_count == TRUE. */ /* If count == 0, then we know that is_exact_count == TRUE. */ ((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */ } else Loading sql/sql_delete.cc +3 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ #include "ha_innodb.h" #include "sql_select.h" int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ha_rows limit, ulong options) int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ha_rows limit, ulong options) { int error; TABLE *table; Loading Loading @@ -266,6 +266,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) select_lex.table_list.first); DBUG_ENTER("mysql_prepare_delete"); thd->allow_sum_func= 0; if (setup_conds(thd, delete_table_list, conds) || setup_ftfuncs(&thd->lex->select_lex)) DBUG_RETURN(-1); Loading sql/sql_lex.cc +0 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->duplicates= DUP_ERROR; lex->ignore= 0; lex->proc_list.first= 0; thd->allow_sum_func= 0; } void lex_end(LEX *lex) Loading Loading
client/mysql.cc +2 −2 Original line number Diff line number Diff line Loading @@ -993,13 +993,13 @@ static int read_lines(bool execute_commands) unsigned long clen; do { line= my_cgets(tmpbuf.c_ptr(), tmpbuf.alloced_length(), &clen); line= my_cgets(tmpbuf.ptr(), tmpbuf.alloced_length()-1, &clen); buffer.append(line, clen); /* if we got buffer fully filled than there is a chance that something else is still in console input buffer */ } while (tmpbuf.alloced_length() <= clen + 1); } while (tmpbuf.alloced_length() <= clen); line= buffer.c_ptr(); #else /* OS2 */ buffer.length(0); Loading
mysql-test/r/cast.result +12 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,18 @@ CONVERT(DATE "2004-01-22 21:45:33",BINARY(4)) select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)); CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)) 2004 select CAST(0xb3 as signed); CAST(0xb3 as signed) 179 select CAST(0x8fffffffffffffff as signed); CAST(0x8fffffffffffffff as signed) -8070450532247928833 select CAST(0xffffffffffffffff as unsigned); CAST(0xffffffffffffffff as unsigned) 18446744073709551615 select CAST(0xfffffffffffffffe as signed); CAST(0xfffffffffffffffe as signed) -2 select cast('18446744073709551616' as unsigned); cast('18446744073709551616' as unsigned) 18446744073709551615 Loading
sql/opt_sum.cc +7 −7 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) WHERE t2.field IS NULL; */ if (tl->table->map & where_tables) const_result= 0; return 0; } else used_tables|= tl->table->map; Loading @@ -119,7 +119,10 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) may be used as the real count. */ if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT) { is_exact_count= FALSE; count= 1; // ensure count != 0 } else { tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); Loading @@ -127,9 +130,6 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) } } if (!const_result) return 0; /* Iterate through all items in the SELECT clause and replace COUNT(), MIN() and MAX() with constants (if possible). Loading Loading @@ -234,7 +234,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) } if (!count) { /* If count != 1, then we know that is_exact_count == TRUE. */ /* If count == 0, then we know that is_exact_count == TRUE. */ ((Item_sum_min*) item_sum)->clear(); /* Set to NULL. */ } else Loading
sql/sql_delete.cc +3 −2 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ #include "ha_innodb.h" #include "sql_select.h" int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ha_rows limit, ulong options) int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ha_rows limit, ulong options) { int error; TABLE *table; Loading Loading @@ -266,6 +266,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) select_lex.table_list.first); DBUG_ENTER("mysql_prepare_delete"); thd->allow_sum_func= 0; if (setup_conds(thd, delete_table_list, conds) || setup_ftfuncs(&thd->lex->select_lex)) DBUG_RETURN(-1); Loading
sql/sql_lex.cc +0 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,6 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->duplicates= DUP_ERROR; lex->ignore= 0; lex->proc_list.first= 0; thd->allow_sum_func= 0; } void lex_end(LEX *lex) Loading