version 2.2.0
remove deprecated members PIVariantTypes::File add "is_save" flag PIBinaryLog clear
This commit is contained in:
@@ -45,6 +45,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static const uchar binlog_sig[] = {'B','I','N','L','O','G'};
|
||||
|
||||
#define PIBINARYLOG_VERSION 0x32
|
||||
#define PIBINARYLOG_SIGNATURE_SIZE sizeof(binlog_sig)
|
||||
|
||||
REGISTER_DEVICE(PIBinaryLog)
|
||||
|
||||
PIBinaryLog::PIBinaryLog() {
|
||||
@@ -358,6 +363,11 @@ int PIBinaryLog::readBinLog(int id, void *read_to, int max_size, PISystemTime *
|
||||
}
|
||||
|
||||
|
||||
bool PIBinaryLog::isEmpty() const {
|
||||
return (log_size <= llong(PIBINARYLOG_SIGNATURE_SIZE + 1));
|
||||
}
|
||||
|
||||
|
||||
void PIBinaryLog::setHeader(const PIByteArray & header) {
|
||||
user_header = header;
|
||||
}
|
||||
@@ -414,7 +424,7 @@ void PIBinaryLog::restart() {
|
||||
|
||||
|
||||
bool PIBinaryLog::writeFileHeader() {
|
||||
if (file.write(&__S__PIBinaryLog::binlog_sig, PIBINARYLOG_SIGNATURE_SIZE) <= 0) return false;
|
||||
if (file.write(binlog_sig, PIBINARYLOG_SIGNATURE_SIZE) <= 0) return false;
|
||||
uchar version = PIBINARYLOG_VERSION;
|
||||
if (file.write(&version, 1) <= 0) return false;
|
||||
uint32_t sz = user_header.size();
|
||||
@@ -432,7 +442,7 @@ bool PIBinaryLog::checkFileHeader() {
|
||||
if (file.read(read_sig, PIBINARYLOG_SIGNATURE_SIZE) < 0) return false;
|
||||
bool correct = true;
|
||||
for (uint i=0; i<PIBINARYLOG_SIGNATURE_SIZE; i++)
|
||||
if (read_sig[i] != __S__PIBinaryLog::binlog_sig[i]) correct = false;
|
||||
if (read_sig[i] != binlog_sig[i]) correct = false;
|
||||
if (!correct) {
|
||||
piCoutObj << "BinLogFile signature is corrupted or invalid file";
|
||||
return false;
|
||||
@@ -516,7 +526,7 @@ void PIBinaryLog::parseLog(PIFile * f, PIBinaryLog::BinLogInfo * info, PIVector<
|
||||
bool ok = true;
|
||||
if (f->read(read_sig, PIBINARYLOG_SIGNATURE_SIZE) < 0) {if (ginfo) bi->records_count = -1; ok = false;}
|
||||
for (uint i=0; i<PIBINARYLOG_SIGNATURE_SIZE; i++)
|
||||
if (read_sig[i] != __S__PIBinaryLog::binlog_sig[i]) {if (ginfo) bi->records_count = -2; ok = false;}
|
||||
if (read_sig[i] != binlog_sig[i]) {if (ginfo) bi->records_count = -2; ok = false;}
|
||||
uchar read_version = 0;
|
||||
if (f->read(&read_version, 1) < 0) {if (ginfo) bi->records_count = -3; ok = false;}
|
||||
if (read_version == 0) {if (ginfo) bi->records_count = -4; ok = false;}
|
||||
|
||||
Reference in New Issue
Block a user