~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/include/data0data.ic

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mto: (1.2.1) (37.1.1 lucid-security)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: package-import@ubuntu.com-20120222223355-ku1tb4r70osci6v2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
}
230
230
 
231
231
/*********************************************************************//**
232
 
Tests if data length and content is equal for two dfields.
233
 
@return TRUE if equal */
 
232
Tests if two data fields are equal.
 
233
If len==0, tests the data length and content for equality.
 
234
If len>0, tests the first len bytes of the content for equality.
 
235
@return TRUE if both fields are NULL or if they are equal */
234
236
UNIV_INLINE
235
237
ibool
236
238
dfield_datas_are_binary_equal(
237
239
/*==========================*/
238
240
        const dfield_t* field1, /*!< in: field */
239
 
        const dfield_t* field2) /*!< in: field */
 
241
        const dfield_t* field2, /*!< in: field */
 
242
        ulint           len)    /*!< in: maximum prefix to compare,
 
243
                                or 0 to compare the whole field length */
240
244
{
241
 
        ulint   len;
242
 
 
243
 
        len = field1->len;
244
 
 
245
 
        return(len == field2->len
 
245
        ulint   len2 = len;
 
246
 
 
247
        if (field1->len == UNIV_SQL_NULL || len == 0 || field1->len < len) {
 
248
                len = field1->len;
 
249
        }
 
250
 
 
251
        if (field2->len == UNIV_SQL_NULL || len2 == 0 || field2->len < len2) {
 
252
                len2 = field2->len;
 
253
        }
 
254
 
 
255
        return(len == len2
246
256
               && (len == UNIV_SQL_NULL
247
257
                   || !memcmp(field1->data, field2->data, len)));
248
258
}