SQL set value with bindings

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Thu Jul 21 17:57:16 CDT 2011


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]




More information about the Valentina mailing list