Testing NULL values in Update Statements
[csql.git] / include / Config.h
blob339b534cd9b921c0bfa685997a3c021dda80567b
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 CONFIG_H
17 #define CONFIG_H
18 #include<os.h>
19 class ConfigValues
21 public:
22 //All the members of the configuration file
23 int pageSize;
24 int maxProcs;
25 long maxSysSize;
26 long maxDbSize;
27 int sysDbKey;
28 int userDbKey;
29 char logFile[MAX_FILE_PATH_LEN];
30 char dbFile[MAX_FILE_PATH_LEN];
31 long mapAddr;
32 int mutexSecs;
33 int mutexUSecs;
34 int mutexRetries;
35 int lockSecs;
36 int lockUSecs;
37 int lockRetries;
39 int cacheId;
40 bool isCache;
41 char dsn[IDENTIFIER_LENGTH];
42 char tableConfigFile[MAX_FILE_PATH_LEN];
43 bool isTwoWay;
44 int cacheWaitSecs;
46 bool isReplication;
47 bool isCsqlSqlServer;
48 int port;
49 char replConfigFile[MAX_FILE_PATH_LEN];
50 int networkID;
51 int cacheNetworkID;
53 long logStoreSize;
54 int nwResponseTimeout;
55 int nwConnectTimeout;
57 ConfigValues()
59 pageSize = 8192;
60 maxProcs = 20;
61 maxSysSize = 10485760;
62 maxDbSize = 104857600;
63 sysDbKey = 2222;
64 userDbKey = 5555;
65 strcpy(logFile, "/tmp/log/log.out");
66 strcpy(dbFile, "/tmp/csql/csql.db");
67 mapAddr=400000000;
68 mutexSecs=0;
69 mutexUSecs=10;
70 mutexRetries = 10;
71 lockSecs =0;
72 lockUSecs = 10;
73 lockRetries = 10;
74 cacheId=1;
75 isCache = false;
76 cacheNetworkID =-1;
77 strcpy(dsn, "myodbc3");
78 strcpy(tableConfigFile, "/tmp/csql/csqltable.conf");
79 isReplication = false;
80 isCsqlSqlServer = false;
81 port = 5678;
82 strcpy(replConfigFile, "/tmp/csql/csqlnw.conf");
83 logStoreSize = 10485760;
84 networkID=-1;
85 nwResponseTimeout=3;
86 nwConnectTimeout=5;
87 isTwoWay=true;
88 cacheWaitSecs =10;
92 class Config
94 ConfigValues cVal;
95 int readLine(FILE *fp, char * buffer);
96 int storeKeyVal(char *key, char *val);
97 int validateValues();
99 public:
100 int readAllValues(char *filename);
101 void print();
102 inline int getPageSize() { return cVal.pageSize; }
103 inline int getMaxProcs() { return cVal.maxProcs; }
104 inline long getMaxSysDbSize() { return cVal.maxSysSize; }
105 inline long getMaxDbSize() { return cVal.maxDbSize; }
106 inline int getSysDbKey() { return cVal.sysDbKey; }
107 inline int getUserDbKey() { return cVal.userDbKey; }
108 inline char* getLogFile() { return cVal.logFile; }
109 inline char* getDbFile() { return cVal.dbFile; }
110 inline long getMapAddress() { return cVal.mapAddr; }
111 inline int getMutexSecs() { return cVal.mutexSecs; }
112 inline int getMutexUSecs() { return cVal.mutexUSecs; }
113 inline int getMutexRetries() { return cVal.mutexRetries; }
114 inline int getLockSecs() { return cVal.lockSecs; }
115 inline int getLockUSecs() { return cVal.lockUSecs; }
116 inline int getLockRetries() { return cVal.lockRetries; }
117 inline int getCacheID(){ return cVal.cacheId;}
118 inline bool useCache() { return cVal.isCache; }
119 inline char* getDSN() { return cVal.dsn; }
120 inline char* getTableConfigFile() { return cVal.tableConfigFile; }
121 inline bool useReplication() { return cVal.isReplication; }
122 inline bool useCsqlSqlServer() { return cVal.isCsqlSqlServer; }
123 inline int getPort() { return cVal.port; }
124 inline char* getReplConfigFile() { return cVal.replConfigFile; }
125 inline long getMaxLogStoreSize() { return cVal.logStoreSize; }
126 inline int getNetworkID() { return cVal.networkID; }
127 inline int getCacheNetworkID() { return cVal.cacheNetworkID; }
128 inline int getNetworkResponseTimeout() { return cVal.nwResponseTimeout; }
129 inline int getNetworkConnectTimeout() { return cVal.nwConnectTimeout; }
130 inline bool useTwoWayCache() { return cVal.isTwoWay; }
131 inline int getCacheWaitSecs() { return cVal.cacheWaitSecs; }
134 class Conf
136 public:
137 static Config config;
141 #endif