summaryrefslogtreecommitdiff
path: root/storage/ibmdb2i
diff options
context:
space:
mode:
authorNarayanan V <v.narayanan@sun.com>2009-05-05 15:03:52 +0530
committerNarayanan V <v.narayanan@sun.com>2009-05-05 15:03:52 +0530
commitfdce101978cbf17481ad6b0b074776c62aee1d0b (patch)
tree627355a1675b485a2e08072aba1c30e274e1443b /storage/ibmdb2i
parent0df00705495937111ef20fa5050e90ca1e223ca3 (diff)
downloadmariadb-git-fdce101978cbf17481ad6b0b074776c62aee1d0b.tar.gz
Bug#44232 Error msg should be improved when collation not supported.
When a user selected an unsupported character set for an IBMDB2I table, error 2501 or 2511 may have been returned, giving the appearance of an internal programming error. This patch consolidates these errors into a single descriptive error message for the common case of an unsupported character set. The new error number is 2504 and indicates a user error. The errors 2501 and 2511 remain to indicate cases of internal programming errors. storage/ibmdb2i/db2i_charsetSupport.cc: Bug#44232 Error msg should be improved when collation not supported. consolidate errors 2501 and 2511 into a single descriptive error message for the common case of an unsupported character set. storage/ibmdb2i/db2i_conversion.cc: Bug#44232 Error msg should be improved when collation not supported. consolidate errors 2501 and 2511 into a single descriptive error message for the common case of an unsupported character set. storage/ibmdb2i/db2i_errors.cc: Bug#44232 Error msg should be improved when collation not supported. consolidate errors 2501 and 2511 into a single descriptive error message for the common case of an unsupported character set. storage/ibmdb2i/db2i_errors.h: Bug#44232 Error msg should be improved when collation not supported. consolidate errors 2501 and 2511 into a single descriptive error message for the common case of an unsupported character set.
Diffstat (limited to 'storage/ibmdb2i')
-rw-r--r--storage/ibmdb2i/db2i_charsetSupport.cc50
-rw-r--r--storage/ibmdb2i/db2i_conversion.cc9
-rw-r--r--storage/ibmdb2i/db2i_errors.cc2
-rw-r--r--storage/ibmdb2i/db2i_errors.h2
4 files changed, 44 insertions, 19 deletions
diff --git a/storage/ibmdb2i/db2i_charsetSupport.cc b/storage/ibmdb2i/db2i_charsetSupport.cc
index 2609d42887e..559b526b7fd 100644
--- a/storage/ibmdb2i/db2i_charsetSupport.cc
+++ b/storage/ibmdb2i/db2i_charsetSupport.cc
@@ -268,8 +268,15 @@ static int32 getNewTextDesc(const int32 inType,
RESULT_INT32);
if (unlikely(arguments->base.result.s_int32.r_int32 < 0))
{
- getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
- DBUG_RETURN(DB2I_ERR_ILECALL);
+ if (arguments->base.result.s_int32.r_int32 == Qlg_InDescriptorNotFound)
+ {
+ DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
+ }
+ else
+ {
+ getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
+ DBUG_RETURN(DB2I_ERR_ILECALL);
+ }
}
// Store the conversion information into a cache entry
@@ -428,8 +435,13 @@ int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid)
int aixEncodingScheme;
int db2EncodingScheme;
rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString);
- if (rc != 0)
+ if (unlikely(rc))
+ {
+ if (rc == DB2I_ERR_UNSUPP_CHARSET)
+ getErrTxt(DB2I_ERR_UNSUPP_CHARSET, parmIANADesc);
+
return rc;
+ }
aixCcsid = atoi(aixCcsidString);
rc = getEncodingScheme(aixCcsid, aixEncodingScheme);
if (rc != 0)
@@ -646,32 +658,38 @@ static int32 openNewConversion(enum_conversionDirection direction,
there equivalent iconv descriptions.
*/
rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc);
- if (rc)
+ if (unlikely(rc))
+ {
+ if (rc == DB2I_ERR_UNSUPP_CHARSET)
+ getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+
DBUG_RETURN(rc);
+ }
CHARSET_INFO *cs= &my_charset_bin;
(uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID);
rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc);
- if (rc)
- DBUG_RETURN(rc);
+ if (unlikely(rc))
+ {
+ if (rc == DB2I_ERR_UNSUPP_CHARSET)
+ getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+
+ DBUG_RETURN(rc);
+ }
/* Call iconv to open the conversion. */
if (direction == toDB2)
{
newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc);
- if (newConversion == (iconv_t) -1)
- {
- getErrTxt(DB2I_ERR_ICONV_OPEN, mysqlAix41Desc, db2Aix41Desc, errno);
- DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
- }
}
else
{
newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc);
- if (newConversion == (iconv_t) -1)
- {
- getErrTxt(DB2I_ERR_ICONV_OPEN, db2Aix41Desc, mysqlAix41Desc, errno);
- DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
- }
+ }
+
+ if (unlikely(newConversion == (iconv_t) -1))
+ {
+ getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+ DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
}
/* Insert the new conversion into the cache. */
diff --git a/storage/ibmdb2i/db2i_conversion.cc b/storage/ibmdb2i/db2i_conversion.cc
index f746be6ab50..bdb8085d937 100644
--- a/storage/ibmdb2i/db2i_conversion.cc
+++ b/storage/ibmdb2i/db2i_conversion.cc
@@ -151,7 +151,7 @@ int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction,
if (unlikely(conversion == (iconv_t)(-1)))
{
- return (DB2I_ERR_ICONV_OPEN);
+ return (DB2I_ERR_UNSUPP_CHARSET);
}
size_t initOLen= olen;
@@ -670,6 +670,13 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
if (rtnCode)
return rtnCode;
}
+
+ // Check whether there is a character conversion available.
+ iconv_t temp;
+ int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
+ if (unlikely(rc))
+ return rc;
+
sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid);
mapping.append(stringBuildBuffer);
}
diff --git a/storage/ibmdb2i/db2i_errors.cc b/storage/ibmdb2i/db2i_errors.cc
index 43dd539447f..dd50e40e61b 100644
--- a/storage/ibmdb2i/db2i_errors.cc
+++ b/storage/ibmdb2i/db2i_errors.cc
@@ -52,7 +52,7 @@ static const char* engineErrors[MAX_MSGSTRING] =
{"Error opening codeset conversion from %.64s to %.64s (errno = %d)"},
{"Invalid %-.10s name '%-.128s'"},
{"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"},
- {"Unsupported schema '%-.128s' specified on RENAME TABLE statement"},
+ {"The %-.64s character set is not supported."},
{"Auto_increment is not allowed for a partitioned table"},
{"Character set conversion error due to unknown encoding scheme %d"},
{""},
diff --git a/storage/ibmdb2i/db2i_errors.h b/storage/ibmdb2i/db2i_errors.h
index 0f6fbef33f6..b6dd314ef50 100644
--- a/storage/ibmdb2i/db2i_errors.h
+++ b/storage/ibmdb2i/db2i_errors.h
@@ -54,7 +54,7 @@ enum DB2I_errors
DB2I_ERR_ICONV_OPEN,
DB2I_ERR_INVALID_NAME,
DB2I_ERR_RENAME_MOVE,
- DB2I_ERR_RENAME_QTEMP,
+ DB2I_ERR_UNSUPP_CHARSET,
DB2I_ERR_PART_AUTOINC,
DB2I_ERR_UNKNOWN_ENCODING,
DB2I_ERR_RESERVED,