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_IMPL_H
17 #define DATABASE_MANAGER_IMPL_H
19 #include<CatalogTables.h>
21 #include<DatabaseManager.h>
30 class TransactionManager
;
33 class DatabaseManagerImpl
: public DatabaseManager
36 Database
* systemDatabase_
;
37 //pointer to system Database
44 TransactionManager
*tMgr_
;
46 //only SessionImpl creates object of this class
47 DatabaseManagerImpl() { systemDatabase_
= NULL
; tMgr_
= NULL
; lMgr_
= NULL
; db_
= NULL
; }
48 ~DatabaseManagerImpl();
50 DbRetVal
openSystemDatabase();
51 DbRetVal
closeSystemDatabase();
52 ChunkIterator
getSystemTableIterator(CatalogTableID id
);
53 Chunk
* getSystemTableChunk(CatalogTableID id
);
55 void createLockManager();
56 void createTransactionManager();
58 Chunk
* createUserChunk(size_t size
= 0);
59 DbRetVal
deleteUserChunk(Chunk
*chunk
);
62 DbRetVal
createHashIndex(const char *indName
, const char *tableName
,
63 FieldNameList
&fldList
, int bucketSize
);
64 void initHashBuckets(Bucket
*buck
, int bucketSize
);
69 Database
* db() { return db_
; }
70 Database
* sysDb() { return systemDatabase_
; }
71 void setSysDb(Database
*db
) { systemDatabase_
= db
; }
72 void setDb(Database
*db
) { db_
= db
; }
74 TransactionManager
* txnMgr() { return tMgr_
; }
75 LockManager
* lockMgr() { return lMgr_
; }
77 //for user database file there is no limit for the number
79 DbRetVal
createDatabase(const char *name
, size_t size
);
80 DbRetVal
deleteDatabase(const char *name
);
82 DbRetVal
openDatabase(const char *name
);
87 DbRetVal
createTable(const char *name
, TableDef
&def
);
88 DbRetVal
dropTable(const char *name
);
89 Table
* openTable(const char *name
);
90 void closeTable(Table
*table
);
91 DbRetVal
createIndex(const char *indName
, IndexInitInfo
*info
);
92 DbRetVal
dropIndex(const char *name
);
95 friend class SessionImpl
;