SQL set value with bindings

Ernesto Giannotta erne at apimac.com
Mon Jul 25 05:28:45 CDT 2011


Hi Ruslan,

I have tested this on a modified version of V4CC/Examples/SQL_way/Bind and can attach it to the Mantis report.

I have no problems with binds, only problem is how to set a NULL value.

As I said, I can safely pass a NSNull instance to a VString (forgot to check for VVarChar) but for VBlob it crashes.

I'll Mantis it ASAP (flooded in Lion fixes right now ;-)

On 22-lug-2011, at 00:57, Ruslan Zasukhin wrote:

> On 7/18/11 1:00 PM, "Ernesto Giannotta" <erne at apimac.com> wrote:
> 
> Hi Erne,
> 
> First question is: have you check
>    V4CC/Examples/SQL_way/Bind
> ?
> 
> You have problem with NULLs
> Or any binding not works for you ?
> 
> 
>> in the wiki docs this is the suggested way to set a field to NULL with binds:
>> 
>> UPDATE person SET name = :1, f2 = :2
>> 
>> binded 
>> WITH { "john", "NULL" }
>> 
>> but in V4CC when I try this:
>> 
>> NSArray* arrBind = [NSArray arrayWithObjects:@"NULL", nil];
>> [mDatabase sqlExecute:@"UPDATE person SET name = :1" bind:arrBind];
>> 
>> I of course get the "NULL" string in the name field, to get a NULL value i
>> must do:
>> 
>> NSArray* arrBind = [NSArray arrayWithObjects:[NSNull null], nil];
>> [mDatabase sqlExecute:@"UPDATE person SET name = :1" bind:arrBind];
>> 
>> so far so good, but this won't work with VBlobs...
>> 
>> NSArray* arrBind = [NSArray arrayWithObjects:[NSNull null], nil];
>> [mDatabase sqlExecute:@"UPDATE person SET blob = :1" bind:arrBind];
>> 
>> I get a crash “EXC_BAD_ACCESS” here:
>> 
>> #0 0x000e59a1 in fbl::Value_string::get_String
>> 
>> 0x000e59a1  <+0047>  movw   $0x0,(%ecx)
>> 
>> to make it work I must do without binds
>> 
>> [mDatabase sqlExecute:@"UPDATE person SET blob = NULL"];
>> 
>> Should I Mantis this?
> 
> -- 
> Best regards,
> 
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
> 
> Valentina - Joining Worlds of Information
> http://www.paradigmasoft.com
> 
> [I feel the need: the need for speed]
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list