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 ***************************************************************************/
21 #define SIMPLE_CACHE 0x01
22 #define CONDNL_CACHE 0x02
23 #define FLDLVL_CACHE 0x04
24 #define DIRECT_CACHE 0x08
27 class DllExport TableConfig
29 char tableName
[IDENTIFIER_LENGTH
];
30 char fieldName
[IDENTIFIER_LENGTH
];
31 char userName
[IDENTIFIER_LENGTH
];
32 char password
[IDENTIFIER_LENGTH
];
33 char dsnName
[IDENTIFIER_LENGTH
];
34 // char dsnId[IDENTIFIER_LENGTH];
35 // char dsnPwd[IDENTIFIER_LENGTH];
37 char conditionVal
[IDENTIFIER_LENGTH
]; //added newly
38 char fieldlistVal
[IDENTIFIER_LENGTH
];
44 strcpy(conditionVal
,"");
46 strcpy(fieldlistVal
,"");
55 strcpy(conditionVal
,"");
57 strcpy(fieldlistVal
,"");
61 void setForceFlag(bool flag
){ shouldForce
= flag
;}
62 void setConnParam(char *user
, char *pass
){ strcpy(userName
, user
); strcpy(password
, pass
); }
63 void setTable(char *tablename
) { strcpy(tableName
,tablename
); }
64 void setDsnName(char *dsnname
) { strcpy(dsnName
,dsnname
);}
65 //void setDsnId(char *dsnid) { strcpy(dsnId,dsnid); }
66 //void setDsnPwd(char *dsnpwd){ strcpy(dsnPwd,dsnpwd);}
68 void setCondition(char *condition
){strcpy(conditionVal
,condition
);} //new one
69 void setFieldName(char *fldname
){ strcpy(fieldName
,fldname
);}
70 DbRetVal
addToCacheTableFile(bool isDirect
);
71 unsigned int getTableMode(char *tabname
);
72 void setFieldListVal(char *field
) {strcpy(fieldlistVal
,field
);}
74 DbRetVal
addToCacheTableFile();
75 DbRetVal
removeFromCacheTableFile();
76 DbRetVal
updateIntoCacheTableFile(bool upgrade
, bool isDirect
=false);
77 // DbRetVal load(bool tabDef=true);
79 // DbRetVal unload(bool tabDefinition = true);
80 // DbRetVal refresh();
81 // DbRetVal recoverAllCachedTables();
82 // DbRetVal load(DatabaseManager *dbMgr, bool tabDef);
84 DbRetVal
isTableCached(char *tablename
);
85 inline bool isTableCached(unsigned int mode
)
87 return (mode
& SIMPLE_CACHE
|| mode
& CONDNL_CACHE
||
88 mode
& FLDLVL_CACHE
|| mode
& DIRECT_CACHE
);
90 inline void unsetCacheMode(unsigned int *mode
)
92 *mode
&= ~(SIMPLE_CACHE
| CONDNL_CACHE
| FLDLVL_CACHE
| DIRECT_CACHE
);
96 DbRetVal
isTablePresent();// new one by :Jitendra
97 bool isFieldExist(char *fieldname
);
98 DbRetVal
CacheInfo(bool isTabPresent
);
99 DbRetVal
tablesOnDsn();
100 char *getRealConditionFromFile(char *condition
);
101 char *getConditionVal(char *condition
);
102 static DbRetVal
getDsnAndTdb(char *dsn
,char *newdsn
, char *tdb
);
103 DbRetVal
getDsnForTable(char *tabname
, char *dsn
);
109 static TableConfig config
;