Here's my setup:
The problem after years of this setup is that yesterday out of the blue I had a GUID clash on one of my tables on the "uniqueidentifier" column at the consolidated DB after an attempted Update-Insert from the remote. Then this morning I had another GUID clash. So now i'm starting to freak out.
My users have started to upgrade to iOS 7. Is there an issue in the way "NEWID()" is called under iOS 7? Or for what other reason could I get identical "GUID's" on 2 separate devices 1 day apart? Any help is appreciated. Thanks!
I assume these colliding GUIDs are all recently generated on iOS 7. It indeed appears that iOS 7 has broken UltraLite's code to determine the device identifier portion. This will be fixed. In the meantime we need a workaround.
Note: this defect should only affect version 12 on iOS 7. Version 16 uses an updated method for GUID generation.
I think the best immediate workaround is to explicitly insert GUIDs (as you've already wisely concluded ;) in place of NEWID() and NEWID defaults.
In addition to NSUUID, you could use CoreFoundation as follows:
UL_DECL_BINARY( 16 ) bin; CFUUIDRef uuid = CFUUIDCreate( kCFAllocatorDefault ); CFUUIDBytes rawbytes = CFUUIDGetUUIDBytes( uuid ); memcpy( bin.data, &rawbytes, 16 ); bin.len = 16; CFRelease( uuid ); prepstmt->SetParameterBinary( col, (ul_binary *)&bin );
Note that the binary representation can be inserted directly if you use the ul_binary type. This is slightly more efficient if that's a concern. uuid_generate() is also available.