diff --git a/dbcon/mysql/ha_calpont_dml.cpp b/dbcon/mysql/ha_calpont_dml.cpp index 506a2487d..946fcf657 100755 --- a/dbcon/mysql/ha_calpont_dml.cpp +++ b/dbcon/mysql/ha_calpont_dml.cpp @@ -704,6 +704,12 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_ buf = buf + ci.headerLength; // Number of bytes used for null bits. //@Bug 6122 if all columns have not null constraint, there is no information in the header char nullBits = *bufHdr++; + if (!ci.useXbit) + { + // Skip the first bit. For some reason, mysql reserves the first bit of the first byte, unless there's a varchar column in the table. + nullBits = nullBits>>1; + ++headerBit; + } while (colpos < ci.columnTypes.size()) //test bitmap for null values { uint8_t numLoop = 7; @@ -722,16 +728,10 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_ setError(current_thd, ER_INTERNAL_ERROR, errormsg); return -1; } - + //if a column has not null constraint, it will not be in the bit map if (ci.columnTypes[colpos].constraintType != CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (!ci.useXbit && (colpos == 0)) - { - // Skip the first bit. For some reason, mysql reserves the first bit of the first byte, unless there's a varchar column in the table. - nullBits = nullBits>>1; - ++headerBit; - } nullVal = nullBits & 0x01; nullBits = nullBits>>1; ++headerBit; diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index 124d7798d..bef98e714 100755 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -3397,8 +3397,8 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table) { CalpontSystemCatalog::ColType ctype = csc->colType(colrids[j].objnum); ci->columnTypes.push_back(ctype); -// if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit ) -// ci->useXbit = true; + if ((( ctype.colDataType == CalpontSystemCatalog::VARCHAR ) || ( ctype.colDataType == CalpontSystemCatalog::VARBINARY )) && !ci->useXbit ) + ci->useXbit = true; if (ctype.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) numberNotNull++; }