diff options
Diffstat (limited to 'storage/ibmdb2i')
-rw-r--r-- | storage/ibmdb2i/db2i_charsetSupport.cc | 50 | ||||
-rw-r--r-- | storage/ibmdb2i/db2i_conversion.cc | 9 | ||||
-rw-r--r-- | storage/ibmdb2i/db2i_errors.cc | 2 | ||||
-rw-r--r-- | storage/ibmdb2i/db2i_errors.h | 2 |
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, |