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 ***************************************************************************/
22 //All the members of the configuration file
29 char logFile
[MAX_FILE_PATH_LEN
];
30 char dbFile
[MAX_FILE_PATH_LEN
];
41 char dsn
[IDENTIFIER_LENGTH
];
42 char tableConfigFile
[MAX_FILE_PATH_LEN
];
53 int nwResponseTimeout
;
60 maxSysSize
= 10485760;
61 maxDbSize
= 104857600;
64 strcpy(logFile
, "/tmp/log/log.out");
65 strcpy(dbFile
, "/tmp/csql/csql.db");
76 strcpy(dsn
, "myodbc3");
77 strcpy(tableConfigFile
, "/tmp/csql/csqltable.conf");
78 isCsqlSqlServer
= false;
80 logStoreSize
= 10485760;
93 int readLine(FILE *fp
, char * buffer
);
94 int storeKeyVal(char *key
, char *val
);
98 int readAllValues(char *filename
);
100 inline int getPageSize() { return cVal
.pageSize
; }
101 inline int getMaxProcs() { return cVal
.maxProcs
; }
102 inline long getMaxSysDbSize() { return cVal
.maxSysSize
; }
103 inline long getMaxDbSize() { return cVal
.maxDbSize
; }
104 inline int getSysDbKey() { return cVal
.sysDbKey
; }
105 inline int getUserDbKey() { return cVal
.userDbKey
; }
106 inline char* getLogFile() { return cVal
.logFile
; }
107 inline char* getDbFile() { return cVal
.dbFile
; }
108 inline long getMapAddress() { return cVal
.mapAddr
; }
109 inline int getMutexSecs() { return cVal
.mutexSecs
; }
110 inline int getMutexUSecs() { return cVal
.mutexUSecs
; }
111 inline int getMutexRetries() { return cVal
.mutexRetries
; }
112 inline int getLockSecs() { return cVal
.lockSecs
; }
113 inline int getLockUSecs() { return cVal
.lockUSecs
; }
114 inline int getLockRetries() { return cVal
.lockRetries
; }
115 inline int getCacheID(){ return cVal
.cacheId
;}
116 inline bool useCache() { return cVal
.isCache
; }
117 inline char* getDSN() { return cVal
.dsn
; }
118 inline char* getTableConfigFile() { return cVal
.tableConfigFile
; }
119 inline bool useDurability() { return cVal
.isDurable
; }
120 inline bool useCsqlSqlServer() { return cVal
.isCsqlSqlServer
; }
121 inline int getPort() { return cVal
.port
; }
122 inline long getMaxLogStoreSize() { return cVal
.logStoreSize
; }
123 inline int getShmIDKey() { return cVal
.shmKeyForId
; }
124 inline int getNetworkID() { return cVal
.networkID
; }
125 inline int getCacheNetworkID() { return cVal
.cacheNetworkID
; }
126 inline int getNetworkResponseTimeout() { return cVal
.nwResponseTimeout
; }
127 inline int getNetworkConnectTimeout() { return cVal
.nwConnectTimeout
; }
128 inline bool useTwoWayCache() { return cVal
.isTwoWay
; }
129 inline int getCacheWaitSecs() { return cVal
.cacheWaitSecs
; }
135 static Config config
;