Commit 4c638048 authored by unknown's avatar unknown

SCRUM

embedded library
some dirty places cleaned:

uint removed from mysql.h as Miguel suggested
empty_string renamed as my_empty_string to get rid of name's intersections
using embedded library


include/mysql.h:
  uint -> unsigned int
include/mysql_com.h:
  this caused warnings when not in expression
libmysqld/lib_sql.cc:
  uint -> unsigned int
sql-common/client.c:
  uint -> unsigned int
sql/item_strfunc.cc:
  empty_string -> my_empty_string
sql/mysql_priv.h:
  empty_string -> my_empty_string
sql/set_var.cc:
  empty_string -> my_empty_string
sql/sql_class.cc:
  empty_string -> my_empty_string
sql/sql_prepare.cc:
  net_flush ifdef-ed
parent 88fcf2a9
......@@ -553,10 +553,10 @@ typedef struct st_mysql_methods
unsigned long arg_length,
my_bool skip_check);
MYSQL_DATA *(STDCALL *read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields);
unsigned int fields);
MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql);
void (STDCALL *fetch_lengths)(unsigned long *to,
MYSQL_ROW column, uint field_count);
MYSQL_ROW column, unsigned int field_count);
MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql);
my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
int (STDCALL *stmt_execute)(MYSQL_STMT *stmt);
......
......@@ -245,7 +245,7 @@ my_bool net_realloc(NET *net, unsigned long length);
#ifndef EMBEDDED_LIBRARY /* To be removed by HF */
my_bool net_flush(NET *net);
#else
#define net_flush(A) ((my_bool)0)
#define net_flush(A)
#endif
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
......
......@@ -102,7 +102,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
static MYSQL_DATA * STDCALL
emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)),
uint fields __attribute__((unused)))
unsigned int fields __attribute__((unused)))
{
MYSQL_DATA *result= ((THD*)mysql->thd)->data;
if (!result)
......@@ -154,7 +154,7 @@ static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
else the lengths are calculated from the offset between pointers.
**************************************************************************/
static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
{
MYSQL_ROW end;
......
......@@ -1008,7 +1008,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
else the lengths are calculated from the offset between pointers.
**************************************************************************/
static void STDCALL cli_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count)
static void STDCALL cli_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
{
ulong *prev_length;
byte *start=0;
......@@ -1140,7 +1140,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* Read all rows (fields or data) from server */
MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields)
unsigned int fields)
{
uint field;
ulong pkt_len;
......
......@@ -34,7 +34,7 @@
#include "sha1.h"
#include "my_aes.h"
String empty_string("",default_charset_info);
String my_empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
{
......@@ -359,7 +359,7 @@ String *Item_func_des_encrypt::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if ((res_length=res->length()) == 0)
return &empty_string;
return &my_empty_string;
if (arg_count == 1)
{
......@@ -520,7 +520,7 @@ String *Item_func_concat_ws::val_str(String *str)
if ((res= args[i]->val_str(str)))
break;
if (i == arg_count)
return &empty_string;
return &my_empty_string;
for (i++; i < arg_count ; i++)
{
......@@ -661,7 +661,7 @@ String *Item_func_reverse::val_str(String *str)
return 0;
/* An empty string is a special case as the string pointer may be null */
if (!res->length())
return &empty_string;
return &my_empty_string;
res=copy_if_not_alloced(str,res,res->length());
ptr = (char *) res->ptr();
end=ptr+res->length();
......@@ -914,7 +914,7 @@ String *Item_func_left::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (length <= 0)
return &empty_string;
return &my_empty_string;
length= res->charpos(length);
if (res->length() > (ulong) length)
{ // Safe even if const arg
......@@ -958,7 +958,7 @@ String *Item_func_right::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
if (length <= 0)
return &empty_string; /* purecov: inspected */
return &my_empty_string; /* purecov: inspected */
if (res->length() <= (uint) length)
return res; /* purecov: inspected */
......@@ -991,7 +991,7 @@ String *Item_func_substr::val_str(String *str)
start=res->charpos(start);
length=res->charpos(length,start);
if (start < 0 || (uint) start+1 > res->length() || length <= 0)
return &empty_string;
return &my_empty_string;
tmp_length=(int32) res->length()-start;
length=min(length,tmp_length);
......@@ -1051,7 +1051,7 @@ String *Item_func_substr_index::val_str(String *str)
null_value=0;
uint delimeter_length=delimeter->length();
if (!res->length() || !delimeter_length || !count)
return &empty_string; // Wrong parameters
return &my_empty_string; // Wrong parameters
res->set_charset(collation.collation);
......@@ -1335,7 +1335,7 @@ String *Item_func_password::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (res->length() == 0)
return &empty_string;
return &my_empty_string;
make_scrambled_password(tmp_value, res->c_ptr());
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, res->charset());
return str;
......@@ -1357,7 +1357,7 @@ String *Item_func_old_password::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (res->length() == 0)
return &empty_string;
return &my_empty_string;
make_scrambled_password_323(tmp_value, res->c_ptr());
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, res->charset());
return str;
......@@ -1383,7 +1383,7 @@ String *Item_func_encrypt::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0;
if (res->length() == 0)
return &empty_string;
return &my_empty_string;
if (arg_count == 1)
{ // generate random salt
......@@ -1473,7 +1473,7 @@ String *Item_func_user::val_str(String *str)
// For system threads (e.g. replication SQL thread) user may be empty
if (!thd->user)
return &empty_string;
return &my_empty_string;
res_length= (strlen(thd->user)+strlen(host)+2) * cs->mbmaxlen;
if (str->alloc(res_length))
......@@ -1536,7 +1536,7 @@ String *Item_func_soundex::val_str(String *str)
while (from != end && my_isspace(cs,*from)) // Skip pre-space
from++; /* purecov: inspected */
if (from == end)
return &empty_string; // No alpha characters.
return &my_empty_string; // No alpha characters.
*to++ = my_toupper(cs,*from); // Copy first letter
last_ch = get_scode(cs,from); // code of the first letter
// for the first 'double-letter check.
......@@ -1718,7 +1718,7 @@ String *Item_func_make_set::val_str(String *str)
ulonglong bits;
bool first_found=0;
Item **ptr=args;
String *result=&empty_string;
String *result=&my_empty_string;
bits=item->val_int();
if ((null_value=item->null_value))
......@@ -1742,7 +1742,7 @@ String *Item_func_make_set::val_str(String *str)
else
{
if (tmp_str.copy(*res)) // Don't use 'str'
return &empty_string;
return &my_empty_string;
result= &tmp_str;
}
}
......@@ -1752,11 +1752,11 @@ String *Item_func_make_set::val_str(String *str)
{ // Copy data to tmp_str
if (tmp_str.alloc(result->length()+res->length()+1) ||
tmp_str.copy(*result))
return &empty_string;
return &my_empty_string;
result= &tmp_str;
}
if (tmp_str.append(',') || tmp_str.append(*res))
return &empty_string;
return &my_empty_string;
}
}
}
......@@ -1853,7 +1853,7 @@ String *Item_func_repeat::val_str(String *str)
goto err; // string and/or delim are null
null_value=0;
if (count <= 0) // For nicer SQL code
return &empty_string;
return &my_empty_string;
if (count == 1) // To avoid reallocs
return res;
length=res->length();
......@@ -2050,7 +2050,7 @@ String *Item_func_conv::val_str(String *str)
dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
ptr= longlong2str(dec,ans,to_base);
if (str->copy(ans,(uint32) (ptr-ans), default_charset()))
return &empty_string;
return &my_empty_string;
return str;
}
......@@ -2240,7 +2240,7 @@ String *Item_func_hex::val_str(String *str)
return 0;
ptr= longlong2str(dec,ans,16);
if (str->copy(ans,(uint32) (ptr-ans),default_charset()))
return &empty_string; // End of memory
return &my_empty_string; // End of memory
return str;
}
......
......@@ -795,7 +795,7 @@ extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches;
extern MY_BITMAP temp_pool;
extern DATE_FORMAT dayord;
extern String empty_string;
extern String my_empty_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
extern struct show_table_type_st table_type_vars[];
extern SHOW_COMP_OPTION have_isam;
......
......@@ -1302,7 +1302,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
String str(buff,sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str)))
res= &empty_string;
res= &my_empty_string;
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{
......
......@@ -583,7 +583,7 @@ sql_exchange::sql_exchange(char *name,bool flag)
:file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0)
{
field_term= &default_field_term;
enclosed= line_start= &empty_string;
enclosed= line_start= &my_empty_string;
line_term= &default_line_term;
escaped= &default_escaped;
}
......
......@@ -668,7 +668,9 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
DBUG_RETURN(1);
if (send_prep_stmt(stmt, fields.elements) ||
thd->protocol_simple.send_fields(&fields, 0) ||
#ifndef EMBEDDED_LIBRARY
net_flush(&thd->net) ||
#endif
send_item_params(stmt))
DBUG_RETURN(1);
join->cleanup();
......
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