List:NDB Connectors« Previous MessageNext Message »
From:John David Duncan Date:August 22 2007 5:22pm
Subject:Re: NdbScanFilter with strings
View as plain text  
Hi guys,

I finally got it to work, at least with COND_EQ filters.

The length parameter in NdbScanFilter::cmp() is important.

For CHAR, length needs to be set to col::getLength().
For VARCHAR, it needs to be set to col::getLength() + 1.
For LONGVARCHAR, I assume (but haven't tested), it needs to be  
col::getLength() + 2.

I'll work on LIKE filters next...

JD


On Aug 20, 2007, at 7:09 AM, Frazer Clement wrote:

> I seem to recall that the passing-convention depends on the comparison
> used.
> If I remember correctly, LIKE filters don't require the preceding  
> length
> byte stuff in the passed buffer, but equality does.
> Not sure about the other inequalities.
> Keep trying all the combinations.... :)
>
>
>
>
> John David Duncan <jdd@stripped>
> 20/08/2007 02:02
>
> To
> Monty Taylor <mtaylor@stripped>
> cc
> ndb-connectors@stripped
> Subject
> Re: NdbScanFilter with strings
>
>
>
>
>
>
>> int cmpString(NdbOperation * op, BinaryCondition cond, int ColId,
>> const
>> char * anInputString, size_t len ) {
>>     const NdbDictionary::Column * theColumn =
>> op->getTable()->getColumn(ColId);
>>     char * stringVal = ndbFormatString(theColumn,anInputString,len);
>>     if (stringVal == NULL)
>>       return -1;
>>     int retval = self->cmp(cond,ColId,(void *)stringVal);
>>     free(stringVal);
>>     return retval;
>>   };
>>
>> where ndbFormatString returns the whole length-byte-string thing.
>>
>> I'm not 100% I've tested this, though. But I think I remember
>> talking to
>> Johan about it at the time...
>
>
> Yeah, I try essentially the same thing (with either CHAR or VARCHAR),
> but I always get an empty result, as if the filter does not match
> anything.
>
>
>
>
>
>
> -- 
> MySQL NDB Connectors Mailing List
> For list archives: http://lists.mysql.com/ndb-connectors
> To unsubscribe:
> http://lists.mysql.com/ndb-connectors?unsub=1
>
>
>
>
>
>
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with  
> number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire  
> PO6 3AU
>
>
>
>
>

Thread
NdbScanFilter with stringsJohn David Duncan19 Aug
  • Re: NdbScanFilter with stringsMonty Taylor19 Aug
    • Re: NdbScanFilter with stringsJohn David Duncan20 Aug
      • Re: NdbScanFilter with stringsFrazer Clement20 Aug
        • Re: NdbScanFilter with stringsJohn David Duncan22 Aug
          • Re: NdbScanFilter with stringsMonty Taylor22 Aug
            • Re: NdbScanFilter with stringsJohn David Duncan22 Aug
              • Re: NdbScanFilter with stringsMonty Taylor22 Aug
              • Re: NdbScanFilter with stringsMonty Taylor30 Aug
                • Re: NdbScanFilter with stringsJohn David Duncan30 Aug
                  • Re: NdbScanFilter with stringsMonty Taylor30 Aug