summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-11-20 20:47:07 +0200
committerunknown <bell@sanja.is.com.ua>2005-11-20 20:47:07 +0200
commitfe63e095816a744950e3a3f6d978f074fd3fcd93 (patch)
tree178b80a009c667cc88b5c83cbe9636892d375946 /sql/sql_table.cc
parent5d425f936190057f727f73c8575fe5953cf56101 (diff)
downloadmariadb-git-fe63e095816a744950e3a3f6d978f074fd3fcd93.tar.gz
Inefficient usage of String::append() fixed.
Bad examples of usage of a string with its length fixed. The incorrect length in the trigger file configuration descriptor fixed (BUG#14090). A hook for unknown keys added to the parser to support old .TRG files. sql/field.cc: Inefficient usage of String::append() fixed. Bad examples of usage of a string with its length fixed. sql/ha_berkeley.cc: A bad example of usage of a string with its length fixed. sql/ha_federated.cc: Inefficient usage of String::append() fixed. sql/ha_myisammrg.cc: Bad examples of usage of a string with its length fixed. sql/handler.cc: Inefficient usage of String::append() fixed. sql/item.cc: Bad examples of usage of a string with its length fixed. sql/item.h: A bad example of usage of a string with its length fixed. sql/item_cmpfunc.cc: Bad examples of usage of a string with its length fixed. sql/item_func.cc: Bad examples of usage of a string with its length fixed. sql/item_strfunc.cc: Bad examples of usage of a string with its length fixed. sql/item_subselect.cc: Bad examples of usage of a string with its length fixed. sql/item_sum.cc: Bad examples of usage of a string with its length fixed. Inefficient usage of String::append() fixed. sql/item_timefunc.cc: Inefficient using of String::append() fixed. Bad examples of usage of a string with its length fixed. sql/item_uniq.h: Bad examples of usage of a string with its length fixed. sql/key.cc: Bad examples of usage of a string with its length fixed. sql/log.cc: Bad examples of usage of a string with its length fixed. sql/log_event.cc: Bad examples of usage of a string with its length fixed. sql/mysqld.cc: The dummy parser hook allocated. sql/opt_range.cc: Inefficient usage of String::append() fixed. sql/parse_file.cc: Bad examples of usage of a string with its length fixed. A hook for unknown keys added to the parser. sql/parse_file.h: A hook for unknown keys added to the parser. sql/protocol.cc: A bad example of usage of a string with its length fixed. sql/repl_failsafe.cc: Bad examples of usage of a string with its length fixed. sql/share/errmsg.txt: A warning for old format config file. sql/slave.cc: Bad examples of usage of a string with its length fixed. sql/sp.cc: Bad examples of usage of a string with its length fixed. sql/sp_head.cc: Bad examples of usage of a string with its length fixed. sql/spatial.cc: A bad example of usage of a string with its length fixed. sql/sql_acl.cc: Bad examples of usage of a string with its length fixed. sql/sql_analyse.cc: Bad examples of usage of a string with its length fixed. Inefficient usage of String::append() fixed. sql/sql_lex.cc: Bad examples of usage of a string with its length fixed. sql/sql_load.cc: A bad example of usage of a string with its length fixed. sql/sql_parse.cc: Bad examples of usage of a string with its length fixed. sql/sql_prepare.cc: A bad example of usage of a string with its length fixed. sql/sql_select.cc: Bad examples of usage of a string with its length fixed. sql/sql_show.cc: Bad examples of usage of a string with its length fixed. sql/sql_string.cc: Bad examples of usage of a string with its length fixed. sql/sql_string.h: The macro definition moved to sql_string.h to be accessible in all parts of server. sql/sql_table.cc: Bad examples of usage of a string with its length fixed. sql/sql_trigger.cc: Bad examples of usage of a string with its length fixed. The incorrect length in the trigger file configuration descriptor fixed (BUG#14090). The hook for processing incorrect sql_mode record added. sql/sql_view.cc: A dummy hook used for parsing views. sql/structs.h: The macro definition moved to sql_string.h to be accessible in all parts of server. sql/table.cc: A bad example of usage of a string with its length fixed. sql/tztime.cc: A bad example of usage of a string with its length fixed.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc52
1 files changed, 29 insertions, 23 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c0748abf333..203b80f2924 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -700,7 +700,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
MY_CS_BINSORT,MYF(0))))
{
char tmp[64];
- strmake(strmake(tmp, save_cs->csname, sizeof(tmp)-4), "_bin", 4);
+ strmake(strmake(tmp, save_cs->csname, sizeof(tmp)-4),
+ STRING_WITH_LEN("_bin"));
my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp);
DBUG_RETURN(-1);
}
@@ -1946,7 +1947,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
protocol->prepare_for_resend();
protocol->store(table->alias, system_charset_info);
protocol->store((char*) operator_name, system_charset_info);
- protocol->store("error", 5, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
protocol->store(errmsg, system_charset_info);
thd->clear_error();
if (protocol->write())
@@ -2237,7 +2238,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
- protocol->store("error",5, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
/* if it was a view will check md5 sum */
@@ -2274,7 +2275,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
- protocol->store("error", 5, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
table_name);
protocol->store(buff, length, system_charset_info);
@@ -2309,8 +2310,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
- protocol->store("warning", 7, system_charset_info);
- protocol->store("Table is marked as crashed", 26, system_charset_info);
+ protocol->store(STRING_WITH_LEN("warning"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Table is marked as crashed"),
+ system_charset_info);
if (protocol->write())
goto err;
}
@@ -2334,7 +2336,7 @@ send_result_message:
char buf[ERRMSGSIZE+20];
uint length=my_snprintf(buf, ERRMSGSIZE,
ER(ER_CHECK_NOT_IMPLEMENTED), operator_name);
- protocol->store("note", 4, system_charset_info);
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
protocol->store(buf, length, system_charset_info);
}
break;
@@ -2344,41 +2346,45 @@ send_result_message:
char buf[ERRMSGSIZE+20];
uint length= my_snprintf(buf, ERRMSGSIZE,
ER(ER_BAD_TABLE_ERROR), table_name);
- protocol->store("note", 4, system_charset_info);
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
protocol->store(buf, length, system_charset_info);
}
break;
case HA_ADMIN_OK:
- protocol->store("status", 6, system_charset_info);
- protocol->store("OK",2, system_charset_info);
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("OK"), system_charset_info);
break;
case HA_ADMIN_FAILED:
- protocol->store("status", 6, system_charset_info);
- protocol->store("Operation failed",16, system_charset_info);
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Operation failed"),
+ system_charset_info);
break;
case HA_ADMIN_REJECT:
- protocol->store("status", 6, system_charset_info);
- protocol->store("Operation need committed state",30, system_charset_info);
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Operation need committed state"),
+ system_charset_info);
open_for_modify= FALSE;
break;
case HA_ADMIN_ALREADY_DONE:
- protocol->store("status", 6, system_charset_info);
- protocol->store("Table is already up to date", 27, system_charset_info);
+ protocol->store(STRING_WITH_LEN("status"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Table is already up to date"),
+ system_charset_info);
break;
case HA_ADMIN_CORRUPT:
- protocol->store("error", 5, system_charset_info);
- protocol->store("Corrupt", 7, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Corrupt"), system_charset_info);
fatal_error=1;
break;
case HA_ADMIN_INVALID:
- protocol->store("error", 5, system_charset_info);
- protocol->store("Invalid argument",16, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ protocol->store(STRING_WITH_LEN("Invalid argument"),
+ system_charset_info);
break;
case HA_ADMIN_TRY_ALTER:
@@ -2414,7 +2420,7 @@ send_result_message:
else
{
/* Hijack the row already in-progress. */
- protocol->store("error", 5, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
protocol->store(err_msg, system_charset_info);
(void)protocol->write();
/* Start off another row for HA_ADMIN_FAILED */
@@ -2431,7 +2437,7 @@ send_result_message:
}
case HA_ADMIN_WRONG_CHECKSUM:
{
- protocol->store("note", 4, system_charset_info);
+ protocol->store(STRING_WITH_LEN("note"), system_charset_info);
protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)),
system_charset_info);
break;
@@ -2443,7 +2449,7 @@ send_result_message:
uint length=my_snprintf(buf, ERRMSGSIZE,
"Unknown - internal error %d during operation",
result_code);
- protocol->store("error", 5, system_charset_info);
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
protocol->store(buf, length, system_charset_info);
fatal_error=1;
break;