Commit 5687fe36 authored by unknown's avatar unknown
Browse files

Adding a new parameter for well_formed_length to

return error. We'll use it for better warnign reporting.

parent 81125bc8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -147,7 +147,8 @@ typedef struct my_charset_handler_st
  uint    (*numchars)(struct charset_info_st *, const char *b, const char *e);
  uint    (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
  uint    (*well_formed_len)(struct charset_info_st *,
  			   const char *b,const char *e, uint nchars);
                             const char *b,const char *e,
                             uint nchars, int *error);
  uint    (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
  uint    (*numcells)(struct charset_info_st *, const char *b, const char *e);
  
@@ -341,7 +342,8 @@ int my_wildcmp_8bit(CHARSET_INFO *,
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
                             uint pos, int *error);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);


@@ -359,7 +361,8 @@ int my_wildcmp_mb(CHARSET_INFO *,
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
                           uint pos, int *error);
uint my_instr_mb(struct charset_info_st *,
                 const char *b, uint b_length,
                 const char *s, uint s_length,
+3 −1
Original line number Diff line number Diff line
@@ -354,12 +354,14 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
     *************************************************************************/
    if ((tOpType == WriteRequest)) {
      if (!tAttrInfo->m_indexOnly){
        int dummy_error;
        // invalid data can crash kernel
        if (cs != NULL &&
            (*cs->cset->well_formed_len)(cs,
                                         aValueToWrite,
                                         aValueToWrite + sizeInBytes,
                                         sizeInBytes) != sizeInBytes)
                                         sizeInBytes,
                                         &dummy_error) != sizeInBytes)
          goto equal_error4;
	Uint32 ahValue;
	Uint32 sz = totalSizeInWords;
+3 −1
Original line number Diff line number Diff line
@@ -526,6 +526,7 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
  const Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;

  CHARSET_INFO* cs = tAttrInfo->m_cs;
  int dummy_error;
  // invalid data can crash kernel
  if (cs != NULL &&
      // fast fix bug#7340
@@ -533,7 +534,8 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
     (*cs->cset->well_formed_len)(cs,
                                   aValue,
                                   aValue + sizeInBytes,
                                   sizeInBytes) != sizeInBytes) {
                                   sizeInBytes,
                                   &dummy_error) != sizeInBytes) {
    setErrorCodeAbort(744);
    return -1;
  }
+3 −1
Original line number Diff line number Diff line
@@ -226,12 +226,14 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
    if ((tOpType == InsertRequest) ||
	(tOpType == WriteRequest)) {
      if (!tAttrInfo->m_indexOnly){
        int dummy_error;
        // invalid data can crash kernel
        if (cs != NULL &&
           (*cs->cset->well_formed_len)(cs,
                                        aValueToWrite,
                                        aValueToWrite + sizeInBytes,
                                        sizeInBytes) != sizeInBytes)
                                        sizeInBytes,
                                        &dummy_error) != sizeInBytes)
          goto equal_error4;
	Uint32 ahValue;
	const Uint32 sz = totalSizeInWords;
+8 −7
Original line number Diff line number Diff line
@@ -4941,7 +4941,8 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
  copy_length= field_charset->cset->well_formed_len(field_charset,
                                                    from,from+length,
                                                    field_length/
						    field_charset->mbmaxlen);
                                                    field_charset->mbmaxlen,
                                                    &error);
  memcpy(ptr,from,copy_length);
  if (copy_length < field_length)	// Append spaces if shorter
    field_charset->cset->fill(field_charset,ptr+copy_length,
@@ -4958,7 +4959,6 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
  }
  if (error)
    set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);

  return error;
}

@@ -5579,7 +5579,8 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
    copy_length= field_charset->cset->well_formed_len(field_charset,
                                                      from,from +
                                                      min(length, copy_length),
						      copy_length);
                                                      copy_length,
                                                      &error);
    if (copy_length < length)
      error= 1;
    Field_blob::store_length(copy_length);
Loading