summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorNarayanan V <v.narayanan@sun.com>2009-04-10 13:18:07 +0530
committerNarayanan V <v.narayanan@sun.com>2009-04-10 13:18:07 +0530
commitf286444bd5e0a494362447c6575ba5981a03da87 (patch)
tree79ba691d2d1a88c0abf9fca4e615a83ab6fa3d0e /storage
parent214bd5a121058dfb31237c5326ad28b8c5f8eea3 (diff)
downloadmariadb-git-f286444bd5e0a494362447c6575ba5981a03da87.tar.gz
Bug#44025 Some schema names longer than 8 characters not supported by IBMDB2I
On IBM i 5.4, schemas with names that are longer than 8 characters and contain digits or an underscore cannot contain IBMDB2I tables, even though this should theoritically be possible if all alpha characters are uppercase. THe current patch fixes the IBMDB2I engine to allow digits and the underscore(_) to be used in schema names longer than 8 characters on IBM i 5.4. storage/ibmdb2i/db2i_misc.h: The function which detected whether the operating system would treat a schema as an "ordinary identifier" (allowing 10 characters in the name instead of 8) did not cover all possible cases.Function was renamed and enhanced to detect all possible cases of "ordinary identifiers". storage/ibmdb2i/ha_ibmdb2i.cc: use the renamed function to cover all possible cases of ordinary identifiers.
Diffstat (limited to 'storage')
-rw-r--r--storage/ibmdb2i/db2i_misc.h10
-rw-r--r--storage/ibmdb2i/ha_ibmdb2i.cc2
2 files changed, 9 insertions, 3 deletions
diff --git a/storage/ibmdb2i/db2i_misc.h b/storage/ibmdb2i/db2i_misc.h
index 1cc3f962cfc..9e20f01208b 100644
--- a/storage/ibmdb2i/db2i_misc.h
+++ b/storage/ibmdb2i/db2i_misc.h
@@ -92,11 +92,17 @@ bool convertMySQLNameToDB2Name(const char* input,
return (o <= outlen-1);
}
-bool isUpperOrQuote(const CHARSET_INFO* cs, const char* s)
+bool isOrdinaryIdentifier(const char* s)
{
while (*s)
{
- if (my_isupper(cs, *s) || (*s == '"'))
+ if (my_isupper(system_charset_info, *s) ||
+ my_isdigit(system_charset_info, *s) ||
+ (*s == '_') ||
+ (*s == '@') ||
+ (*s == '$') ||
+ (*s == '#') ||
+ (*s == '"'))
++s;
else
return false;
diff --git a/storage/ibmdb2i/ha_ibmdb2i.cc b/storage/ibmdb2i/ha_ibmdb2i.cc
index 6c7ce12ded1..fee4a993b00 100644
--- a/storage/ibmdb2i/ha_ibmdb2i.cc
+++ b/storage/ibmdb2i/ha_ibmdb2i.cc
@@ -2122,7 +2122,7 @@ int ha_ibmdb2i::create(const char *name, TABLE *table_arg,
if (osVersion.v < 6)
{
if (strlen(libName) >
- MAX_DB2_V5R4_LIBNAME_LENGTH + (isUpperOrQuote(system_charset_info, libName) ? 2 : 0))
+ MAX_DB2_V5R4_LIBNAME_LENGTH + (isOrdinaryIdentifier(libName) ? 2 : 0))
{
getErrTxt(DB2I_ERR_TOO_LONG_SCHEMA,libName, MAX_DB2_V5R4_LIBNAME_LENGTH);
DBUG_RETURN(DB2I_ERR_TOO_LONG_SCHEMA);