submitting patch from enterprise version
[csql.git] / include / CacheTableLoader.h
blob00e9832c20e0ab7c2828457e3eaeda29eba54263
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 #include <CSql.h>
17 #include <sql.h>
18 #include <sqlext.h>
19 #include <Network.h>
21 class CacheTableLoader
23 char tableName[IDENTIFIER_LENGTH];
24 char fieldName[IDENTIFIER_LENGTH];
25 char userName[IDENTIFIER_LENGTH];
26 char password[IDENTIFIER_LENGTH];
27 char conditionVal[IDENTIFIER_LENGTH]; //added newly
28 char fieldlistVal[IDENTIFIER_LENGTH];
29 public:
30 CacheTableLoader()
32 strcpy(tableName,"");
33 strcpy(conditionVal,"");
34 strcpy(fieldName,"");
35 strcpy(fieldlistVal,"");
37 void setConnParam(char *user, char *pass){ strcpy(userName, user); strcpy(password, pass); }
38 void setTable(char *tablename) { strcpy(tableName,tablename); }
39 void setCondition(char *condition){strcpy(conditionVal,condition);} //new one
40 void setFieldName(char *fldname){ strcpy(fieldName,fldname);}
41 DbRetVal addToCacheTableFile(bool isDirect);
42 static int getTableMode(char *tabname);
43 void setFieldListVal(char *field) {strcpy(fieldlistVal,field);}
45 DbRetVal addToCacheTableFile();
46 DbRetVal removeFromCacheTableFile();
47 DbRetVal load(bool tabDef=true);
48 DbRetVal reload();
49 DbRetVal unload(bool tabDefinition = true);
50 DbRetVal refresh();
51 DbRetVal recoverAllCachedTables();
52 DbRetVal load(Connection *conn, bool tabDef);
53 static DbRetVal isTableCached(char *tablename);
54 DbRetVal isTablePresent();// new one by :Jitendra
55 bool isFieldExist(char *fieldname);
56 DbRetVal CacheInfo(bool isTabPresent);
57 char *getRealConditionFromFile(char *condition);
58 char *getConditionVal(char *condition);
62 class BindBuffer
64 public:
65 void *csql;
66 void *targetdb;
67 DataType type;
69 class CacheTableInfo
71 public:
72 char tableName[IDENTIFIER_LENGTH];
73 char fieldName[IDENTIFIER_LENGTH];
74 char projFieldlist[IDENTIFIER_LENGTH];
75 char condition[IDENTIFIER_LENGTH];
77 void setTableName(char *tblName){strcpy(tableName,tblName);}
78 void setFieldName(char *fldName){strcpy(fieldName,fldName);}
79 void setProjFieldList(char *fieldlist){ strcpy(projFieldlist,fieldlist);}
80 void setCondition(char *cond){ strcpy(condition,cond);}
81 char *getTableName(){return tableName;}
82 char *getFieldName(){return fieldName;}
83 char *getCondition(){ return condition;}
84 char *getProjFieldList(){return projFieldlist;}