update or delete followed by droptable gives floating point exception
[csql.git] / include / Recover.h
blob46d377635ddfe4673bb1338203118ad195df85ec
1 /***************************************************************************
2 * Copyright (C) 2007 by Prabakaran Thirumalai *
3 * praba_tuty@yahoo.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef RECOVER_H
21 #define RECOVER_H
22 #include <AbsSqlStatement.h>
23 #include <SqlConnection.h>
24 #include <SqlStatement.h>
26 class DllExport Recovery
28 void *stmtBuckets;
30 //contains pointer to start address of the mapped redo log file
31 //used to traverse till the end of the mapping during redo log processing
32 public:
33 char *iter;
34 Recovery(){
35 stmtBuckets = NULL;
36 iter = NULL;
38 void setStmtBucket(void *ptr) { stmtBuckets = ptr; }
39 ~Recovery() {
40 //do not free stmtBuckets
43 void addToHashTable(int stmtID, AbsSqlStatement* sHdl, char *stmtstr);
44 void removeFromHashTable(int stmtID);
45 AbsSqlStatement *getStmtFromHashTable(int stmtId);
46 bool isStmtInHashTable(int stmtID);
47 void freeAllStmtHandles();
48 DbRetVal filterAndWriteStmtLogs();
49 DbRetVal readAndPopulateStmts(AbsSqlConnection *conn, bool list = false, bool interactive = false);
50 DbRetVal iterateStmtLogs(AbsSqlConnection *conn, void *startAddr, int size, bool list=false, bool interactive = false);
52 int applyRedoLogs(char *redoFile, AbsSqlConnection *conn, bool list = false, bool interactive = false);
54 #if (defined MMDB && defined EMBED)
55 DbRetVal recoverCsqlDB();
56 DbRetVal recoverSystemAndUserDB();
57 DbRetVal applySchemaFile(FILE *fp);
58 char getQueryFromSchemaFile(FILE *fp, char *buf);
59 #endif
61 private:
62 //before calling below 4 handleXXX methods, iter should be set
63 DbRetVal handlePrepare( AbsSqlConnection *conn, bool list=false, bool interactive = false);
64 DbRetVal handleCommit(AbsSqlConnection *conn, void *startAddr, long size, bool list=false, bool interactive = false);
65 DbRetVal handleFree(bool list=false, bool interactive = false);
66 DbRetVal handlePrepareAndExecute(AbsSqlConnection *conn, bool list=false, bool interactive = false);
69 #endif