• patg@krsna.patg.net's avatar
    WL# 2094 · 0a48c5b5
    patg@krsna.patg.net authored
    This patch contains all that my previous patch (1.1814) contained, with the addition of using cli_fetch_lengths for
    handling binary data (Bar noted this on the review of 1.1814, Guilhem suggested using cli_fetch_lenghts by 
    making available via removal of static in method definition and declaration in mysql.h, but
    Konstantin had some reservations, but he said to commit the patch using this anyway,
    and I suppose this can be discussed. I abandoned 1.1814 because Monty made a couple
    fixes to my code as well as formatting changes, and I thought it would just be easier
    to hand-edit my changes into a fresh clone and then make a patch. 
    
    The reason for using cli_fetch_lengths is so that I can correctly get the length of
    the field I am setting into the field. I was previously using 'strlen' but Bar pointed out this
    won't correctly get the length of binary data and is also less effecient. Upon testing,
    it was in fact verified that binary data in a blob table was being inserted correctly,
    but not being retrieved correctly, all due to not having the correct value for the
    field:
    
    (*field)->store(row[x], strlen(row[x]), &my_charset_bin);
    
    was changed to:
    
    (*field)->store(row[x], lengths[x], &my_charset_bin);
    
    lengths being a unsigned long pointer to the values of the field lengths from a 
    MYSQL_ROW.
    
    Since the server doesn't have the function "mysql_fetch_lengths" available, I tried 
    to use "result->lengths", but this isn't set, so I finally successfully used 
    cli_fetch_lenghts, which does give the correct lengths, and now the binary data gets
    retrieved correctly.
    
    I've also run the code through indent-ex and am using Brian's vimrc to ensure correct formatting!
    
    This code passes the entire test suite, without any errors or warning on both my 
    workstation and build.mysql.com
    0a48c5b5
federated.result 69.3 KB