|
From: <asf...@us...> - 2011-12-30 14:38:10
|
Revision: 53799
http://firebird.svn.sourceforge.net/firebird/?rev=53799&view=rev
Author: asfernandes
Date: 2011-12-30 14:38:03 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
Make UUID_TO_CHAR2 returns lower-cased strings, as the RFC specifies?\194?\183
Modified Paths:
--------------
firebird/trunk/doc/sql.extensions/README.builtin_functions.txt
firebird/trunk/src/common/os/guid.h
Modified: firebird/trunk/doc/sql.extensions/README.builtin_functions.txt
===================================================================
--- firebird/trunk/doc/sql.extensions/README.builtin_functions.txt 2011-12-30 14:19:47 UTC (rev 53798)
+++ firebird/trunk/doc/sql.extensions/README.builtin_functions.txt 2011-12-30 14:38:03 UTC (rev 53799)
@@ -261,7 +261,7 @@
Function:
Converts the CHAR(32) ASCII representation of an UUID
- (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) to the CHAR(16) OCTETS
+ (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) to the CHAR(16) OCTETS
representation (optimized for storage).
Format:
@@ -888,7 +888,7 @@
Function:
Converts a CHAR(16) OCTETS UUID (that's returned by GEN_UUID) to the
- CHAR(32) ASCII representation (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX).
+ CHAR(32) ASCII representation (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Format:
UUID_TO_CHAR2( <string> )
@@ -896,7 +896,8 @@
Notes:
This function supersedes UUID_TO_CHAR. The difference between them is that UUID_TO_CHAR does a
byte-by-byte conversion of the OCTETS string to the ASCII one, while UUID_TO_CHAR2 converts
- a RFC-4122 compliant OCTETS UUID to a compliant ASCII string.
+ a RFC-4122 compliant OCTETS UUID to a compliant ASCII string. Also, UUID_TO_CHAR returns
+ upper-cased string and UUID_TO_CHAR2 returns lower-cased string.
Example:
select uuid_to_char2(gen_uuid()) from rdb$database;
Modified: firebird/trunk/src/common/os/guid.h
===================================================================
--- firebird/trunk/src/common/os/guid.h 2011-12-30 14:19:47 UTC (rev 53798)
+++ firebird/trunk/src/common/os/guid.h 2011-12-30 14:38:03 UTC (rev 53799)
@@ -40,8 +40,10 @@
const char* const GUID_LEGACY_FORMAT =
"{%04hX%04hX-%04hX-%04hX-%04hX-%04hX%04hX%04hX}";
-const char* const GUID_NEW_FORMAT =
+const char* const GUID_NEW_FORMAT_UPPER =
"{%02hX%02hX%02hX%02hX-%02hX%02hX-%02hX%02hX-%02hX%02hX-%02hX%02hX%02hX%02hX%02hX%02hX}";
+const char* const GUID_NEW_FORMAT_LOWER =
+ "{%02hx%02hx%02hx%02hx-%02hx%02hx-%02hx%02hx-%02hx%02hx-%02hx%02hx%02hx%02hx%02hx%02hx}";
struct Guid
{
@@ -82,7 +84,7 @@
break;
case Guid::STYLE_BROKEN:
- sprintf(buffer, GUID_NEW_FORMAT,
+ sprintf(buffer, GUID_NEW_FORMAT_UPPER,
USHORT(guid->data[0] & 0xFF), USHORT(guid->data[0] >> 8),
USHORT(guid->data[1] & 0xFF), USHORT(guid->data[1] >> 8),
USHORT(guid->data[2] & 0xFF), USHORT(guid->data[2] >> 8),
@@ -94,7 +96,7 @@
break;
case Guid::STYLE_UUID:
- sprintf(buffer, GUID_NEW_FORMAT,
+ sprintf(buffer, GUID_NEW_FORMAT_LOWER,
USHORT((guid->data1 >> 24) & 0xFF), USHORT((guid->data1 >> 16) & 0xFF),
USHORT((guid->data1 >> 8) & 0xFF), USHORT(guid->data1 & 0xFF),
USHORT((guid->data2 >> 8) & 0xFF), USHORT(guid->data2 & 0xFF),
@@ -118,7 +120,7 @@
else
{
USHORT bytes[16];
- sscanf(buffer, GUID_NEW_FORMAT,
+ sscanf(buffer, GUID_NEW_FORMAT_LOWER,
&bytes[0], &bytes[1], &bytes[2], &bytes[3],
&bytes[4], &bytes[5], &bytes[6], &bytes[7],
&bytes[8], &bytes[9], &bytes[10], &bytes[11],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|