cancel
Showing results for 
Search instead for 
Did you mean: 

GUID Clash from Ultralite

Former Member
3,035

Here's my setup:

  • Ultralite iOS remote DB's running latest SQL Anywhere 12.0.1
  • Mobilink Server to MS Sql Consolidated Synchronization
  • Remote tables use "uniqueidentifier" for PK's to manage sync

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!

Former Member
0 Kudos

One additional note. The 2 GUID's that clashed are as follows:

99028da0-2428-11e3-8000-020000000000

4c856c90-21d5-11e3-8000-020000000000

Please notice that these GUIDS were generated from separate devices. But are looking very similar. Thanks again.

Accepted Solutions (1)

Accepted Solutions (1)

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.

Former Member
0 Kudos

Thanks Tim,

I did just confirm that the ID's are coming from iOS 7. I'm in the process of manually iterating any inserts that use "NEWID()" with the iOS GUID generator for iOS 6+:

NSString *uuid = [[NSUUID UUID] UUIDString];

Please keep us posted on a workaround for the DB generated UUID or when and EBF can be released. Thanks!

0 Kudos

I think you're on the right track for now! Slight alternatives listed above.

0 Kudos

A fix has been submitted for this, available in 12.0.1.3977 and later. I'm not sure when the EBF will be released.

Answers (0)