summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorpem@mysql.com <>2006-03-28 15:08:17 +0200
committerpem@mysql.com <>2006-03-28 15:08:17 +0200
commite0a2455f1913f890dcdd6bfd5602fd63218ceca6 (patch)
treef02d71717e4d6d52bddb4c7779cd7fda6071655c /sql
parent71defb7a8020e0797cdc3b7b68c1c96adcb7a4e6 (diff)
parente51adff01c4969a36ecad010b64e47b04550648e (diff)
downloadmariadb-git-e0a2455f1913f890dcdd6bfd5602fd63218ceca6.tar.gz
Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
into mysql.com:/extern/mysql/5.0/bug17015/mysql-5.0-runtime
Diffstat (limited to 'sql')
-rw-r--r--sql/field.h6
-rw-r--r--sql/sp.cc6
2 files changed, 11 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index e8dd7f05f99..f53227e5fd6 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -320,6 +320,12 @@ public:
/* convert decimal to longlong with overflow check */
longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
int *err);
+ /* The max. number of characters */
+ inline uint32 Field::char_length() const
+ {
+ return field_length / charset()->mbmaxlen;
+ }
+
friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options,
ulonglong auto_increment_value);
diff --git a/sql/sp.cc b/sql/sp.cc
index 0446bf94e53..cfcf011032d 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -534,7 +534,11 @@ db_create_routine(THD *thd, int type, sp_head *sp)
ret= SP_GET_FIELD_FAILED;
goto done;
}
- if (sp->m_name.length > table->field[MYSQL_PROC_FIELD_NAME]->field_length)
+
+ if (system_charset_info->cset->numchars(system_charset_info,
+ sp->m_name.str,
+ sp->m_name.str+sp->m_name.length) >
+ table->field[MYSQL_PROC_FIELD_NAME]->char_length())
{
ret= SP_BAD_IDENTIFIER;
goto done;