|
From: <asf...@us...> - 2011-12-30 14:46:47
|
Revision: 53800
http://firebird.svn.sourceforge.net/firebird/?rev=53800&view=rev
Author: asfernandes
Date: 2011-12-30 14:46:41 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
Make UUID_TO_CHAR2 returns lower-cased strings, as the RFC specifies.
Modified Paths:
--------------
firebird/branches/B2_5_Release/doc/sql.extensions/README.builtin_functions.txt
firebird/branches/B2_5_Release/src/jrd/SysFunction.cpp
firebird/branches/B2_5_Release/src/jrd/os/guid.h
Modified: firebird/branches/B2_5_Release/doc/sql.extensions/README.builtin_functions.txt
===================================================================
--- firebird/branches/B2_5_Release/doc/sql.extensions/README.builtin_functions.txt 2011-12-30 14:38:03 UTC (rev 53799)
+++ firebird/branches/B2_5_Release/doc/sql.extensions/README.builtin_functions.txt 2011-12-30 14:46:41 UTC (rev 53800)
@@ -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:
@@ -884,7 +884,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> )
@@ -892,7 +892,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/branches/B2_5_Release/src/jrd/SysFunction.cpp
===================================================================
--- firebird/branches/B2_5_Release/src/jrd/SysFunction.cpp 2011-12-30 14:38:03 UTC (rev 53799)
+++ firebird/branches/B2_5_Release/src/jrd/SysFunction.cpp 2011-12-30 14:46:41 UTC (rev 53800)
@@ -1444,7 +1444,7 @@
case funUuidRfc:
{
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],
@@ -3329,7 +3329,7 @@
break;
case funUuidRfc:
- 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),
Modified: firebird/branches/B2_5_Release/src/jrd/os/guid.h
===================================================================
--- firebird/branches/B2_5_Release/src/jrd/os/guid.h 2011-12-30 14:38:03 UTC (rev 53799)
+++ firebird/branches/B2_5_Release/src/jrd/os/guid.h 2011-12-30 14:46:41 UTC (rev 53800)
@@ -39,8 +39,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 FB_GUID
{
@@ -73,7 +75,7 @@
}
else
{
- 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),
@@ -96,7 +98,7 @@
else
{
USHORT bytes[16];
- sscanf(buffer, GUID_NEW_FORMAT,
+ sscanf(buffer, GUID_NEW_FORMAT_UPPER,
&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.
|