67 #define IFD_OBJP void* 68 #define IFD_ERR_LEN 200 79 typedef struct ifd_status IFD_STATUS;
83 static IFD_STATUS status;
103 void ifd_reset_error()
106 strncpy(status.errormsg,
"", 1);
125 return (status.error != 0 ? 1 : 0);
129 char* ifd_last_error()
131 return status.errormsg;
159 extern "C" void* new_Data (
void* dummy ,
Types type ,
unsigned short int maxLength ,
short isunsigned) {
160 if (status.error)
return (
void*) 0;
163 Data* This =
new Data (type, maxLength, (
bool) isunsigned);
167 strncpy(status.errormsg, e.
msg().c_str(), 200);
170 strncpy(status.errormsg, e.what(), 200);
178 extern "C" void* copy_Data (
void* obj) {
179 if (status.error)
return (
void*) 0;
182 return (
void*)
new Data(*This);
185 strncpy(status.errormsg, e.
msg().c_str(), 200);
188 strncpy(status.errormsg, e.what(), 200);
195 extern "C" void del_Data (
void* obj) {
196 if (status.error) return ;
203 strncpy(status.errormsg, e.
msg().c_str(), 200);
206 strncpy(status.errormsg, e.what(), 200);
214 if (status.error)
return (
char*) 0;
218 return (
char*) This->
name().c_str();
221 strncpy(status.errormsg, e.
msg().c_str(), 200);
224 strncpy(status.errormsg, e.what(), 200);
231 extern "C" Types Data_type (
void* obj ) {
232 if (status.error)
return (
Types) 0;
239 strncpy(status.errormsg, e.
msg().c_str(), 200);
242 strncpy(status.errormsg, e.what(), 200);
247 extern "C" unsigned short int Data_maxLength (
void* obj ) {
248 if (status.error)
return (
unsigned short int) 0;
252 return (
unsigned short int) This->
maxLength();
255 strncpy(status.errormsg, e.
msg().c_str(), 200);
258 strncpy(status.errormsg, e.what(), 200);
261 return (
unsigned short int) 0;
263 extern "C" unsigned short int Data_length (
void* obj ) {
264 if (status.error)
return (
unsigned short int) 0;
268 return (
unsigned short int) This->
length();
271 strncpy(status.errormsg, e.
msg().c_str(), 200);
274 strncpy(status.errormsg, e.what(), 200);
277 return (
unsigned short int) 0;
279 extern "C" short Data_isUnsigned (
void* obj ) {
280 if (status.error)
return (
short) 0;
287 strncpy(status.errormsg, e.
msg().c_str(), 200);
290 strncpy(status.errormsg, e.what(), 200);
295 extern "C" short Data_isNull (
void* obj ) {
296 if (status.error)
return (
short) 0;
300 return (
short) This->
isNull();
303 strncpy(status.errormsg, e.
msg().c_str(), 200);
306 strncpy(status.errormsg, e.what(), 200);
311 extern "C" int Data_ival (
void* obj ) {
312 if (status.error)
return (
int) 0;
316 return (
int) This->
ival();
319 strncpy(status.errormsg, e.
msg().c_str(), 200);
322 strncpy(status.errormsg, e.what(), 200);
327 extern "C" unsigned int Data_uival (
void* obj ) {
328 if (status.error)
return (
unsigned int) 0;
332 return (
unsigned int) This->
uival();
335 strncpy(status.errormsg, e.
msg().c_str(), 200);
338 strncpy(status.errormsg, e.what(), 200);
341 return (
unsigned int) 0;
343 extern "C" long long int Data_lval (
void* obj ) {
344 if (status.error)
return (
long long int) 0;
348 return (
long long int) This->
lval();
351 strncpy(status.errormsg, e.
msg().c_str(), 200);
354 strncpy(status.errormsg, e.what(), 200);
357 return (
long long int) 0;
359 extern "C" unsigned long long int Data_ulval (
void* obj ) {
360 if (status.error)
return (
unsigned long long int) 0;
364 return (
unsigned long long int) This->
ulval();
367 strncpy(status.errormsg, e.
msg().c_str(), 200);
370 strncpy(status.errormsg, e.what(), 200);
373 return (
unsigned long long int) 0;
375 extern "C" float Data_fval (
void* obj ) {
376 if (status.error)
return (
float) 0;
380 return (
float) This->
fval();
383 strncpy(status.errormsg, e.
msg().c_str(), 200);
386 strncpy(status.errormsg, e.what(), 200);
391 extern "C" double Data_dval (
void* obj ) {
392 if (status.error)
return (
double) 0;
396 return (
double) This->
dval();
399 strncpy(status.errormsg, e.
msg().c_str(), 200);
402 strncpy(status.errormsg, e.what(), 200);
407 extern "C" char* Data_sval (
void* obj ) {
408 if (status.error)
return (
char*) 0;
412 return (
char*) This->
sval().c_str();
415 strncpy(status.errormsg, e.
msg().c_str(), 200);
418 strncpy(status.errormsg, e.what(), 200);
423 extern "C" unsigned int Data_tval (
void* obj ) {
424 if (status.error)
return (
unsigned int) 0;
428 return (
unsigned int) This->
tval();
431 strncpy(status.errormsg, e.
msg().c_str(), 200);
434 strncpy(status.errormsg, e.what(), 200);
437 return (
unsigned int) 0;
443 extern "C" void Data_setNull (
void* obj ) {
444 if (status.error) return ;
451 strncpy(status.errormsg, e.
msg().c_str(), 200);
454 strncpy(status.errormsg, e.what(), 200);
460 extern "C" void Data_setival (
void* obj ,
int val) {
461 if (status.error) return ;
468 strncpy(status.errormsg, e.
msg().c_str(), 200);
471 strncpy(status.errormsg, e.what(), 200);
476 extern "C" void Data_setuival (
void* obj ,
unsigned int val) {
477 if (status.error) return ;
484 strncpy(status.errormsg, e.
msg().c_str(), 200);
487 strncpy(status.errormsg, e.what(), 200);
493 extern "C" void Data_setlval (
void* obj ,
long long int val) {
494 if (status.error) return ;
501 strncpy(status.errormsg, e.
msg().c_str(), 200);
504 strncpy(status.errormsg, e.what(), 200);
509 extern "C" void Data_setulval (
void* obj ,
unsigned long long int val) {
510 if (status.error) return ;
517 strncpy(status.errormsg, e.
msg().c_str(), 200);
520 strncpy(status.errormsg, e.what(), 200);
526 extern "C" void Data_setdval (
void* obj ,
double val) {
527 if (status.error) return ;
534 strncpy(status.errormsg, e.
msg().c_str(), 200);
537 strncpy(status.errormsg, e.what(), 200);
543 extern "C" void Data_setsval (
void* obj ,
char* val) {
544 if (status.error) return ;
551 strncpy(status.errormsg, e.
msg().c_str(), 200);
554 strncpy(status.errormsg, e.what(), 200);
560 extern "C" void Data_setblob (
void* obj ,
void* lbuf ,
unsigned int size) {
561 if (status.error) return ;
568 strncpy(status.errormsg, e.
msg().c_str(), 200);
571 strncpy(status.errormsg, e.what(), 200);
581 extern "C" void Data_settimeval (
void* obj ,
unsigned int val) {
582 if (status.error) return ;
589 strncpy(status.errormsg, e.
msg().c_str(), 200);
592 strncpy(status.errormsg, e.what(), 200);
601 extern "C" char* Data_print (
void* obj ) {
602 if (status.error)
return (
char*) 0;
606 return (
char*) This->
print().c_str();
609 strncpy(status.errormsg, e.
msg().c_str(), 200);
612 strncpy(status.errormsg, e.what(), 200);
618 extern "C" void Data_setTag (
void* obj ,
short tag) {
619 if (status.error) return ;
626 strncpy(status.errormsg, e.
msg().c_str(), 200);
629 strncpy(status.errormsg, e.what(), 200);
635 extern "C" short Data_getTag (
void* obj ) {
636 if (status.error)
return (
short) 0;
640 return (
short) This->
getTag();
643 strncpy(status.errormsg, e.
msg().c_str(), 200);
646 strncpy(status.errormsg, e.what(), 200);
659 extern "C" void* new_Record (
void* dummy ) {
660 if (status.error)
return (
void*) 0;
667 strncpy(status.errormsg, e.
msg().c_str(), 200);
670 strncpy(status.errormsg, e.what(), 200);
676 extern "C" void del_Record (
void* obj) {
677 if (status.error) return ;
684 strncpy(status.errormsg, e.
msg().c_str(), 200);
687 strncpy(status.errormsg, e.what(), 200);
693 extern "C" void Record_clear (
void* obj ) {
694 if (status.error) return ;
701 strncpy(status.errormsg, e.
msg().c_str(), 200);
704 strncpy(status.errormsg, e.what(), 200);
709 extern "C" unsigned int Record_count (
void* obj ) {
710 if (status.error)
return (
unsigned int) 0;
714 return (
unsigned int) This->
count();
717 strncpy(status.errormsg, e.
msg().c_str(), 200);
720 strncpy(status.errormsg, e.what(), 200);
723 return (
unsigned int) 0;
726 extern "C" void Record_addField (
void* obj ,
void* d) {
727 if (status.error) return ;
734 strncpy(status.errormsg, e.
msg().c_str(), 200);
737 strncpy(status.errormsg, e.what(), 200);
744 extern "C" void* Record_pop (
void* obj ,
int x) {
745 if (status.error)
return (
void*) 0;
749 return (
void*)
new Data(This->pop(x));
752 strncpy(status.errormsg, e.
msg().c_str(), 200);
755 strncpy(status.errormsg, e.what(), 200);
761 extern "C" void* Record_field (
void* obj ,
int x) {
762 if (status.error)
return (
void*) 0;
766 return (
void*) &(This->operator[](x));
769 strncpy(status.errormsg, e.
msg().c_str(), 200);
772 strncpy(status.errormsg, e.what(), 200);
778 extern "C" int Record_posWhoseNameIs (
void* obj ,
char* name) {
779 if (status.error)
return (
int) 0;
786 strncpy(status.errormsg, e.
msg().c_str(), 200);
789 strncpy(status.errormsg, e.what(), 200);
795 extern "C" void Record_setFieldMap (
void* obj ,
char* s) {
796 if (status.error) return ;
803 strncpy(status.errormsg, e.
msg().c_str(), 200);
806 strncpy(status.errormsg, e.what(), 200);
817 extern "C" short RecordSet_setFirst (
void* obj ) {
818 if (status.error)
return (
short) 0;
825 strncpy(status.errormsg, e.
msg().c_str(), 200);
828 strncpy(status.errormsg, e.what(), 200);
833 extern "C" short RecordSet_setLast (
void* obj ) {
834 if (status.error)
return (
short) 0;
838 return (
short) This->
setLast();
841 strncpy(status.errormsg, e.
msg().c_str(), 200);
844 strncpy(status.errormsg, e.what(), 200);
849 extern "C" short RecordSet_setNext (
void* obj ) {
850 if (status.error)
return (
short) 0;
854 return (
short) This->
setNext();
857 strncpy(status.errormsg, e.
msg().c_str(), 200);
860 strncpy(status.errormsg, e.what(), 200);
865 extern "C" short RecordSet_setPrev (
void* obj ) {
866 if (status.error)
return (
short) 0;
870 return (
short) This->
setPrev();
873 strncpy(status.errormsg, e.
msg().c_str(), 200);
876 strncpy(status.errormsg, e.what(), 200);
881 extern "C" short RecordSet_setWhereS (
void* obj ,
unsigned int field ,
char* where) {
882 if (status.error)
return (
short) 0;
886 return (
short) This->
setWhere(field, where);
889 strncpy(status.errormsg, e.
msg().c_str(), 200);
892 strncpy(status.errormsg, e.what(), 200);
899 extern "C" short RecordSet_setWhereI (
void* obj ,
unsigned int field ,
int where) {
900 if (status.error)
return (
short) 0;
904 return (
short) This->
setWhere(field, where);
907 strncpy(status.errormsg, e.
msg().c_str(), 200);
910 strncpy(status.errormsg, e.what(), 200);
917 extern "C" short RecordSet_setPos (
void* obj ,
unsigned int newpos) {
918 if (status.error)
return (
short) 0;
922 return (
short) This->
setPos(newpos);
925 strncpy(status.errormsg, e.
msg().c_str(), 200);
928 strncpy(status.errormsg, e.what(), 200);
934 extern "C" void RecordSet_dump (
void* obj ,
char* fn) {
935 if (status.error) return ;
942 strncpy(status.errormsg, e.
msg().c_str(), 200);
945 strncpy(status.errormsg, e.what(), 200);
951 extern "C" short RecordSet_know_nRows (
void* obj ) {
952 if (status.error)
return (
short) 0;
956 return (
short) This->know_nRows();
959 strncpy(status.errormsg, e.
msg().c_str(), 200);
962 strncpy(status.errormsg, e.what(), 200);
967 extern "C" short RecordSet_eof (
void* obj ) {
968 if (status.error)
return (
short) 0;
972 return (
short) This->eof();
975 strncpy(status.errormsg, e.
msg().c_str(), 200);
978 strncpy(status.errormsg, e.what(), 200);
983 extern "C" short RecordSet_alwaysSameStructure (
void* obj ) {
984 if (status.error)
return (
short) 0;
988 return (
short) This->alwaysSameStructure();
991 strncpy(status.errormsg, e.
msg().c_str(), 200);
994 strncpy(status.errormsg, e.what(), 200);
1000 extern "C" unsigned int RecordSet_nRows (
void* obj ) {
1001 if (status.error)
return (
unsigned int) 0;
1005 return (
unsigned int) This->nRows();
1008 strncpy(status.errormsg, e.
msg().c_str(), 200);
1010 catch(exception e) {
1011 strncpy(status.errormsg, e.what(), 200);
1014 return (
unsigned int) 0;
1016 extern "C" unsigned int RecordSet_nFields (
void* obj ) {
1017 if (status.error)
return (
unsigned int) 0;
1021 return (
unsigned int) This->
nFields();
1024 strncpy(status.errormsg, e.
msg().c_str(), 200);
1026 catch(exception e) {
1027 strncpy(status.errormsg, e.what(), 200);
1030 return (
unsigned int) 0;
1032 extern "C" unsigned int RecordSet_pos (
void* obj ) {
1033 if (status.error)
return (
unsigned int) 0;
1037 return (
unsigned int) This->pos();
1040 strncpy(status.errormsg, e.
msg().c_str(), 200);
1042 catch(exception e) {
1043 strncpy(status.errormsg, e.what(), 200);
1046 return (
unsigned int) 0;
1048 extern "C" void* RecordSet_rec (
void* obj ) {
1049 if (status.error)
return (
void*) 0;
1053 return (
void*) &(This->rec());
1056 strncpy(status.errormsg, e.
msg().c_str(), 200);
1058 catch(exception e) {
1059 strncpy(status.errormsg, e.what(), 200);
1064 extern "C" void* RecordSet_metarec (
void* obj ) {
1065 if (status.error)
return (
void*) 0;
1069 return (
void*) &(This->metarec());
1072 strncpy(status.errormsg, e.
msg().c_str(), 200);
1074 catch(exception e) {
1075 strncpy(status.errormsg, e.what(), 200);
1090 extern "C" void* new_DBConn (
void* dummy ) {
1091 if (status.error)
return (
void*) 0;
1095 return (
void*) This;
1098 strncpy(status.errormsg, e.
msg().c_str(), 200);
1100 catch(exception e) {
1101 strncpy(status.errormsg, e.what(), 200);
1107 extern "C" void del_DBConn (
void* obj) {
1108 if (status.error) return ;
1115 strncpy(status.errormsg, e.
msg().c_str(), 200);
1117 catch(exception e) {
1118 strncpy(status.errormsg, e.what(), 200);
1124 extern "C" void DBConn_connect (
void* obj ,
char* user ,
char* pass ,
char* db ,
char* host) {
1125 if (status.error) return ;
1128 This->
connect(user, pass, db , host);
1132 strncpy(status.errormsg, e.
msg().c_str(), 200);
1134 catch(exception e) {
1135 strncpy(status.errormsg, e.what(), 200);
1145 extern "C" void DBConn_close (
void* obj ) {
1146 if (status.error) return ;
1153 strncpy(status.errormsg, e.
msg().c_str(), 200);
1155 catch(exception e) {
1156 strncpy(status.errormsg, e.what(), 200);
1161 extern "C" short DBConn_isOpen (
void* obj ) {
1162 if (status.error)
return (
short) 0;
1166 return (
short) This->
isOpen();
1169 strncpy(status.errormsg, e.
msg().c_str(), 200);
1171 catch(exception e) {
1172 strncpy(status.errormsg, e.what(), 200);
1177 extern "C" void* DBConn_newDBConn (
void* obj ) {
1178 if (status.error)
return (
void*) 0;
1185 strncpy(status.errormsg, e.
msg().c_str(), 200);
1187 catch(exception e) {
1188 strncpy(status.errormsg, e.what(), 200);
1198 extern "C" void* new_Query (
void* dummy ,
void* lconn ,
short handleNewDBConn) {
1199 if (status.error)
return (
void*) 0;
1203 return (
void*) This;
1206 strncpy(status.errormsg, e.
msg().c_str(), 200);
1208 catch(exception e) {
1209 strncpy(status.errormsg, e.what(), 200);
1217 extern "C" void del_Query (
void* obj) {
1218 if (status.error) return ;
1225 strncpy(status.errormsg, e.
msg().c_str(), 200);
1227 catch(exception e) {
1228 strncpy(status.errormsg, e.what(), 200);
1235 extern "C" void Query_query (
void* obj ,
char* query ,
short StoreResult) {
1236 if (status.error) return ;
1239 This->
query(query, (
bool) StoreResult);
1243 strncpy(status.errormsg, e.
msg().c_str(), 200);
1245 catch(exception e) {
1246 strncpy(status.errormsg, e.what(), 200);
1253 extern "C" void Query_prepare (
void* obj ,
char* query) {
1254 if (status.error) return ;
1261 strncpy(status.errormsg, e.
msg().c_str(), 200);
1263 catch(exception e) {
1264 strncpy(status.errormsg, e.what(), 200);
1271 extern "C" void Query_prepare_with_parameters (
void* obj ,
int op ,
char* fields ,
char* table ,
char* where) {
1272 if (status.error) return ;
1279 strncpy(status.errormsg, e.
msg().c_str(), 200);
1281 catch(exception e) {
1282 strncpy(status.errormsg, e.what(), 200);
1292 extern "C" unsigned int Query_nAffectedRows (
void* obj ) {
1293 if (status.error)
return (
unsigned int) 0;
1300 strncpy(status.errormsg, e.
msg().c_str(), 200);
1302 catch(exception e) {
1303 strncpy(status.errormsg, e.what(), 200);
1306 return (
unsigned int) 0;
1309 extern "C" void* Query_param (
void* obj ) {
1310 if (status.error)
return (
void*) 0;
1314 return (
void*) &(This->
param());
1317 strncpy(status.errormsg, e.
msg().c_str(), 200);
1319 catch(exception e) {
1320 strncpy(status.errormsg, e.what(), 200);
1326 extern "C" void* Query_lookup (
void* obj ,
char* field ,
char* table ,
char* where) {
1327 if (status.error)
return (
void*) 0;
1331 return (
void*) &(This->
lookup(field, table, where));
1334 strncpy(status.errormsg, e.
msg().c_str(), 200);
1336 catch(exception e) {
1337 strncpy(status.errormsg, e.what(), 200);
1346 extern "C" short Query_gotRecordSet (
void* obj ) {
1347 if (status.error)
return (
short) 0;
1351 return (
short) This->gotRecordSet();
1354 strncpy(status.errormsg, e.
msg().c_str(), 200);
1356 catch(exception e) {
1357 strncpy(status.errormsg, e.what(), 200);
1363 extern "C" void Query_execute (
void* obj ,
short StoreResult) {
1364 if (status.error) return ;
1371 strncpy(status.errormsg, e.
msg().c_str(), 200);
1373 catch(exception e) {
1374 strncpy(status.errormsg, e.what(), 200);
1382 extern "C" void Query_close (
void* obj ) {
1383 if (status.error) return ;
1390 strncpy(status.errormsg, e.
msg().c_str(), 200);
1392 catch(exception e) {
1393 strncpy(status.errormsg, e.what(), 200);
1405 #define IFD_EXTRA DBConn* conn = (DBConn*) lconn; 1406 extern "C" void* new_Table (
void* dummy ,
void* lconn ,
char* table ,
char* fieldkey) {
1407 if (status.error)
return (
void*) 0;
1410 Table* This =
new Table (conn, table, fieldkey);
1411 return (
void*) This;
1414 strncpy(status.errormsg, e.
msg().c_str(), 200);
1416 catch(exception e) {
1417 strncpy(status.errormsg, e.what(), 200);
1426 extern "C" void del_Table (
void* obj) {
1427 if (status.error) return ;
1434 strncpy(status.errormsg, e.
msg().c_str(), 200);
1436 catch(exception e) {
1437 strncpy(status.errormsg, e.what(), 200);
1443 extern "C" void Table_loadTable (
void* obj ) {
1444 if (status.error) return ;
1451 strncpy(status.errormsg, e.
msg().c_str(), 200);
1453 catch(exception e) {
1454 strncpy(status.errormsg, e.what(), 200);
1460 extern "C" void* Table_newRec (
void* obj ) {
1461 if (status.error)
return (
void*) 0;
1465 return (
void*) &(This->
newRec());
1468 strncpy(status.errormsg, e.
msg().c_str(), 200);
1470 catch(exception e) {
1471 strncpy(status.errormsg, e.what(), 200);
1477 extern "C" void Table_insert (
void* obj ) {
1478 if (status.error) return ;
1485 strncpy(status.errormsg, e.
msg().c_str(), 200);
1487 catch(exception e) {
1488 strncpy(status.errormsg, e.what(), 200);
1493 extern "C" void Table_update (
void* obj ) {
1494 if (status.error) return ;
1501 strncpy(status.errormsg, e.
msg().c_str(), 200);
1503 catch(exception e) {
1504 strncpy(status.errormsg, e.what(), 200);
1509 #endif //ENABLE_MYSQL 1516 extern "C" void* new_Client (
void* dummy ,
char* path ,
char* server ,
int port ,
int ssl ,
unsigned int timeout) {
1517 if (status.error)
return (
void*) 0;
1520 Client* This =
new Client (path, server, port,
false, ssl, timeout);
1521 return (
void*) This;
1524 strncpy(status.errormsg, e.
msg().c_str(), 200);
1526 catch(exception e) {
1527 strncpy(status.errormsg, e.what(), 200);
1535 extern "C" void del_Client (
void* obj) {
1536 if (status.error) return ;
1543 strncpy(status.errormsg, e.
msg().c_str(), 200);
1545 catch(exception e) {
1546 strncpy(status.errormsg, e.what(), 200);
1552 extern "C" short Client_login (
void* obj ,
char* user ,
char* pass ,
char* db) {
1553 if (status.error)
return (
short) 0;
1557 return (
short) This->
login(user, pass, db);
1560 strncpy(status.errormsg, e.
msg().c_str(), 200);
1562 catch(exception e) {
1563 strncpy(status.errormsg, e.what(), 200);
1570 extern "C" short Client_exec (
void* obj ,
char* cmd ,
void* data) {
1571 if (status.error)
return (
short) 0;
1575 return (
short) This->
exec(cmd, (
Data*) data);
1578 strncpy(status.errormsg, e.
msg().c_str(), 200);
1580 catch(exception e) {
1581 strncpy(status.errormsg, e.what(), 200);
1590 extern "C" void* Client_code (
void* obj ) {
1591 if (status.error)
return (
void*) 0;
1595 return (
void*) &(This->
code);
1598 strncpy(status.errormsg, e.
msg().c_str(), 200);
1600 catch(exception e) {
1601 strncpy(status.errormsg, e.what(), 200);
1607 extern "C" void* Client_msg (
void* obj ) {
1608 if (status.error)
return (
void*) 0;
1612 return (
void*) &(This->
msg);
1615 strncpy(status.errormsg, e.
msg().c_str(), 200);
1617 catch(exception e) {
1618 strncpy(status.errormsg, e.what(), 200);
1624 extern "C" void* Client_out (
void* obj ) {
1625 if (status.error)
return (
void*) 0;
1629 return (
void*) &(This->
out);
1632 strncpy(status.errormsg, e.
msg().c_str(), 200);
1634 catch(exception e) {
1635 strncpy(status.errormsg, e.what(), 200);
1641 extern "C" void* Client_recv (
void* obj ) {
1642 if (status.error)
return (
void*) 0;
1646 return (
void*) &(This->
recv);
1649 strncpy(status.errormsg, e.
msg().c_str(), 200);
1651 catch(exception e) {
1652 strncpy(status.errormsg, e.what(), 200);
1658 extern "C" void* Client_aux (
void* obj ) {
1659 if (status.error)
return (
void*) 0;
1663 return (
void*) &(This->
aux);
1666 strncpy(status.errormsg, e.
msg().c_str(), 200);
1668 catch(exception e) {
1669 strncpy(status.errormsg, e.what(), 200);
1681 extern "C" void* new_Conf (
void* dummy ,
char* filename) {
1682 if (status.error)
return (
void*) 0;
1686 return (
void*) This;
1689 strncpy(status.errormsg, e.
msg().c_str(), 200);
1691 catch(exception e) {
1692 strncpy(status.errormsg, e.what(), 200);
1698 extern "C" void del_Conf (
void* obj) {
1699 if (status.error) return ;
1706 strncpy(status.errormsg, e.
msg().c_str(), 200);
1708 catch(exception e) {
1709 strncpy(status.errormsg, e.what(), 200);
1715 extern "C" char* Conf_sval (
void* obj ,
char* section ,
char* key) {
1716 if (status.error)
return (
char*) 0;
1720 return (
char*) This->
sval(section, key,
"").c_str();
1723 strncpy(status.errormsg, e.
msg().c_str(), 200);
1725 catch(exception e) {
1726 strncpy(status.errormsg, e.what(), 200);
1734 extern "C" int Conf_ival (
void* obj ,
char* section ,
char* key) {
1735 if (status.error)
return (
int) 0;
1739 return (
int) This->
ival(section, key,
false);
1742 strncpy(status.errormsg, e.
msg().c_str(), 200);
1744 catch(exception e) {
1745 strncpy(status.errormsg, e.what(), 200);
bool isOpen()
Tell if a connection to the server is opened.
string print()
Returns a string representation of the object, for debug purpose.
int posWhoseNameIs(string name, enum ThrowExceptions throwexc=THROW)
Return the index of the first Data objects whose name is "name".
bool setPrev()
Set the record pointer to the previous position in the set.
Record & param()
Returns a reference to a Record object containing all the input parameters.
Connect to a MCS server as a client.
Types type()
Return the base type of the object.
unsigned long long int ulval() const
Convert internal data to an unsigned long long integer value.
A class to directly set and retrieve value from a database table.
string sval(string section, string key)
Search for the specified section/key value and return it as a string.
Execute queries on the database.
void setFieldMap(string s="")
Creates a new field map from the given string.
Record & newRec()
Return a reference to a Record object for insert.
Data & lookup(string field, string table, string where="")
Returns the current record set.
void prepare_with_parameters(int op, string fields, string table, string where="", int nrec=1)
Prepare a query with input parameters.
string sval(bool addWhiteSpaces=false) const
Convert internal data to a string object.
bool setLast()
Set the record pointer to the last position.
void setTag(unsigned char tag)
Set a new value to internal tag.
bool setPos(unsigned int i)
Set the record pointer to the i-th position.
Hold informations about an event.
void setNull(bool null=true)
Set null flag. Following call to isNull() returns the value used here as parameter.
Record out
Record containing all output lines (code: MSG_OUT) sent by the server while executing the last comman...
string name()
Return the name of the object.
A dynamic array of Data objects.
DBConn * newDBConn()
Creates a new DB connection with the same parameters.
void setsval(string v)
Convert string value to base type and store in internal buffer.
bool setFirst()
Set the record pointer to the first position.
void query(string SQL, bool StoreResult=false)
Wrapper aropund prepare() and execute().
unsigned int nAffectedRows()
Returns number of affected records by the last execute() call.
void close()
Closes a db connection.
void setulval(unsigned long long int v)
Convert unsigned long int value to base type and store in internal buffer.
The base class that implement the data abstraction layer.
void update()
Update the current record.
string msg()
Returns the message.
void connect(string user, string pass, string db, string host="")
Connect to a databae server.
void loadTable()
Reload the table.
bool isUnsigned()
Tell if the object contains unsigned integers.
char * Data_name(void *obj)
Wrapper to Data::name.
Read and write configuration files.
bool isNull()
Tells if no value is stored.
Record msg
Record containing all reply's messages sent by the server while executing the last command...
unsigned char getTag()
Retrieve the value of the tag.
Record code
Record containing all reply's numeric codes sent by the server while executing the last command...
int nFields()
Returns number of fields.
void insert()
Insert a new record.
double dval() const
Convert internal data to a double (8 bytes) floating point value.
void setival(int v)
Convert int value to base type and store in internal buffer.
bool exec(string cmd, Data *data=NULL)
Execute commands on the server.
void close()
Close the statement and frees anything has been allocated.
unsigned int uival() const
Convert internal data to an unsigned integer value.
Handle database connection.
Main include file for all MCS based applications.
bool setWhere(int i, string equalTo)
Set the record pointer to the position which satisfies a string condition.
void addField(Data *d)
Wrapper around Dynamic_Array.push.
long long int lval() const
Convert internal data to a long long integer value.
void settimeval(struct tm v)
Convert "struct tm" value to base type and store in internal buffer.
void setlval(long long int v)
Convert long int value to base type and store in internal buffer.
A general purpose data type.
void prepare(string SQL="")
Prepare the SQL statement.
float fval() const
Convert internal data to a floating point value.
Record recv
Record containing all Data objects sent by the server.
unsigned short int length()
Return the actual length of the data in the internal buffer.
void setdval(double v)
Convert double value to base type and store in internal buffer.
void setuival(unsigned int v)
Convert unsigned int value to base type and store in internal buffer.
time_t tval() const
Convert internal data to a time_t value.
void execute(bool StoreResult=false)
Execute the prepared statement.
int count()
Wrapper around Dynamic_Array.count.
int ival() const
Convert internal data to a integer value.
bool setNext()
Set the record pointer to the next position.
unsigned short int maxLength()
Return the size of the internal buffer.
void setblob(void *lbuf, unsigned int size)
Copy "size" bytes from the address given in "lbuf" parameter.
int ival(string section, string key)
Search for the specified section/key value and return it as an integer.
bool login(string user, string pass, string db="")
Log in to a MCS server.
Record aux
Record containing all auxiliary fields sent by the server.
Namespace for MCS library.
Types
Enumeration of base type for Data.