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 CACHETABLELOADER_H
17 #define CACHETABLELOADER_H
26 char indexName
[IDENTIFIER_LENGTH
];
27 FieldNameList fieldList
;
30 class CacheTableLoader
32 char tableName
[IDENTIFIER_LENGTH
];
33 char fieldName
[IDENTIFIER_LENGTH
];
34 char userName
[IDENTIFIER_LENGTH
];
35 char password
[IDENTIFIER_LENGTH
];
36 char conditionVal
[IDENTIFIER_LENGTH
]; //added newly
37 char fieldlistVal
[IDENTIFIER_LENGTH
];
38 char dsnName
[IDENTIFIER_LENGTH
];
39 // char dsnId[IDENTIFIER_LENGTH];
40 // char dsnPwd[IDENTIFIER_LENGTH];
46 strcpy(conditionVal
,"");
48 strcpy(fieldlistVal
,"");
54 DbRetVal
checkSecondTimeSqlPrimaryKeys(SQLHSTMT hstmtmeta
,char *tableName
,char *ptr
, HashIndexInitInfo
*inf
,bool &isPriIndex
);
55 DbRetVal
createIndex(SQLHSTMT hstmtmeta
, char *tableName
, HashIndexInitInfo
*inf
,AbsSqlStatement
*stmt
,bool isPKFieldSpecified
);
56 void setForceFlag(bool flag
){ shouldForce
= flag
;}
57 void setConnParam(char *user
, char *pass
){ strcpy(userName
, user
); strcpy(password
, pass
); }
58 void setTable(char *tablename
) { strcpy(tableName
,tablename
); }
59 void setCondition(char *condition
){strcpy(conditionVal
,condition
);} //new one
60 void setDsnName(char *dname
) {strcpy(dsnName
,dname
);}
62 //void setDsnId(char *dsnid) { strcpy(dsnId,dsnid); }
63 //void setDsnPwd(char *dsnpwd){ strcpy(dsnPwd,dsnpwd);}
64 void setFieldName(char *fldname
){ strcpy(fieldName
,fldname
);}
65 DbRetVal
addToCacheTableFile(bool isDirect
);
66 void setFieldListVal(char *field
) {strcpy(fieldlistVal
,field
);}
68 DbRetVal
addToCacheTableFile();
69 DbRetVal
removeFromCacheTableFile();
70 DbRetVal
load(bool tabDef
=true);
72 DbRetVal
unload(bool tabDefinition
= true);
74 DbRetVal
recoverAllCachedTables();
75 DbRetVal
load(AbsSqlConnection
*conn
, AbsSqlStatement
*stmt
, bool tabDef
);
76 DbRetVal
isTablePresent();// new one by :Jitendra
77 DbRetVal
CacheInfo(bool isTabPresent
);
78 char *getConditionVal(char *condition
);
79 void setParamValues(AbsSqlStatement
*stmt
, int parampos
, DataType type
, int length
, char *value
);
89 BindBuffer(){ csql
= NULL
; targetdb
= NULL
; type
= typeUnknown
; length
=0; }
90 ~BindBuffer() { ::free(csql
); ::free(targetdb
); }
95 char tableName
[IDENTIFIER_LENGTH
];
96 char fieldName
[IDENTIFIER_LENGTH
];
97 char projFieldlist
[IDENTIFIER_LENGTH
];
98 char condition
[IDENTIFIER_LENGTH
];
99 char dsnName
[IDENTIFIER_LENGTH
];
101 //char dsnId[IDENTIFIER_LENGTH];
102 //char dsnPwd[IDENTIFIER_LENGTH];
104 void setTableName(char *tblName
){strcpy(tableName
,tblName
);}
105 void setDsnName(char *dsnname
) { strcpy(dsnName
,dsnname
); }
106 // void setDsnId(char *dsnid) { strcpy(dsnId,dsnid); }
107 //void setDsnPwd(char *dsnpwd){ strcpy(dsnPwd,dsnpwd);}
109 void setFieldName(char *fldName
){strcpy(fieldName
,fldName
);}
110 void setProjFieldList(char *fieldlist
){ strcpy(projFieldlist
,fieldlist
);}
111 void setCondition(char *cond
){ strcpy(condition
,cond
);}
112 char *getTableName(){return tableName
;}
113 char *getFieldName(){return fieldName
;}
114 char *getCondition(){ return condition
;}
115 char *getProjFieldList(){return projFieldlist
;}