~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSMd5.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • mto: (1711.1.21 build) (1725.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: prafulla_t@users.sourceforge.net-20100806112112-7w5u0s3nx9u67nzt
Fix for Bug 586051

1. test_if_ref method which checks whether predicate is already evaluated
   due to ref/eq_ref access or not was incorrectly removing a predicate 
   that was not implicitly evaluated due to ref access (due to presence of filesort ?)
   It was field=NULL predicate.
   Such predicate should be kept and execution engine will filter out rows
   correctly. Removal of such predicate led to returning of rows which had
   NULL for join/predicate columns.
2. field COMP_OP NULL will always false for all fields except when COMP_OP
   is NULL-safe equality operator. Modified range optimizer to return zero
   row count in such cases.
   Query now does not even run. It returns zero result. As such Fix(1) is not
   required but we might hit that case in some other query (I have not tried it
   yet)
3. Fixed Field::val_str to print "NULL" for literal NULL instead of "0". It
   added lot of confusion while debugging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
#include <string.h>
56
56
 
57
57
#include "CSDefs.h"
 
58
 
58
59
#include "CSMd5.h"
59
 
#include "CSStrUtil.h"
60
60
 
61
61
#undef BYTE_ORDER       /* 1 = big-endian, -1 = little-endian, 0 = unknown */
62
62
#ifdef ARCH_IS_BIG_ENDIAN
321
321
void
322
322
CSMd5::md5_init()
323
323
{
324
 
        /* Indicates that there is no digest: */
325
 
        digest_cstr[0] = 0;
326
 
 
327
324
    md5_state.count[0] = md5_state.count[1] = 0;
328
325
    md5_state.abcd[0] = 0x67452301;
329
326
    md5_state.abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
342
339
                return;
343
340
        }
344
341
        
 
342
        
345
343
   /* Update the message length. */
346
344
    md5_state.count[1] += nbytes >> 29;
347
345
    md5_state.count[0] += nbits;
370
368
}
371
369
 
372
370
 
373
 
void CSMd5::md5_digest()
 
371
void
 
372
CSMd5::md5_digest(Md5Digest *digest)
374
373
{
375
374
    static const u_char pad[64] = {
376
375
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
389
388
    /* Append the length. */
390
389
    md5_append(data, 8);
391
390
    for (i = 0; i < 16; ++i)
392
 
                digest[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
393
 
 
394
 
        /* Generate the text version: */
395
 
        cs_bin_to_hex(MD5_CHECKSUM_STRING_SIZE, digest_cstr, MD5_CHECKSUM_SIZE, digest);
 
391
                digest->val[i] = (u_char)(md5_state.abcd[i >> 2] >> ((i & 3) << 3));
396
392
}