allocator fixes
[csql.git] / include / DatabaseManager.h
blobcfc88fa838ad361a98bddd03561ad6374a31faab
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 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 renameField(const char *tableName, const char *oldName, const char *newName)=0;
51 /** opens a table for processing
52 * @param name name of the table
53 * @return DbRetVal
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 DbRetVal createForeignKey(char *fkName,ForeignKeyInfo *info)=0;
82 virtual DbRetVal dropForeignKey(void *ctpr,bool trylock)=0;
83 virtual void sendSignal(int sig)=0;
84 virtual ~DatabaseManager(){ }
87 #endif