00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #pragma once
00028 #ifndef __SYSTAB_BACKUP_H__
00029 #define __SYSTAB_BACKUP_H__
00030
00031 #include "cslib/CSMutex.h"
00032
00033 #include "defs_ms.h"
00034 #include "system_table_ms.h"
00035 #include "discover_ms.h"
00036
00037 class MSBackupInfo;
00038
00039 class MSBackupTable : public MSOpenSystemTable {
00040 public:
00041 MSBackupTable(MSSystemTableShare *share, TABLE *table);
00042 ~MSBackupTable();
00043
00044 void use();
00045 void unuse();
00046 void seqScanInit();
00047 bool seqScanNext(char *buf);
00048 int getRefLen() { return sizeof(iBackupIndex);}
00049 void seqScanPos(unsigned char *pos);
00050 void seqScanRead(unsigned char *pos, char *buf);
00051
00052 void updateRow(char *old_data, char *new_data);
00053 void insertRow(char *data);
00054 void deleteRow(char *data);
00055
00056 static void startUp();
00057 static void shutDown();
00058
00059 static void transferTable(MSDatabase *from_db, MSDatabase *to_db);
00060 static CSStringBuffer *dumpTable(MSDatabase *db);
00061 static void restoreTable(MSDatabase *db, const char *data, size_t size, bool reload = true);
00062 static void removeTable(CSString *db_path);
00063
00064 static void saveTable(MSDatabase *db);
00065 static void loadTable(MSDatabase *db);
00066
00067 static const uint8_t tableID = 0X03;
00068 static const uint16_t tableVersion = 0X0001;
00069
00070 private:
00071 uint32_t iBackupIndex;
00072 };
00073
00074 #define BACKUP_TABLE_NAME "pbms_backup"
00075 extern DT_FIELD_INFO pbms_backup_info[];
00076 extern DT_KEY_INFO pbms_backup_keys[];
00077
00078 #endif // __SYSTAB_BACKUP_H__