SQL set value with bindings
Ernesto Giannotta
erne at apimac.com
Mon Jul 18 05:00:54 CDT 2011
Hello Ruslan,
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?
Cool Runnings,
Erne.
More information about the Valentina
mailing list