1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
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. *
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. *
15 ***************************************************************************/
16 #ifndef DATABASE_MANAGER_H
17 #define DATABASE_MANAGER_H
22 * @class DatabaseManager
24 * @brief Interface for database management operations.
25 * This manages all the database objects. Currently it supports two database <br>
26 * objects namely table and index.<br/>
28 * Functionality: <br/>
29 * 1.Table Management (create, drop, open and close) <br/>
30 * 2.Index Management (create and drop) <br/>
37 /** creates a table in the database
38 * @param name name of the table
39 * @param def table definition
42 virtual DbRetVal
createTable(const char *name
, TableDef
&def
)=0;
44 /** deletes a table from the database
45 * @param name name of the table
48 virtual DbRetVal
dropTable(const char *name
)=0;
49 virtual DbRetVal
renameTable(const char *oldName
,const char *newName
)=0;
50 virtual DbRetVal
renameField(const char *tableName
, const char *oldName
, const char *newName
)=0;
51 /** opens a table for processing
52 * @param name name of the table
55 virtual Table
* openTable(const char *name
, bool checkpkfk
=true)=0;
57 /** closes the table handle passed
58 * @param table handle to the table
60 virtual void closeTable(Table
*table
)=0;
62 /** Returns all the tables as list
63 * @return List of table names
65 virtual List
getAllTableNames(int *rv
=0)=0;
67 /** creates an index on the specified table. <br/>
68 * Create appropriate derived class object of IndexInitInfo based on the type of <br/>
69 * the index created and pass it to this method.
70 * @param indName index name
71 * @param info IndexInitInfo
73 virtual DbRetVal
createIndex(const char *indName
, IndexInitInfo
*info
)=0;
75 /** deletes the index object
76 * @param name index name
78 virtual DbRetVal
dropIndex(const char *name
)=0;
79 virtual DbRetVal
checkPoint()=0;
80 virtual DbRetVal
recover()=0;
81 virtual void setCanTakeCheckPoint(bool ctcp
)=0;
82 virtual bool getCanTakeCheckPoint()=0;
83 virtual DbRetVal
createForeignKey(char *fkName
,ForeignKeyInfo
*info
)=0;
84 virtual DbRetVal
dropForeignKey(void *ctpr
,bool trylock
)=0;
85 virtual void sendSignal(int sig
)=0;
86 virtual ~DatabaseManager(){ }