|
From: <asf...@us...> - 2011-12-20 14:30:48
|
Revision: 53717
http://firebird.svn.sourceforge.net/firebird/?rev=53717&view=rev
Author: asfernandes
Date: 2011-12-20 14:30:41 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Fixed CORE-3238 - Makes GEN_UUID return a compliant RFC-4122 binary UUID and introduce CHAR_TO_UUID2 and UUID_TO_CHAR2 to convert UUIDs from/to string also complying with the RFC.
Modified Paths:
--------------
firebird/trunk/doc/sql.extensions/README.builtin_functions.txt
firebird/trunk/src/common/os/guid.h
firebird/trunk/src/common/os/posix/guid.cpp
firebird/trunk/src/common/os/win32/guid.cpp
firebird/trunk/src/common/sha.cpp
firebird/trunk/src/dsql/parse.y
firebird/trunk/src/jrd/RandomGenerator.cpp
firebird/trunk/src/jrd/SysFunction.cpp
firebird/trunk/src/jrd/nbak.cpp
firebird/trunk/src/jrd/trace/TraceService.cpp
firebird/trunk/src/utilities/gstat/ppg.cpp
firebird/trunk/src/utilities/nbackup/nbackup.cpp
firebird/trunk/src/yvalve/keywords.cpp
Modified: firebird/trunk/doc/sql.extensions/README.builtin_functions.txt
===================================================================
--- firebird/trunk/doc/sql.extensions/README.builtin_functions.txt 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/doc/sql.extensions/README.builtin_functions.txt 2011-12-20 14:30:41 UTC (rev 53717)
@@ -246,12 +246,38 @@
Format:
CHAR_TO_UUID( <string> )
+Notes:
+ If you have not used this function before, its usage is discouraged. CHAR_TO_UUID2 superseds it.
+
Example:
select char_to_uuid('93519227-8D50-4E47-81AA-8F6678C096A1') from rdb$database;
-See also: GEN_UUID and UUID_TO_CHAR
+See also: GEN_UUID, CHAR_TO_UUID2, UUID_TO_CHAR and UUID_TO_CHAR2
+-------------
+CHAR_TO_UUID2
+-------------
+
+Function:
+ Converts the CHAR(32) ASCII representation of an UUID
+ (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) to the CHAR(16) OCTETS
+ representation (optimized for storage).
+
+Format:
+ CHAR_TO_UUID2( <string> )
+
+Notes:
+ This function superseds CHAR_TO_UUID. The difference between them is that CHAR_TO_UUID does a
+ byte-by-byte conversion of the ASCII string to the OCTETS one, while CHAR_TO_UUID2 converts
+ a RFC-4122 compliant ASCII UUID to a compliant OCTETS string.
+
+Example:
+ select char_to_uuid2('93519227-8D50-4E47-81AA-8F6678C096A1') from rdb$database;
+
+See also: GEN_UUID, UUID_TO_CHAR2
+
+
---
COS
---
@@ -405,10 +431,17 @@
Format:
GEN_UUID()
+Notes:
+ In Firebird 2.5.0 and 2.5.1, GEN_UUID was returning completely random strings. This is not
+ compliant with the RFC-4122 (UUID specification).
+ In Firebird 2.5.2 and 3.0 this was fixed. Now GEN_UUID returns a compliant UUID version 4
+ string, where some bits are reserved and the others are random. The string format of a compliant
+ UUID is XXXXXXXX-XXXX-4XXX-YXXX-XXXXXXXXXXXX, where 4 is fixed (version) and Y is 8, 9, A or B.
+
Example:
insert into records (id) value (gen_uuid());
-See also: CHAR_TO_UUID and UUID_TO_CHAR
+See also: CHAR_TO_UUID, UUID_TO_CHAR, CHAR_TO_UUID2, UUID_TO_CHAR2
----
@@ -840,7 +873,32 @@
Format:
UUID_TO_CHAR( <string> )
+Notes:
+ If you have not used this function before, its usage is discouraged. UUID_TO_CHAR2 superseds it.
+
Example:
select uuid_to_char(gen_uuid()) from rdb$database;
-See also: GEN_UUID and CHAR_TO_UUID
+See also: GEN_UUID, UUID_TO_CHAR2, CHAR_TO_UUID and CHAR_TO_UUID2
+
+
+-------------
+UUID_TO_CHAR2
+-------------
+
+Function:
+ Converts a CHAR(16) OCTETS UUID (that's returned by GEN_UUID) to the
+ CHAR(32) ASCII representation (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX).
+
+Format:
+ UUID_TO_CHAR2( <string> )
+
+Notes:
+ This function superseds 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.
+
+Example:
+ select uuid_to_char2(gen_uuid()) from rdb$database;
+
+See also: GEN_UUID, CHAR_TO_UUID2
Modified: firebird/trunk/src/common/os/guid.h
===================================================================
--- firebird/trunk/src/common/os/guid.h 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/common/os/guid.h 2011-12-20 14:30:41 UTC (rev 53717)
@@ -22,18 +22,19 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
+ * Adriano dos Santos Fernandes
*
- *
- *
*/
-#ifndef GUID_H
-#define GUID_H
+#ifndef FB_GUID_H
+#define FB_GUID_H
#include <stdlib.h>
#include <stdio.h>
#include "fb_types.h"
+namespace Firebird {
+
const int GUID_BUFF_SIZE = 39;
const int GUID_BODY_SIZE = 36;
@@ -42,41 +43,73 @@
const char* const GUID_NEW_FORMAT =
"{%02hX%02hX%02hX%02hX-%02hX%02hX-%02hX%02hX-%02hX%02hX-%02hX%02hX%02hX%02hX%02hX%02hX}";
-struct FB_GUID
+struct Guid
{
- USHORT data[8];
+ enum Style
+ {
+ STYLE_NBACKUP, // Format introduced with nbackup
+ STYLE_BROKEN, // Format introduced in FB 2.5.0
+ STYLE_UUID // Format as defined in the RFC-4122.
+ };
+
+ union
+ {
+ USHORT data[8];
+
+ struct // Compatible with Win32 GUID struct layout.
+ {
+ ULONG data1;
+ USHORT data2;
+ USHORT data3;
+ UCHAR data4[8];
+ };
+ };
};
void GenerateRandomBytes(void* buffer, size_t size);
-void GenerateGuid(FB_GUID* guid);
+void GenerateGuid(Guid* guid);
// These functions receive buffers of at least GUID_BUFF_SIZE length
-inline void GuidToString(char* buffer, const FB_GUID* guid, bool legacy)
+inline void GuidToString(char* buffer, const Guid* guid, Guid::Style style)
{
- if (legacy) // nbackup guid
+ switch (style)
{
- sprintf(buffer, GUID_LEGACY_FORMAT,
- guid->data[0], guid->data[1], guid->data[2], guid->data[3],
- guid->data[4], guid->data[5], guid->data[6], guid->data[7]);
+ case Guid::STYLE_NBACKUP:
+ sprintf(buffer, GUID_LEGACY_FORMAT,
+ guid->data[0], guid->data[1], guid->data[2], guid->data[3],
+ guid->data[4], guid->data[5], guid->data[6], guid->data[7]);
+ break;
+
+ case Guid::STYLE_BROKEN:
+ sprintf(buffer, GUID_NEW_FORMAT,
+ 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),
+ USHORT(guid->data[3] & 0xFF), USHORT(guid->data[3] >> 8),
+ USHORT(guid->data[4] & 0xFF), USHORT(guid->data[4] >> 8),
+ USHORT(guid->data[5] & 0xFF), USHORT(guid->data[5] >> 8),
+ USHORT(guid->data[6] & 0xFF), USHORT(guid->data[6] >> 8),
+ USHORT(guid->data[7] & 0xFF), USHORT(guid->data[7] >> 8));
+ break;
+
+ case Guid::STYLE_UUID:
+ sprintf(buffer, GUID_NEW_FORMAT,
+ 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),
+ USHORT((guid->data3 >> 8) & 0xFF), USHORT(guid->data3 & 0xFF),
+ USHORT(guid->data4[0]), USHORT(guid->data4[1]),
+ USHORT(guid->data4[2]), USHORT(guid->data4[3]),
+ USHORT(guid->data4[4]), USHORT(guid->data4[5]),
+ USHORT(guid->data4[6]), USHORT(guid->data4[7]));
+ break;
}
- else
- {
- sprintf(buffer, GUID_NEW_FORMAT,
- 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),
- USHORT(guid->data[3] & 0xFF), USHORT(guid->data[3] >> 8),
- USHORT(guid->data[4] & 0xFF), USHORT(guid->data[4] >> 8),
- USHORT(guid->data[5] & 0xFF), USHORT(guid->data[5] >> 8),
- USHORT(guid->data[6] & 0xFF), USHORT(guid->data[6] >> 8),
- USHORT(guid->data[7] & 0xFF), USHORT(guid->data[7] >> 8));
- }
}
-inline void StringToGuid(FB_GUID* guid, const char* buffer, bool legacy)
+inline void StringToGuid(Guid* guid, const char* buffer, Guid::Style style)
{
- if (legacy) // nbackup guid
+ if (style == Guid::STYLE_NBACKUP)
{
sscanf(buffer, GUID_LEGACY_FORMAT,
&guid->data[0], &guid->data[1], &guid->data[2], &guid->data[3],
@@ -91,15 +124,34 @@
&bytes[8], &bytes[9], &bytes[10], &bytes[11],
&bytes[12], &bytes[13], &bytes[14], &bytes[15]);
- guid->data[0] = bytes[0] | (bytes[1] << 8);
- guid->data[1] = bytes[2] | (bytes[3] << 8);
- guid->data[2] = bytes[4] | (bytes[5] << 8);
- guid->data[3] = bytes[6] | (bytes[7] << 8);
- guid->data[4] = bytes[8] | (bytes[9] << 8);
- guid->data[5] = bytes[10] | (bytes[11] << 8);
- guid->data[6] = bytes[12] | (bytes[13] << 8);
- guid->data[7] = bytes[14] | (bytes[15] << 8);
+ if (style == Guid::STYLE_BROKEN)
+ {
+ guid->data[0] = bytes[0] | (bytes[1] << 8);
+ guid->data[1] = bytes[2] | (bytes[3] << 8);
+ guid->data[2] = bytes[4] | (bytes[5] << 8);
+ guid->data[3] = bytes[6] | (bytes[7] << 8);
+ guid->data[4] = bytes[8] | (bytes[9] << 8);
+ guid->data[5] = bytes[10] | (bytes[11] << 8);
+ guid->data[6] = bytes[12] | (bytes[13] << 8);
+ guid->data[7] = bytes[14] | (bytes[15] << 8);
+ }
+ else if (style == Guid::STYLE_UUID)
+ {
+ guid->data1 = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
+ guid->data2 = (bytes[4] << 8) | bytes[5];
+ guid->data3 = (bytes[6] << 8) | bytes[7];
+ guid->data4[0] = bytes[8];
+ guid->data4[1] = bytes[9];
+ guid->data4[2] = bytes[10];
+ guid->data4[3] = bytes[11];
+ guid->data4[4] = bytes[12];
+ guid->data4[5] = bytes[13];
+ guid->data4[6] = bytes[14];
+ guid->data4[7] = bytes[15];
+ }
}
}
-#endif
+} // namespace
+
+#endif // FB_GUID_H
Modified: firebird/trunk/src/common/os/posix/guid.cpp
===================================================================
--- firebird/trunk/src/common/os/posix/guid.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/common/os/posix/guid.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -37,6 +37,9 @@
#include <stdio.h>
#include <errno.h>
+namespace Firebird {
+
+
void GenerateRandomBytes(void* buffer, size_t size)
{
// do not use /dev/random because it may return lesser data than we need.
@@ -71,7 +74,12 @@
}
}
-void GenerateGuid(FB_GUID* guid)
+void GenerateGuid(Guid* guid)
{
- GenerateRandomBytes(guid, sizeof(FB_GUID));
+ GenerateRandomBytes(guid, sizeof(Guid));
+ guid->data3 = (4 << 12) | (guid->data3 & 0xFFF); // version 4
+ guid->data4[0] = 0x80 | (guid->data4[0] & 0x3F); // variant
}
+
+
+} // namespace
Modified: firebird/trunk/src/common/os/win32/guid.cpp
===================================================================
--- firebird/trunk/src/common/os/win32/guid.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/common/os/win32/guid.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -38,7 +38,9 @@
#include "../common/os/guid.h"
#include "fb_exception.h"
+namespace Firebird {
+
void GenerateRandomBytes(void* buffer, size_t size)
{
HCRYPTPROV hProv;
@@ -70,9 +72,12 @@
CryptReleaseContext(hProv, 0);
}
-void GenerateGuid(FB_GUID* guid)
+void GenerateGuid(Guid* guid)
{
const HRESULT error = CoCreateGuid((GUID*) guid);
if (!SUCCEEDED(error))
Firebird::system_call_failed::raise("CoCreateGuid", error);
}
+
+
+} // namespace
Modified: firebird/trunk/src/common/sha.cpp
===================================================================
--- firebird/trunk/src/common/sha.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/common/sha.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -398,7 +398,7 @@
void Jrd::CryptSupport::random(Firebird::string& randomValue, size_t length)
{
BinHash binRand;
- GenerateRandomBytes(binRand.getBuffer(length), length);
+ Firebird::GenerateRandomBytes(binRand.getBuffer(length), length);
base64(randomValue, binRand);
randomValue.resize(length, '$');
}
Modified: firebird/trunk/src/dsql/parse.y
===================================================================
--- firebird/trunk/src/dsql/parse.y 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/dsql/parse.y 2011-12-20 14:30:41 UTC (rev 53717)
@@ -535,6 +535,7 @@
%token <legacyNode> AUTONOMOUS
%token <legacyNode> CHAR_TO_UUID
+%token <legacyNode> CHAR_TO_UUID2
%token <legacyNode> FIRSTNAME
%token <legacyNode> GRANTED
%token <legacyNode> LASTNAME
@@ -543,6 +544,7 @@
%token <legacyNode> OS_NAME
%token <legacyNode> SIMILAR
%token <legacyNode> UUID_TO_CHAR
+%token <legacyNode> UUID_TO_CHAR2
// new execute statement
%token <legacyNode> CALLER
%token <legacyNode> COMMON
@@ -5931,6 +5933,7 @@
| BIN_XOR
| CEIL
| CHAR_TO_UUID
+ | CHAR_TO_UUID2
| COS
| COSH
| COT
@@ -5964,6 +5967,7 @@
| TANH
| TRUNC
| UUID_TO_CHAR
+ | UUID_TO_CHAR2
;
system_function_special_syntax
@@ -6499,12 +6503,14 @@
| WEEK
| AUTONOMOUS // added in FB 2.5
| CHAR_TO_UUID
+ | CHAR_TO_UUID2
| FIRSTNAME
| MIDDLENAME
| LASTNAME
| MAPPING
| OS_NAME
| UUID_TO_CHAR
+ | UUID_TO_CHAR2
| GRANTED
| CALLER // new execute statement
| COMMON
Modified: firebird/trunk/src/jrd/RandomGenerator.cpp
===================================================================
--- firebird/trunk/src/jrd/RandomGenerator.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/jrd/RandomGenerator.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -25,15 +25,15 @@
#include "../jrd/RandomGenerator.h"
#include "../common/os/guid.h"
+using namespace Firebird;
+using namespace Jrd;
-namespace Jrd {
RandomGenerator::RandomGenerator()
: bufferPos(BUFFER_SIZE)
{
}
-
void RandomGenerator::getBytes(void* p, size_t size)
{
while (size > 0)
@@ -54,6 +54,3 @@
size -= size2;
}
}
-
-} // namespace
-
Modified: firebird/trunk/src/jrd/SysFunction.cpp
===================================================================
--- firebird/trunk/src/jrd/SysFunction.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/jrd/SysFunction.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -1511,8 +1511,8 @@
buffer[38] = '\0';
memcpy(buffer + 1, data, GUID_BODY_SIZE);
- FB_GUID guid;
- StringToGuid(&guid, buffer, false);
+ Guid guid;
+ StringToGuid(&guid, buffer, (Guid::Style)(IPTR) function->misc);
dsc result;
result.makeText(16, ttype_binary, reinterpret_cast<UCHAR*>(guid.data));
@@ -2043,7 +2043,7 @@
{
fb_assert(args.getCount() == 0);
- FB_GUID guid;
+ Guid guid;
fb_assert(sizeof(guid.data) == 16);
GenerateGuid(&guid);
@@ -3611,16 +3611,16 @@
UCHAR* data;
const USHORT len = MOV_get_string(value, &data, NULL, 0);
- if (len != sizeof(FB_GUID))
+ if (len != sizeof(Guid))
{
status_exception::raise(Arg::Gds(isc_expression_eval_err) <<
Arg::Gds(isc_sysf_binuuid_wrongsize) <<
- Arg::Num(sizeof(FB_GUID)) <<
+ Arg::Num(sizeof(Guid)) <<
Arg::Str(function->name));
}
char buffer[GUID_BUFF_SIZE];
- GuidToString(buffer, reinterpret_cast<const FB_GUID*>(data), false);
+ GuidToString(buffer, reinterpret_cast<const Guid*>(data), (Guid::Style)(IPTR) function->misc);
dsc result;
result.makeText(GUID_BODY_SIZE, ttype_ascii, reinterpret_cast<UCHAR*>(buffer) + 1);
@@ -3655,7 +3655,8 @@
{"BIN_XOR", 2, -1, setParamsInteger, makeBin, evlBin, (void*) funBinXor},
{"CEIL", 1, 1, setParamsDouble, makeCeilFloor, evlCeil, NULL},
{"CEILING", 1, 1, setParamsDouble, makeCeilFloor, evlCeil, NULL},
- {"CHAR_TO_UUID", 1, 1, setParamsCharToUuid, makeUuid, evlCharToUuid, NULL},
+ {"CHAR_TO_UUID", 1, 1, setParamsCharToUuid, makeUuid, evlCharToUuid, (void*)(IPTR) Guid::STYLE_BROKEN},
+ {"CHAR_TO_UUID2", 1, 1, setParamsCharToUuid, makeUuid, evlCharToUuid, (void*)(IPTR) Guid::STYLE_UUID},
{"COS", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfCos},
{"COSH", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfCosh},
{"COT", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfCot},
@@ -3692,7 +3693,8 @@
{"TAN", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfTan},
{"TANH", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfTanh},
{"TRUNC", 1, 2, setParamsRoundTrunc, makeTrunc, evlTrunc, NULL},
- {"UUID_TO_CHAR", 1, 1, setParamsUuidToChar, makeUuidToChar, evlUuidToChar, NULL},
+ {"UUID_TO_CHAR", 1, 1, setParamsUuidToChar, makeUuidToChar, evlUuidToChar, (void*)(IPTR) Guid::STYLE_BROKEN},
+ {"UUID_TO_CHAR2", 1, 1, setParamsUuidToChar, makeUuidToChar, evlUuidToChar, (void*)(IPTR) Guid::STYLE_UUID},
{"", 0, 0, NULL, NULL, NULL, NULL}
};
Modified: firebird/trunk/src/jrd/nbak.cpp
===================================================================
--- firebird/trunk/src/jrd/nbak.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/jrd/nbak.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -298,7 +298,7 @@
if (!PIO_write(diff_file, &temp_bdb, temp_bdb.bdb_buffer, tdbb->tdbb_status_vector))
ERR_punt();
NBAK_TRACE(("Set backup state in header"));
- FB_GUID guid;
+ Guid guid;
GenerateGuid(&guid);
// Set state in database header page. All changes are written to main database file yet.
CCH_MARK_MUST_WRITE(tdbb, &window);
Modified: firebird/trunk/src/jrd/trace/TraceService.cpp
===================================================================
--- firebird/trunk/src/jrd/trace/TraceService.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/jrd/trace/TraceService.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -103,11 +103,11 @@
if (interactive)
{
- FB_GUID guid;
+ Guid guid;
GenerateGuid(&guid);
char* buff = session.ses_logfile.getBuffer(GUID_BUFF_SIZE);
- GuidToString(buff, &guid, false);
+ GuidToString(buff, &guid, Guid::STYLE_BROKEN);
session.ses_logfile.insert(0, "fb_trace.");
}
Modified: firebird/trunk/src/utilities/gstat/ppg.cpp
===================================================================
--- firebird/trunk/src/utilities/gstat/ppg.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/utilities/gstat/ppg.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -40,6 +40,7 @@
// gstat directly reads database files, therefore
using namespace Ods;
+using Firebird::Guid;
void PPG_print_header(const header_page* header, ULONG page,
bool nocreation, Firebird::UtilSvc* uSvc)
@@ -255,8 +256,8 @@
case HDR_backup_guid:
{
- char buff[GUID_BUFF_SIZE];
- GuidToString(buff, reinterpret_cast<const FB_GUID*>(p + 2), true);
+ char buff[Firebird::GUID_BUFF_SIZE];
+ Firebird::GuidToString(buff, reinterpret_cast<const Guid*>(p + 2), Guid::STYLE_NBACKUP);
uSvc->printf(false, "\tDatabase backup GUID:\t%s\n", buff);
break;
}
Modified: firebird/trunk/src/utilities/nbackup/nbackup.cpp
===================================================================
--- firebird/trunk/src/utilities/nbackup/nbackup.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/utilities/nbackup/nbackup.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -253,8 +253,8 @@
SSHORT version; // Incremental backup format version.
SSHORT level; // Backup level.
// \\\\\ ---- this is 8 bytes. should not cause alignment problems
- FB_GUID backup_guid; // GUID of this backup
- FB_GUID prev_guid; // GUID of previous level backup
+ Guid backup_guid; // GUID of this backup
+ Guid prev_guid; // GUID of previous level backup
ULONG page_size; // Size of pages in the database and backup file
// These fields are currently filled, but not used. May be used in future versions
ULONG backup_scn; // SCN of this backup
@@ -925,7 +925,7 @@
--db_size;
page_reads++;
- FB_GUID backup_guid;
+ Guid backup_guid;
bool guid_found = false;
const UCHAR* p = reinterpret_cast<Ods::header_page*>(page_buff)->hdr_data;
while (true)
@@ -933,9 +933,9 @@
switch (*p)
{
case Ods::HDR_backup_guid:
- if (p[1] != sizeof(FB_GUID))
+ if (p[1] != sizeof(Guid))
break;
- memcpy(&backup_guid, p + 2, sizeof(FB_GUID));
+ memcpy(&backup_guid, p + 2, sizeof(Guid));
guid_found = true;
break;
case Ods::HDR_difference_file:
@@ -957,7 +957,7 @@
bh.version = 1;
bh.level = level;
bh.backup_guid = backup_guid;
- StringToGuid(&bh.prev_guid, prev_guid, true);
+ StringToGuid(&bh.prev_guid, prev_guid, Guid::STYLE_NBACKUP);
bh.page_size = header->hdr_page_size;
bh.backup_scn = backup_scn;
bh.prev_scn = prev_scn;
@@ -1115,7 +1115,7 @@
in_sqlda->sqlvar[0].sqldata = (char*) &level;
in_sqlda->sqlvar[0].sqlind = &null_flag;
char temp[GUID_BUFF_SIZE];
- GuidToString(temp, &backup_guid, true);
+ GuidToString(temp, &backup_guid, Guid::STYLE_NBACKUP);
in_sqlda->sqlvar[1].sqldata = temp;
in_sqlda->sqlvar[1].sqlind = &null_flag;
in_sqlda->sqlvar[2].sqldata = (char*) &backup_scn;
@@ -1184,7 +1184,7 @@
UCHAR *page_buffer = NULL;
try {
int curLevel = 0;
- FB_GUID prev_guid;
+ Guid prev_guid;
while (true)
{
if (!filecount)
@@ -1266,7 +1266,7 @@
Arg::Num(bakheader.level) << bakname.c_str() << Arg::Num(curLevel));
}
// We may also add SCN check, but GUID check covers this case too
- if (memcmp(&bakheader.prev_guid, &prev_guid, sizeof(FB_GUID)) != 0)
+ if (memcmp(&bakheader.prev_guid, &prev_guid, sizeof(Guid)) != 0)
status_exception::raise(Arg::Gds(isc_nbackup_wrong_orderbk) << bakname.c_str());
delete_database = true;
@@ -1330,9 +1330,9 @@
switch (*p)
{
case Ods::HDR_backup_guid:
- if (p[1] != sizeof(FB_GUID))
+ if (p[1] != sizeof(Guid))
break;
- memcpy(&prev_guid, p + 2, sizeof(FB_GUID));
+ memcpy(&prev_guid, p + 2, sizeof(Guid));
guid_found = true;
break;
case Ods::HDR_difference_file:
Modified: firebird/trunk/src/yvalve/keywords.cpp
===================================================================
--- firebird/trunk/src/yvalve/keywords.cpp 2011-12-20 13:03:12 UTC (rev 53716)
+++ firebird/trunk/src/yvalve/keywords.cpp 2011-12-20 14:30:41 UTC (rev 53717)
@@ -111,6 +111,7 @@
{KW_CHAR, "CHAR", 1, false},
{CHAR_LENGTH, "CHAR_LENGTH", 2, false},
{CHAR_TO_UUID, "CHAR_TO_UUID", 2, false},
+ {CHAR_TO_UUID2, "CHAR_TO_UUID2", 2, false},
{CHARACTER, "CHARACTER", 1, false},
{CHARACTER_LENGTH, "CHARACTER_LENGTH", 2, false},
{CHECK, "CHECK", 1, false},
@@ -413,6 +414,7 @@
{USER, "USER", 1, false},
{USING, "USING", 2, false},
{UUID_TO_CHAR, "UUID_TO_CHAR", 2, false},
+ {UUID_TO_CHAR2, "UUID_TO_CHAR2", 2, false},
{KW_VALUE, "VALUE", 1, false},
{VALUES, "VALUES", 1, false},
{VARCHAR, "VARCHAR", 1, false},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|