*** empty log message ***
[csql.git] / include / DatabaseManager.h
blob5bbea08be9987f014277e82ba48eff86674af0e7
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.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 ***************************************************************************/
16 #ifndef DATABASE_MANAGER_H
17 #define DATABASE_MANAGER_H
18 #include<Info.h>
19 #include<Util.h>
20 class Table;
21 /**
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/>
27 * <br/>
28 * Functionality: <br/>
29 * 1.Table Management (create, drop, open and close) <br/>
30 * 2.Index Management (create and drop) <br/>
31 * <br/>
34 class DllExport DatabaseManager
36 public:
37 /** creates a table in the database
38 * @param name name of the table
39 * @param def table definition
40 * @return DbRetVal
42 virtual DbRetVal createTable(const char *name, TableDef &def)=0;
44 /** deletes a table from the database
45 * @param name name of the table
46 * @return DbRetVal
48 virtual DbRetVal dropTable(const char *name)=0;
49 virtual DbRetVal renameTable(const char *oldName,const char *newName)=0;
50 virtual DbRetVal renameIndex(const char *oldName,const char *newName)=0;
51 virtual DbRetVal renameField(const char *tableName, const char *oldName, const char *newName)=0;
52 /** opens a table for processing
53 * @param name name of the table
54 * @return DbRetVal
56 virtual Table* openTable(const char *name, bool checkpkfk=true)=0;
58 /** closes the table handle passed
59 * @param table handle to the table
61 virtual void closeTable(Table *table)=0;
63 /** Returns all the tables as list
64 * @return List of table names
66 virtual List getAllTableNames(int *rv=0)=0;
68 /** creates an index on the specified table. <br/>
69 * Create appropriate derived class object of IndexInitInfo based on the type of <br/>
70 * the index created and pass it to this method.
71 * @param indName index name
72 * @param info IndexInitInfo
74 virtual DbRetVal createIndex(const char *indName, IndexInitInfo *info)=0;
76 /** deletes the index object
77 * @param name index name
79 virtual DbRetVal dropIndex(const char *name)=0;
80 virtual DbRetVal checkPoint()=0;
81 virtual DbRetVal recover()=0;
82 virtual void setCanTakeCheckPoint(bool ctcp)=0;
83 virtual bool getCanTakeCheckPoint()=0;
84 virtual DbRetVal createForeignKey(char *fkName,ForeignKeyInfo *info)=0;
85 virtual DbRetVal dropForeignKey(void *ctpr,bool trylock)=0;
86 virtual void sendSignal(int sig)=0;
87 virtual ~DatabaseManager(){ }
90 #endif