Skip to content

Commit 40332be

Browse files
committed
Downgrade support for v6 databases.
1 parent 4c8d0a1 commit 40332be

File tree

18 files changed

+1298
-236
lines changed

18 files changed

+1298
-236
lines changed

src/burp/BurpTasks.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,13 @@ void BackupRelationTask::initItem(BurpGlobals* tdgbl, Item& item)
532532
if (status->getState() & IStatus::STATE_ERRORS)
533533
BURP_abort(&status);
534534

535-
item.m_att->execute(&status, item.m_tra, 0, m_masterGbl->setSearchPath.c_str(),
536-
SQL_DIALECT_CURRENT, nullptr, nullptr, nullptr, nullptr);
535+
if (m_masterGbl->setSearchPath.hasData())
536+
{
537+
item.m_att->execute(&status, item.m_tra, 0, m_masterGbl->setSearchPath.c_str(),
538+
SQL_DIALECT_CURRENT, nullptr, nullptr, nullptr, nullptr);
537539

538-
fb_assert(status->isSuccess());
540+
fb_assert(status->isSuccess());
541+
}
539542
}
540543

541544
tdgbl->db_handle = item.m_att;

src/burp/backup.epp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
320320
fb_assert(false);
321321
}
322322

323+
// get schema list for v6 databases
323324
if (tdgbl->runtimeODS >= DB_VERSION_DDL14)
324325
{
325326
const char* getSchemasSql =

src/common/classes/BlrReader.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "iberror.h"
2727
#include "../common/classes/fb_string.h"
28+
#include "../common/classes/MetaString.h"
2829
#include "../common/StatusArg.h"
2930
#include "../jrd/constants.h"
3031

@@ -121,6 +122,40 @@ class BlrReader
121122
return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
122123
}
123124

125+
UCHAR parseHeader()
126+
{
127+
const auto version = getByte();
128+
129+
switch (version)
130+
{
131+
case blr_version4:
132+
case blr_version5:
133+
//case blr_version6:
134+
break;
135+
136+
default:
137+
status_exception::raise(
138+
Arg::Gds(isc_metadata_corrupt) <<
139+
Arg::Gds(isc_wroblrver2) << Arg::Num(blr_version4) << Arg::Num(blr_version5/*6*/) <<
140+
Arg::Num(version));
141+
}
142+
143+
auto code = getByte();
144+
145+
if (code == blr_flags)
146+
{
147+
while ((code = getByte()) != blr_end)
148+
{
149+
const auto len = getWord();
150+
seekForward(len);
151+
}
152+
}
153+
else
154+
seekBackward(1);
155+
156+
return version;
157+
}
158+
124159
UCHAR checkByte(UCHAR expected)
125160
{
126161
UCHAR byte = getByte();
@@ -177,6 +212,12 @@ class BlrReader
177212
name.assign(str.c_str());
178213
}
179214

215+
void skipMetaName()
216+
{
217+
MetaString name;
218+
getMetaName(name);
219+
}
220+
180221
private:
181222
const UCHAR* start;
182223
const UCHAR* end;

src/common/classes/GenericMap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ class GenericMap : public AutoStorage
299299

300300
size_t count() const { return mCount; }
301301

302+
bool hasData() const { return mCount != 0; }
303+
304+
bool isEmpty() const { return mCount == 0; }
305+
302306
Accessor accessor()
303307
{
304308
return Accessor(this);

0 commit comments

Comments
 (0)