Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - AppForge Programming » UltraLite for AppForge API Reference » ULConnection class

StopSynchronizationDelete method Next Page

StringToUUID method


Converts a universally unique identifier represented as a String in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to a Byte array of 16 bytes.

Syntax

StringToUUID(
s_uuid As String, _
buffer_16_bytes As Long _
)
Member of UltraLiteAFLib.ULConnection

Parameters

s_uuid    A Universally Unique Identifier passed in as a string. You can obtain a new string UUID using GetNewUUID.

buffer_16_bytes    A pointer to a byte array that has at least 16 elements. Use the VarPtr() function to get the pointer value.

Remarks

In a MobileVB application, it may be useful to refer to UUIDs in their string format. Consequently, the UUIDValue property on the ULColumn object converts from string to binary(16) and vice versa. The StringToUUID function is provided as an easy way to convert a MobileVB String to a Byte array. It does not reference the UltraLite database in any way.

The pointer to the buffer    The pointer to the buffer must be declared as at least16 bytes. Since Visual Basic does not provide bounds checking, memory could be overwritten if the buffer is too small. In MobileVB, use the VarPtr() function to get the pointer to the buffer. See also ULColumn.UUIDValue property.

Not needed in newer databases    In databases created before version 9.0.2, the UNIQUEIDENTIFIER data type is defined as a user-defined data type and functions are needed to convert between binary and string representations of UUID values.

In databases created using version 9.0.2 or later, the UNIQUEIDENTIFIER data type is a native data type and UltraLite carries out conversions as needed. The StringToUUID function is therefore not needed.

See also
Example

The following example converts the string form of the UUID 0a141e28-323c-4650-5a64-6e78828c96a0 to a binary array:

Dim buff(1 to 16) As Byte
conn.StringToUUID( "0a141e28-323c-4650-5a64-6e78828c96a0", VarPtr(buff(1)) )