MCS  0.3.3-alpha7
mcs_c.cc
1 
2 
3 
4 
5 // ----------------------------------------------------------------------^
6 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone
7 // (mailto: <gcalderone@ifc.inaf.it>)
8 //
9 // This file is part of MCS.
10 //
11 // MCS is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
15 //
16 // MCS is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with MCS; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 //
25 // ----------------------------------------------------------------------$
26 
27 #include "mcs.hh"
28 using namespace mcs;
29 
30 
31 
32 
33 
34 // ----------------------------------------------------------------------^
35 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone
36 // (mailto: <gcalderone@ifc.inaf.it>)
37 //
38 // This file is part of MCS.
39 //
40 // MCS is free software; you can redistribute it and/or modify
41 // it under the terms of the GNU General Public License as published by
42 // the Free Software Foundation; either version 2 of the License, or
43 // (at your option) any later version.
44 //
45 // MCS is distributed in the hope that it will be useful,
46 // but WITHOUT ANY WARRANTY; without even the implied warranty of
47 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 // GNU General Public License for more details.
49 //
50 // You should have received a copy of the GNU General Public License
51 // along with MCS; if not, write to the Free Software
52 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
53 //
54 // ----------------------------------------------------------------------$
55 
56 
57 /*
58  IFD - C/C++ to C Interface Descriptor
59  Giorgio Calderone - gcalderone@ifc.inaf.it
60 */
61 
62 
63 
64 
65 
66 //Object pointer type
67 #define IFD_OBJP void*
68 #define IFD_ERR_LEN 200
69 
70 
71 
72 
73 struct ifd_status {
74  int error;
75  char errormsg[200];
76  void* data;
77 };
78 
79 typedef struct ifd_status IFD_STATUS;
80 
81 //IFD routines
82 
83 static IFD_STATUS status;
84 
85 /*
86 #define IFD_C_WRAP(RETTYPE, FUNCTION, CALL, ARGS...) extern "C" RETTYPE FUNCTION (ARGS) {
87 return (RETTYPE) CALL;
88 }
89  \
90 }
91 
92 
93 //IFD routines
94 #define IFD_C_WRAP_VOID(FUNCTION, CALL, ARGS...) extern "C" RETTYPE FUNCTION (ARGS) {
95 CALL;
96 return;
97 }
98  \
99 }
100 */
101 
102 extern "C" {
103  void ifd_reset_error()
104  {
105  status.error = 0;
106  strncpy(status.errormsg, "", 1);
107  }
108 
109  //IFD_STATUS* ifd_new_status()
110  //{
111  // IFD_STATUS* ret = (IFD_STATUS*) malloc(sizeof(IFD_STATUS));
112  // ifd_reset_error(ret);
113  // return ret;
114  //}
115 
116  //void ifd_del_status(IFD_STATUS* _st)
117  //{
118  // if (_st)
119  // free(_st);
120  //}
121 
122 
123  int ifd_got_error()
124  {
125  return (status.error != 0 ? 1 : 0);
126  }
127 
128 
129  char* ifd_last_error()
130  {
131  return status.errormsg;
132  }
133 
134  //void ifd_set_error(char* msg, IFD_STATUS* _st)
135  //{
136  // _st->error = 1;
137  // strncpy(_st->errormsg, msg, IFD_ERR_LEN);
138  //}
139 
140 
141  void* ifd_null()
142  {
143  return (void*) 0;
144  }
145 }
146 //extern "C"
147 
148 
149 #ifdef IFD_EXTRA
150 #undef IFD_EXTRA
151 #endif
152 #define IFD_EXTRA
153 
154 
155 //--------------------------------------------------------------------
156 //Wrapper for Data class
157 
159 extern "C" void* new_Data (void* dummy ,Types type ,unsigned short int maxLength ,short isunsigned) {
160 if (status.error) return (void*) 0;
161 try {
162 IFD_EXTRA;
163 Data* This = new Data (type, maxLength, (bool) isunsigned);
164 return (void*) This;
165 }
166 catch(Event e) {
167 strncpy(status.errormsg, e.msg().c_str(), 200);
168 }
169 catch(exception e) {
170 strncpy(status.errormsg, e.what(), 200);
171 }
172 status.error = 1;
173 return (void*) 0;
174 };
175 
176 
178 extern "C" void* copy_Data (void* obj) {
179 if (status.error) return (void*) 0;
180 try {
181 Data* This = (Data*) obj;
182 return (void*) new Data(*This);
183 }
184 catch(Event e) {
185 strncpy(status.errormsg, e.msg().c_str(), 200);
186 }
187 catch(exception e) {
188 strncpy(status.errormsg, e.what(), 200);
189 }
190 status.error = 1;
191 return (void*) 0;
192 };
193 
195 extern "C" void del_Data (void* obj) {
196 if (status.error) return ;
197 try {;
198 Data* This = (Data*) obj;
199 delete This;
200 return;
201 }
202 catch(Event e) {
203 strncpy(status.errormsg, e.msg().c_str(), 200);
204 }
205 catch(exception e) {
206 strncpy(status.errormsg, e.what(), 200);
207 }
208 status.error = 1;
209 return;
210 };
211 
213 extern "C" char* Data_name (void* obj ) {
214 if (status.error) return (char*) 0;
215 try {
216 Data* This = (Data*) obj;
217 IFD_EXTRA;
218 return (char*) This->name().c_str();
219 }
220 catch(Event e) {
221 strncpy(status.errormsg, e.msg().c_str(), 200);
222 }
223 catch(exception e) {
224 strncpy(status.errormsg, e.what(), 200);
225 }
226 status.error = 1;
227 return (char*) 0;
228 };
229 
230 //IFD_WRAP(unsigned int, Data, flags , This->flags() );
231 extern "C" Types Data_type (void* obj ) {
232 if (status.error) return (Types) 0;
233 try {
234 Data* This = (Data*) obj;
235 IFD_EXTRA;
236 return (Types) This->type();
237 }
238 catch(Event e) {
239 strncpy(status.errormsg, e.msg().c_str(), 200);
240 }
241 catch(exception e) {
242 strncpy(status.errormsg, e.what(), 200);
243 }
244 status.error = 1;
245 return (Types) 0;
246 };
247 extern "C" unsigned short int Data_maxLength (void* obj ) {
248 if (status.error) return (unsigned short int) 0;
249 try {
250 Data* This = (Data*) obj;
251 IFD_EXTRA;
252 return (unsigned short int) This->maxLength();
253 }
254 catch(Event e) {
255 strncpy(status.errormsg, e.msg().c_str(), 200);
256 }
257 catch(exception e) {
258 strncpy(status.errormsg, e.what(), 200);
259 }
260 status.error = 1;
261 return (unsigned short int) 0;
262 };
263 extern "C" unsigned short int Data_length (void* obj ) {
264 if (status.error) return (unsigned short int) 0;
265 try {
266 Data* This = (Data*) obj;
267 IFD_EXTRA;
268 return (unsigned short int) This->length();
269 }
270 catch(Event e) {
271 strncpy(status.errormsg, e.msg().c_str(), 200);
272 }
273 catch(exception e) {
274 strncpy(status.errormsg, e.what(), 200);
275 }
276 status.error = 1;
277 return (unsigned short int) 0;
278 };
279 extern "C" short Data_isUnsigned (void* obj ) {
280 if (status.error) return (short) 0;
281 try {
282 Data* This = (Data*) obj;
283 IFD_EXTRA;
284 return (short) This->isUnsigned();
285 }
286 catch(Event e) {
287 strncpy(status.errormsg, e.msg().c_str(), 200);
288 }
289 catch(exception e) {
290 strncpy(status.errormsg, e.what(), 200);
291 }
292 status.error = 1;
293 return (short) 0;
294 };
295 extern "C" short Data_isNull (void* obj ) {
296 if (status.error) return (short) 0;
297 try {
298 Data* This = (Data*) obj;
299 IFD_EXTRA;
300 return (short) This->isNull();
301 }
302 catch(Event e) {
303 strncpy(status.errormsg, e.msg().c_str(), 200);
304 }
305 catch(exception e) {
306 strncpy(status.errormsg, e.what(), 200);
307 }
308 status.error = 1;
309 return (short) 0;
310 };
311 extern "C" int Data_ival (void* obj ) {
312 if (status.error) return (int) 0;
313 try {
314 Data* This = (Data*) obj;
315 IFD_EXTRA;
316 return (int) This->ival();
317 }
318 catch(Event e) {
319 strncpy(status.errormsg, e.msg().c_str(), 200);
320 }
321 catch(exception e) {
322 strncpy(status.errormsg, e.what(), 200);
323 }
324 status.error = 1;
325 return (int) 0;
326 };
327 extern "C" unsigned int Data_uival (void* obj ) {
328 if (status.error) return (unsigned int) 0;
329 try {
330 Data* This = (Data*) obj;
331 IFD_EXTRA;
332 return (unsigned int) This->uival();
333 }
334 catch(Event e) {
335 strncpy(status.errormsg, e.msg().c_str(), 200);
336 }
337 catch(exception e) {
338 strncpy(status.errormsg, e.what(), 200);
339 }
340 status.error = 1;
341 return (unsigned int) 0;
342 };
343 extern "C" long long int Data_lval (void* obj ) {
344 if (status.error) return (long long int) 0;
345 try {
346 Data* This = (Data*) obj;
347 IFD_EXTRA;
348 return (long long int) This->lval();
349 }
350 catch(Event e) {
351 strncpy(status.errormsg, e.msg().c_str(), 200);
352 }
353 catch(exception e) {
354 strncpy(status.errormsg, e.what(), 200);
355 }
356 status.error = 1;
357 return (long long int) 0;
358 };
359 extern "C" unsigned long long int Data_ulval (void* obj ) {
360 if (status.error) return (unsigned long long int) 0;
361 try {
362 Data* This = (Data*) obj;
363 IFD_EXTRA;
364 return (unsigned long long int) This->ulval();
365 }
366 catch(Event e) {
367 strncpy(status.errormsg, e.msg().c_str(), 200);
368 }
369 catch(exception e) {
370 strncpy(status.errormsg, e.what(), 200);
371 }
372 status.error = 1;
373 return (unsigned long long int) 0;
374 };
375 extern "C" float Data_fval (void* obj ) {
376 if (status.error) return (float) 0;
377 try {
378 Data* This = (Data*) obj;
379 IFD_EXTRA;
380 return (float) This->fval();
381 }
382 catch(Event e) {
383 strncpy(status.errormsg, e.msg().c_str(), 200);
384 }
385 catch(exception e) {
386 strncpy(status.errormsg, e.what(), 200);
387 }
388 status.error = 1;
389 return (float) 0;
390 };
391 extern "C" double Data_dval (void* obj ) {
392 if (status.error) return (double) 0;
393 try {
394 Data* This = (Data*) obj;
395 IFD_EXTRA;
396 return (double) This->dval();
397 }
398 catch(Event e) {
399 strncpy(status.errormsg, e.msg().c_str(), 200);
400 }
401 catch(exception e) {
402 strncpy(status.errormsg, e.what(), 200);
403 }
404 status.error = 1;
405 return (double) 0;
406 };
407 extern "C" char* Data_sval (void* obj ) {
408 if (status.error) return (char*) 0;
409 try {
410 Data* This = (Data*) obj;
411 IFD_EXTRA;
412 return (char*) This->sval().c_str();
413 }
414 catch(Event e) {
415 strncpy(status.errormsg, e.msg().c_str(), 200);
416 }
417 catch(exception e) {
418 strncpy(status.errormsg, e.what(), 200);
419 }
420 status.error = 1;
421 return (char*) 0;
422 };
423 extern "C" unsigned int Data_tval (void* obj ) {
424 if (status.error) return (unsigned int) 0;
425 try {
426 Data* This = (Data*) obj;
427 IFD_EXTRA;
428 return (unsigned int) This->tval();
429 }
430 catch(Event e) {
431 strncpy(status.errormsg, e.msg().c_str(), 200);
432 }
433 catch(exception e) {
434 strncpy(status.errormsg, e.what(), 200);
435 }
436 status.error = 1;
437 return (unsigned int) 0;
438 };
439 
440 
441 //IFD_WRAP_VOID( Data, tsval , This->tval(t), ARG(struct tm*, t));
442 
443 extern "C" void Data_setNull (void* obj ) {
444 if (status.error) return ;
445 try {
446 Data* This = (Data*) obj;
447 This->setNull();
448 return;
449 }
450 catch(Event e) {
451 strncpy(status.errormsg, e.msg().c_str(), 200);
452 }
453 catch(exception e) {
454 strncpy(status.errormsg, e.what(), 200);
455 }
456 status.error = 1;
457 return;
458 };
459 
460 extern "C" void Data_setival (void* obj ,int val) {
461 if (status.error) return ;
462 try {
463 Data* This = (Data*) obj;
464 This->setival(val);
465 return;
466 }
467 catch(Event e) {
468 strncpy(status.errormsg, e.msg().c_str(), 200);
469 }
470 catch(exception e) {
471 strncpy(status.errormsg, e.what(), 200);
472 }
473 status.error = 1;
474 return;
475 };
476 extern "C" void Data_setuival (void* obj ,unsigned int val) {
477 if (status.error) return ;
478 try {
479 Data* This = (Data*) obj;
480 This->setuival(val);
481 return;
482 }
483 catch(Event e) {
484 strncpy(status.errormsg, e.msg().c_str(), 200);
485 }
486 catch(exception e) {
487 strncpy(status.errormsg, e.what(), 200);
488 }
489 status.error = 1;
490 return;
491 };
492 
493 extern "C" void Data_setlval (void* obj ,long long int val) {
494 if (status.error) return ;
495 try {
496 Data* This = (Data*) obj;
497 This->setlval(val);
498 return;
499 }
500 catch(Event e) {
501 strncpy(status.errormsg, e.msg().c_str(), 200);
502 }
503 catch(exception e) {
504 strncpy(status.errormsg, e.what(), 200);
505 }
506 status.error = 1;
507 return;
508 };
509 extern "C" void Data_setulval (void* obj ,unsigned long long int val) {
510 if (status.error) return ;
511 try {
512 Data* This = (Data*) obj;
513 This->setulval(val);
514 return;
515 }
516 catch(Event e) {
517 strncpy(status.errormsg, e.msg().c_str(), 200);
518 }
519 catch(exception e) {
520 strncpy(status.errormsg, e.what(), 200);
521 }
522 status.error = 1;
523 return;
524 };
525 
526 extern "C" void Data_setdval (void* obj ,double val) {
527 if (status.error) return ;
528 try {
529 Data* This = (Data*) obj;
530 This->setdval(val);
531 return;
532 }
533 catch(Event e) {
534 strncpy(status.errormsg, e.msg().c_str(), 200);
535 }
536 catch(exception e) {
537 strncpy(status.errormsg, e.what(), 200);
538 }
539 status.error = 1;
540 return;
541 };
542 
543 extern "C" void Data_setsval (void* obj ,char* val) {
544 if (status.error) return ;
545 try {
546 Data* This = (Data*) obj;
547 This->setsval(val);
548 return;
549 }
550 catch(Event e) {
551 strncpy(status.errormsg, e.msg().c_str(), 200);
552 }
553 catch(exception e) {
554 strncpy(status.errormsg, e.what(), 200);
555 }
556 status.error = 1;
557 return;
558 };
559 
560 extern "C" void Data_setblob (void* obj ,void* lbuf ,unsigned int size) {
561 if (status.error) return ;
562 try {
563 Data* This = (Data*) obj;
564 This->setblob(lbuf, size);
565 return;
566 }
567 catch(Event e) {
568 strncpy(status.errormsg, e.msg().c_str(), 200);
569 }
570 catch(exception e) {
571 strncpy(status.errormsg, e.what(), 200);
572 }
573 status.error = 1;
574 return;
575 };
576 
577 
578 //IFD_WRAP_VOID( Data, settmstrval, This->settimeval(val),
579 // ARG(struct tm*, val));
580 
581 extern "C" void Data_settimeval (void* obj ,unsigned int val) {
582 if (status.error) return ;
583 try {
584 Data* This = (Data*) obj;
585 This->settimeval(val);
586 return;
587 }
588 catch(Event e) {
589 strncpy(status.errormsg, e.msg().c_str(), 200);
590 }
591 catch(exception e) {
592 strncpy(status.errormsg, e.what(), 200);
593 }
594 status.error = 1;
595 return;
596 };
597 
598 //IFD_WRAP_VOID( Data, parseTime , This->parseTime(s, ts),
599 // ARG(char*, s) ARG(struct tm*, ts));
600 
601 extern "C" char* Data_print (void* obj ) {
602 if (status.error) return (char*) 0;
603 try {
604 Data* This = (Data*) obj;
605 IFD_EXTRA;
606 return (char*) This->print().c_str();
607 }
608 catch(Event e) {
609 strncpy(status.errormsg, e.msg().c_str(), 200);
610 }
611 catch(exception e) {
612 strncpy(status.errormsg, e.what(), 200);
613 }
614 status.error = 1;
615 return (char*) 0;
616 };
617 
618 extern "C" void Data_setTag (void* obj ,short tag) {
619 if (status.error) return ;
620 try {
621 Data* This = (Data*) obj;
622 This->setTag(tag);
623 return;
624 }
625 catch(Event e) {
626 strncpy(status.errormsg, e.msg().c_str(), 200);
627 }
628 catch(exception e) {
629 strncpy(status.errormsg, e.what(), 200);
630 }
631 status.error = 1;
632 return;
633 };
634 
635 extern "C" short Data_getTag (void* obj ) {
636 if (status.error) return (short) 0;
637 try {
638 Data* This = (Data*) obj;
639 IFD_EXTRA;
640 return (short) This->getTag();
641 }
642 catch(Event e) {
643 strncpy(status.errormsg, e.msg().c_str(), 200);
644 }
645 catch(exception e) {
646 strncpy(status.errormsg, e.what(), 200);
647 }
648 status.error = 1;
649 return (short) 0;
650 };
651 
652 
653 
654 
655 
656 
657 //--------------------------------------------------------------------
658 //Wrapper for Record class
659 extern "C" void* new_Record (void* dummy ) {
660 if (status.error) return (void*) 0;
661 try {
662 IFD_EXTRA;
663 Record* This = new Record ();
664 return (void*) This;
665 }
666 catch(Event e) {
667 strncpy(status.errormsg, e.msg().c_str(), 200);
668 }
669 catch(exception e) {
670 strncpy(status.errormsg, e.what(), 200);
671 }
672 status.error = 1;
673 return (void*) 0;
674 };
675 
676 extern "C" void del_Record (void* obj) {
677 if (status.error) return ;
678 try {;
679 Record* This = (Record*) obj;
680 delete This;
681 return;
682 }
683 catch(Event e) {
684 strncpy(status.errormsg, e.msg().c_str(), 200);
685 }
686 catch(exception e) {
687 strncpy(status.errormsg, e.what(), 200);
688 }
689 status.error = 1;
690 return;
691 };
692 
693 extern "C" void Record_clear (void* obj ) {
694 if (status.error) return ;
695 try {
696 Record* This = (Record*) obj;
697 This->clear();
698 return;
699 }
700 catch(Event e) {
701 strncpy(status.errormsg, e.msg().c_str(), 200);
702 }
703 catch(exception e) {
704 strncpy(status.errormsg, e.what(), 200);
705 }
706 status.error = 1;
707 return;
708 };
709 extern "C" unsigned int Record_count (void* obj ) {
710 if (status.error) return (unsigned int) 0;
711 try {
712 Record* This = (Record*) obj;
713 IFD_EXTRA;
714 return (unsigned int) This->count();
715 }
716 catch(Event e) {
717 strncpy(status.errormsg, e.msg().c_str(), 200);
718 }
719 catch(exception e) {
720 strncpy(status.errormsg, e.what(), 200);
721 }
722 status.error = 1;
723 return (unsigned int) 0;
724 };
725 
726 extern "C" void Record_addField (void* obj ,void* d) {
727 if (status.error) return ;
728 try {
729 Record* This = (Record*) obj;
730 This->addField(* ((Data*) d));
731 return;
732 }
733 catch(Event e) {
734 strncpy(status.errormsg, e.msg().c_str(), 200);
735 }
736 catch(exception e) {
737 strncpy(status.errormsg, e.what(), 200);
738 }
739 status.error = 1;
740 return;
741 };
742 
743 
744 extern "C" void* Record_pop (void* obj ,int x) {
745 if (status.error) return (void*) 0;
746 try {
747 Record* This = (Record*) obj;
748 IFD_EXTRA;
749 return (void*) new Data(This->pop(x));
750 }
751 catch(Event e) {
752 strncpy(status.errormsg, e.msg().c_str(), 200);
753 }
754 catch(exception e) {
755 strncpy(status.errormsg, e.what(), 200);
756 }
757 status.error = 1;
758 return (void*) 0;
759 };
760 
761 extern "C" void* Record_field (void* obj ,int x) {
762 if (status.error) return (void*) 0;
763 try {
764 Record* This = (Record*) obj;
765 IFD_EXTRA;
766 return (void*) &(This->operator[](x));
767 }
768 catch(Event e) {
769 strncpy(status.errormsg, e.msg().c_str(), 200);
770 }
771 catch(exception e) {
772 strncpy(status.errormsg, e.what(), 200);
773 }
774 status.error = 1;
775 return (void*) 0;
776 };
777 
778 extern "C" int Record_posWhoseNameIs (void* obj ,char* name) {
779 if (status.error) return (int) 0;
780 try {
781 Record* This = (Record*) obj;
782 IFD_EXTRA;
783 return (int) This->posWhoseNameIs(name);
784 }
785 catch(Event e) {
786 strncpy(status.errormsg, e.msg().c_str(), 200);
787 }
788 catch(exception e) {
789 strncpy(status.errormsg, e.what(), 200);
790 }
791 status.error = 1;
792 return (int) 0;
793 };
794 
795 extern "C" void Record_setFieldMap (void* obj ,char* s) {
796 if (status.error) return ;
797 try {
798 Record* This = (Record*) obj;
799 This->setFieldMap(s);
800 return;
801 }
802 catch(Event e) {
803 strncpy(status.errormsg, e.msg().c_str(), 200);
804 }
805 catch(exception e) {
806 strncpy(status.errormsg, e.what(), 200);
807 }
808 status.error = 1;
809 return;
810 };
811 
812 
813 
814 
815 //--------------------------------------------------------------------
816 //Wrapper for RecordSet class
817 extern "C" short RecordSet_setFirst (void* obj ) {
818 if (status.error) return (short) 0;
819 try {
820 RecordSet* This = (RecordSet*) obj;
821 IFD_EXTRA;
822 return (short) This->setFirst();
823 }
824 catch(Event e) {
825 strncpy(status.errormsg, e.msg().c_str(), 200);
826 }
827 catch(exception e) {
828 strncpy(status.errormsg, e.what(), 200);
829 }
830 status.error = 1;
831 return (short) 0;
832 };
833 extern "C" short RecordSet_setLast (void* obj ) {
834 if (status.error) return (short) 0;
835 try {
836 RecordSet* This = (RecordSet*) obj;
837 IFD_EXTRA;
838 return (short) This->setLast();
839 }
840 catch(Event e) {
841 strncpy(status.errormsg, e.msg().c_str(), 200);
842 }
843 catch(exception e) {
844 strncpy(status.errormsg, e.what(), 200);
845 }
846 status.error = 1;
847 return (short) 0;
848 };
849 extern "C" short RecordSet_setNext (void* obj ) {
850 if (status.error) return (short) 0;
851 try {
852 RecordSet* This = (RecordSet*) obj;
853 IFD_EXTRA;
854 return (short) This->setNext();
855 }
856 catch(Event e) {
857 strncpy(status.errormsg, e.msg().c_str(), 200);
858 }
859 catch(exception e) {
860 strncpy(status.errormsg, e.what(), 200);
861 }
862 status.error = 1;
863 return (short) 0;
864 };
865 extern "C" short RecordSet_setPrev (void* obj ) {
866 if (status.error) return (short) 0;
867 try {
868 RecordSet* This = (RecordSet*) obj;
869 IFD_EXTRA;
870 return (short) This->setPrev();
871 }
872 catch(Event e) {
873 strncpy(status.errormsg, e.msg().c_str(), 200);
874 }
875 catch(exception e) {
876 strncpy(status.errormsg, e.what(), 200);
877 }
878 status.error = 1;
879 return (short) 0;
880 };
881 extern "C" short RecordSet_setWhereS (void* obj ,unsigned int field ,char* where) {
882 if (status.error) return (short) 0;
883 try {
884 RecordSet* This = (RecordSet*) obj;
885 IFD_EXTRA;
886 return (short) This->setWhere(field, where);
887 }
888 catch(Event e) {
889 strncpy(status.errormsg, e.msg().c_str(), 200);
890 }
891 catch(exception e) {
892 strncpy(status.errormsg, e.what(), 200);
893 }
894 status.error = 1;
895 return (short) 0;
896 };
897 
898 
899 extern "C" short RecordSet_setWhereI (void* obj ,unsigned int field ,int where) {
900 if (status.error) return (short) 0;
901 try {
902 RecordSet* This = (RecordSet*) obj;
903 IFD_EXTRA;
904 return (short) This->setWhere(field, where);
905 }
906 catch(Event e) {
907 strncpy(status.errormsg, e.msg().c_str(), 200);
908 }
909 catch(exception e) {
910 strncpy(status.errormsg, e.what(), 200);
911 }
912 status.error = 1;
913 return (short) 0;
914 };
915 
916 
917 extern "C" short RecordSet_setPos (void* obj ,unsigned int newpos) {
918 if (status.error) return (short) 0;
919 try {
920 RecordSet* This = (RecordSet*) obj;
921 IFD_EXTRA;
922 return (short) This->setPos(newpos);
923 }
924 catch(Event e) {
925 strncpy(status.errormsg, e.msg().c_str(), 200);
926 }
927 catch(exception e) {
928 strncpy(status.errormsg, e.what(), 200);
929 }
930 status.error = 1;
931 return (short) 0;
932 };
933 
934 extern "C" void RecordSet_dump (void* obj ,char* fn) {
935 if (status.error) return ;
936 try {
937 RecordSet* This = (RecordSet*) obj;
938 This->dump(fn);
939 return;
940 }
941 catch(Event e) {
942 strncpy(status.errormsg, e.msg().c_str(), 200);
943 }
944 catch(exception e) {
945 strncpy(status.errormsg, e.what(), 200);
946 }
947 status.error = 1;
948 return;
949 };
950 
951 extern "C" short RecordSet_know_nRows (void* obj ) {
952 if (status.error) return (short) 0;
953 try {
954 RecordSet* This = (RecordSet*) obj;
955 IFD_EXTRA;
956 return (short) This->know_nRows();
957 }
958 catch(Event e) {
959 strncpy(status.errormsg, e.msg().c_str(), 200);
960 }
961 catch(exception e) {
962 strncpy(status.errormsg, e.what(), 200);
963 }
964 status.error = 1;
965 return (short) 0;
966 };
967 extern "C" short RecordSet_eof (void* obj ) {
968 if (status.error) return (short) 0;
969 try {
970 RecordSet* This = (RecordSet*) obj;
971 IFD_EXTRA;
972 return (short) This->eof();
973 }
974 catch(Event e) {
975 strncpy(status.errormsg, e.msg().c_str(), 200);
976 }
977 catch(exception e) {
978 strncpy(status.errormsg, e.what(), 200);
979 }
980 status.error = 1;
981 return (short) 0;
982 };
983 extern "C" short RecordSet_alwaysSameStructure (void* obj ) {
984 if (status.error) return (short) 0;
985 try {
986 RecordSet* This = (RecordSet*) obj;
987 IFD_EXTRA;
988 return (short) This->alwaysSameStructure();
989 }
990 catch(Event e) {
991 strncpy(status.errormsg, e.msg().c_str(), 200);
992 }
993 catch(exception e) {
994 strncpy(status.errormsg, e.what(), 200);
995 }
996 status.error = 1;
997 return (short) 0;
998 };
999 
1000 extern "C" unsigned int RecordSet_nRows (void* obj ) {
1001 if (status.error) return (unsigned int) 0;
1002 try {
1003 RecordSet* This = (RecordSet*) obj;
1004 IFD_EXTRA;
1005 return (unsigned int) This->nRows();
1006 }
1007 catch(Event e) {
1008 strncpy(status.errormsg, e.msg().c_str(), 200);
1009 }
1010 catch(exception e) {
1011 strncpy(status.errormsg, e.what(), 200);
1012 }
1013 status.error = 1;
1014 return (unsigned int) 0;
1015 };
1016 extern "C" unsigned int RecordSet_nFields (void* obj ) {
1017 if (status.error) return (unsigned int) 0;
1018 try {
1019 RecordSet* This = (RecordSet*) obj;
1020 IFD_EXTRA;
1021 return (unsigned int) This->nFields();
1022 }
1023 catch(Event e) {
1024 strncpy(status.errormsg, e.msg().c_str(), 200);
1025 }
1026 catch(exception e) {
1027 strncpy(status.errormsg, e.what(), 200);
1028 }
1029 status.error = 1;
1030 return (unsigned int) 0;
1031 };
1032 extern "C" unsigned int RecordSet_pos (void* obj ) {
1033 if (status.error) return (unsigned int) 0;
1034 try {
1035 RecordSet* This = (RecordSet*) obj;
1036 IFD_EXTRA;
1037 return (unsigned int) This->pos();
1038 }
1039 catch(Event e) {
1040 strncpy(status.errormsg, e.msg().c_str(), 200);
1041 }
1042 catch(exception e) {
1043 strncpy(status.errormsg, e.what(), 200);
1044 }
1045 status.error = 1;
1046 return (unsigned int) 0;
1047 };
1048 extern "C" void* RecordSet_rec (void* obj ) {
1049 if (status.error) return (void*) 0;
1050 try {
1051 RecordSet* This = (RecordSet*) obj;
1052 IFD_EXTRA;
1053 return (void*) &(This->rec());
1054 }
1055 catch(Event e) {
1056 strncpy(status.errormsg, e.msg().c_str(), 200);
1057 }
1058 catch(exception e) {
1059 strncpy(status.errormsg, e.what(), 200);
1060 }
1061 status.error = 1;
1062 return (void*) 0;
1063 };
1064 extern "C" void* RecordSet_metarec (void* obj ) {
1065 if (status.error) return (void*) 0;
1066 try {
1067 RecordSet* This = (RecordSet*) obj;
1068 IFD_EXTRA;
1069 return (void*) &(This->metarec());
1070 }
1071 catch(Event e) {
1072 strncpy(status.errormsg, e.msg().c_str(), 200);
1073 }
1074 catch(exception e) {
1075 strncpy(status.errormsg, e.what(), 200);
1076 }
1077 status.error = 1;
1078 return (void*) 0;
1079 };
1080 
1081 
1082 
1083 
1084 
1085 
1086 //--------------------------------------------------------------------
1087 //Wrapper for DBConn, Query, Table classes
1088 
1089 #if ENABLE_MYSQL
1090 extern "C" void* new_DBConn (void* dummy ) {
1091 if (status.error) return (void*) 0;
1092 try {
1093 IFD_EXTRA;
1094 DBConn* This = new DBConn ();
1095 return (void*) This;
1096 }
1097 catch(Event e) {
1098 strncpy(status.errormsg, e.msg().c_str(), 200);
1099 }
1100 catch(exception e) {
1101 strncpy(status.errormsg, e.what(), 200);
1102 }
1103 status.error = 1;
1104 return (void*) 0;
1105 };
1106 
1107 extern "C" void del_DBConn (void* obj) {
1108 if (status.error) return ;
1109 try {;
1110 DBConn* This = (DBConn*) obj;
1111 delete This;
1112 return;
1113 }
1114 catch(Event e) {
1115 strncpy(status.errormsg, e.msg().c_str(), 200);
1116 }
1117 catch(exception e) {
1118 strncpy(status.errormsg, e.what(), 200);
1119 }
1120 status.error = 1;
1121 return;
1122 };
1123 
1124 extern "C" void DBConn_connect (void* obj ,char* user ,char* pass ,char* db ,char* host) {
1125 if (status.error) return ;
1126 try {
1127 DBConn* This = (DBConn*) obj;
1128 This->connect(user, pass, db , host);
1129 return;
1130 }
1131 catch(Event e) {
1132 strncpy(status.errormsg, e.msg().c_str(), 200);
1133 }
1134 catch(exception e) {
1135 strncpy(status.errormsg, e.what(), 200);
1136 }
1137 status.error = 1;
1138 return;
1139 };
1140 
1141 
1142 
1143 
1144 
1145 extern "C" void DBConn_close (void* obj ) {
1146 if (status.error) return ;
1147 try {
1148 DBConn* This = (DBConn*) obj;
1149 This->close();
1150 return;
1151 }
1152 catch(Event e) {
1153 strncpy(status.errormsg, e.msg().c_str(), 200);
1154 }
1155 catch(exception e) {
1156 strncpy(status.errormsg, e.what(), 200);
1157 }
1158 status.error = 1;
1159 return;
1160 };
1161 extern "C" short DBConn_isOpen (void* obj ) {
1162 if (status.error) return (short) 0;
1163 try {
1164 DBConn* This = (DBConn*) obj;
1165 IFD_EXTRA;
1166 return (short) This->isOpen();
1167 }
1168 catch(Event e) {
1169 strncpy(status.errormsg, e.msg().c_str(), 200);
1170 }
1171 catch(exception e) {
1172 strncpy(status.errormsg, e.what(), 200);
1173 }
1174 status.error = 1;
1175 return (short) 0;
1176 };
1177 extern "C" void* DBConn_newDBConn (void* obj ) {
1178 if (status.error) return (void*) 0;
1179 try {
1180 DBConn* This = (DBConn*) obj;
1181 IFD_EXTRA;
1182 return (void*) This->newDBConn();
1183 }
1184 catch(Event e) {
1185 strncpy(status.errormsg, e.msg().c_str(), 200);
1186 }
1187 catch(exception e) {
1188 strncpy(status.errormsg, e.what(), 200);
1189 }
1190 status.error = 1;
1191 return (void*) 0;
1192 };
1193 
1194 
1195 
1196 
1197 
1198 extern "C" void* new_Query (void* dummy ,void* lconn ,short handleNewDBConn) {
1199 if (status.error) return (void*) 0;
1200 try {
1201 IFD_EXTRA;
1202 Query* This = new Query ((DBConn*) lconn, (bool) handleNewDBConn);
1203 return (void*) This;
1204 }
1205 catch(Event e) {
1206 strncpy(status.errormsg, e.msg().c_str(), 200);
1207 }
1208 catch(exception e) {
1209 strncpy(status.errormsg, e.what(), 200);
1210 }
1211 status.error = 1;
1212 return (void*) 0;
1213 };
1214 
1215 
1216 
1217 extern "C" void del_Query (void* obj) {
1218 if (status.error) return ;
1219 try {;
1220 Query* This = (Query*) obj;
1221 delete This;
1222 return;
1223 }
1224 catch(Event e) {
1225 strncpy(status.errormsg, e.msg().c_str(), 200);
1226 }
1227 catch(exception e) {
1228 strncpy(status.errormsg, e.what(), 200);
1229 }
1230 status.error = 1;
1231 return;
1232 };
1233 
1234 
1235 extern "C" void Query_query (void* obj ,char* query ,short StoreResult) {
1236 if (status.error) return ;
1237 try {
1238 Query* This = (Query*) obj;
1239 This->query(query, (bool) StoreResult);
1240 return;
1241 }
1242 catch(Event e) {
1243 strncpy(status.errormsg, e.msg().c_str(), 200);
1244 }
1245 catch(exception e) {
1246 strncpy(status.errormsg, e.what(), 200);
1247 }
1248 status.error = 1;
1249 return;
1250 };
1251 
1252 
1253 extern "C" void Query_prepare (void* obj ,char* query) {
1254 if (status.error) return ;
1255 try {
1256 Query* This = (Query*) obj;
1257 This->prepare(query);
1258 return;
1259 }
1260 catch(Event e) {
1261 strncpy(status.errormsg, e.msg().c_str(), 200);
1262 }
1263 catch(exception e) {
1264 strncpy(status.errormsg, e.what(), 200);
1265 }
1266 status.error = 1;
1267 return;
1268 };
1269 
1270 
1271 extern "C" void Query_prepare_with_parameters (void* obj ,int op ,char* fields ,char* table ,char* where) {
1272 if (status.error) return ;
1273 try {
1274 Query* This = (Query*) obj;
1275 This->prepare_with_parameters(op, string(fields), table, where);
1276 return;
1277 }
1278 catch(Event e) {
1279 strncpy(status.errormsg, e.msg().c_str(), 200);
1280 }
1281 catch(exception e) {
1282 strncpy(status.errormsg, e.what(), 200);
1283 }
1284 status.error = 1;
1285 return;
1286 };
1287 
1288 
1289 
1290 
1291 
1292 extern "C" unsigned int Query_nAffectedRows (void* obj ) {
1293 if (status.error) return (unsigned int) 0;
1294 try {
1295 Query* This = (Query*) obj;
1296 IFD_EXTRA;
1297 return (unsigned int) This->nAffectedRows();
1298 }
1299 catch(Event e) {
1300 strncpy(status.errormsg, e.msg().c_str(), 200);
1301 }
1302 catch(exception e) {
1303 strncpy(status.errormsg, e.what(), 200);
1304 }
1305 status.error = 1;
1306 return (unsigned int) 0;
1307 };
1308 
1309 extern "C" void* Query_param (void* obj ) {
1310 if (status.error) return (void*) 0;
1311 try {
1312 Query* This = (Query*) obj;
1313 IFD_EXTRA;
1314 return (void*) &(This->param());
1315 }
1316 catch(Event e) {
1317 strncpy(status.errormsg, e.msg().c_str(), 200);
1318 }
1319 catch(exception e) {
1320 strncpy(status.errormsg, e.what(), 200);
1321 }
1322 status.error = 1;
1323 return (void*) 0;
1324 };
1325 
1326 extern "C" void* Query_lookup (void* obj ,char* field ,char* table ,char* where) {
1327 if (status.error) return (void*) 0;
1328 try {
1329 Query* This = (Query*) obj;
1330 IFD_EXTRA;
1331 return (void*) &(This->lookup(field, table, where));
1332 }
1333 catch(Event e) {
1334 strncpy(status.errormsg, e.msg().c_str(), 200);
1335 }
1336 catch(exception e) {
1337 strncpy(status.errormsg, e.what(), 200);
1338 }
1339 status.error = 1;
1340 return (void*) 0;
1341 };
1342 
1343 
1344 //IFD_WRAP(short, Query, resultRows, This->resultRows());
1345 
1346 extern "C" short Query_gotRecordSet (void* obj ) {
1347 if (status.error) return (short) 0;
1348 try {
1349 Query* This = (Query*) obj;
1350 IFD_EXTRA;
1351 return (short) This->gotRecordSet();
1352 }
1353 catch(Event e) {
1354 strncpy(status.errormsg, e.msg().c_str(), 200);
1355 }
1356 catch(exception e) {
1357 strncpy(status.errormsg, e.what(), 200);
1358 }
1359 status.error = 1;
1360 return (short) 0;
1361 };
1362 
1363 extern "C" void Query_execute (void* obj ,short StoreResult) {
1364 if (status.error) return ;
1365 try {
1366 Query* This = (Query*) obj;
1367 This->execute(StoreResult);
1368 return;
1369 }
1370 catch(Event e) {
1371 strncpy(status.errormsg, e.msg().c_str(), 200);
1372 }
1373 catch(exception e) {
1374 strncpy(status.errormsg, e.what(), 200);
1375 }
1376 status.error = 1;
1377 return;
1378 };
1379 
1380 
1381 
1382 extern "C" void Query_close (void* obj ) {
1383 if (status.error) return ;
1384 try {
1385 Query* This = (Query*) obj;
1386 This->close();
1387 return;
1388 }
1389 catch(Event e) {
1390 strncpy(status.errormsg, e.msg().c_str(), 200);
1391 }
1392 catch(exception e) {
1393 strncpy(status.errormsg, e.what(), 200);
1394 }
1395 status.error = 1;
1396 return;
1397 };
1398 
1399 
1400 
1401 
1402 
1403 
1404 #undef IFD_EXTRA
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;
1408 try {
1409 IFD_EXTRA;
1410 Table* This = new Table (conn, table, fieldkey);
1411 return (void*) This;
1412 }
1413 catch(Event e) {
1414 strncpy(status.errormsg, e.msg().c_str(), 200);
1415 }
1416 catch(exception e) {
1417 strncpy(status.errormsg, e.what(), 200);
1418 }
1419 status.error = 1;
1420 return (void*) 0;
1421 };
1422 
1423 #undef IFD_EXTRA
1424 #define IFD_EXTRA
1425 
1426 extern "C" void del_Table (void* obj) {
1427 if (status.error) return ;
1428 try {;
1429 Table* This = (Table*) obj;
1430 delete This;
1431 return;
1432 }
1433 catch(Event e) {
1434 strncpy(status.errormsg, e.msg().c_str(), 200);
1435 }
1436 catch(exception e) {
1437 strncpy(status.errormsg, e.what(), 200);
1438 }
1439 status.error = 1;
1440 return;
1441 };
1442 
1443 extern "C" void Table_loadTable (void* obj ) {
1444 if (status.error) return ;
1445 try {
1446 Table* This = (Table*) obj;
1447 This->loadTable();
1448 return;
1449 }
1450 catch(Event e) {
1451 strncpy(status.errormsg, e.msg().c_str(), 200);
1452 }
1453 catch(exception e) {
1454 strncpy(status.errormsg, e.what(), 200);
1455 }
1456 status.error = 1;
1457 return;
1458 };
1459 
1460 extern "C" void* Table_newRec (void* obj ) {
1461 if (status.error) return (void*) 0;
1462 try {
1463 Table* This = (Table*) obj;
1464 IFD_EXTRA;
1465 return (void*) &(This->newRec());
1466 }
1467 catch(Event e) {
1468 strncpy(status.errormsg, e.msg().c_str(), 200);
1469 }
1470 catch(exception e) {
1471 strncpy(status.errormsg, e.what(), 200);
1472 }
1473 status.error = 1;
1474 return (void*) 0;
1475 };
1476 
1477 extern "C" void Table_insert (void* obj ) {
1478 if (status.error) return ;
1479 try {
1480 Table* This = (Table*) obj;
1481 This->insert();
1482 return;
1483 }
1484 catch(Event e) {
1485 strncpy(status.errormsg, e.msg().c_str(), 200);
1486 }
1487 catch(exception e) {
1488 strncpy(status.errormsg, e.what(), 200);
1489 }
1490 status.error = 1;
1491 return;
1492 };
1493 extern "C" void Table_update (void* obj ) {
1494 if (status.error) return ;
1495 try {
1496 Table* This = (Table*) obj;
1497 This->update();
1498 return;
1499 }
1500 catch(Event e) {
1501 strncpy(status.errormsg, e.msg().c_str(), 200);
1502 }
1503 catch(exception e) {
1504 strncpy(status.errormsg, e.what(), 200);
1505 }
1506 status.error = 1;
1507 return;
1508 };
1509 #endif //ENABLE_MYSQL
1510 
1511 
1512 
1513 
1514 //--------------------------------------------------------------------
1515 //Wrapper for Client class
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;
1518 try {
1519 IFD_EXTRA;
1520 Client* This = new Client (path, server, port, false, ssl, timeout);
1521 return (void*) This;
1522 }
1523 catch(Event e) {
1524 strncpy(status.errormsg, e.msg().c_str(), 200);
1525 }
1526 catch(exception e) {
1527 strncpy(status.errormsg, e.what(), 200);
1528 }
1529 status.error = 1;
1530 return (void*) 0;
1531 };
1532 
1533 
1534 
1535 extern "C" void del_Client (void* obj) {
1536 if (status.error) return ;
1537 try {;
1538 Client* This = (Client*) obj;
1539 delete This;
1540 return;
1541 }
1542 catch(Event e) {
1543 strncpy(status.errormsg, e.msg().c_str(), 200);
1544 }
1545 catch(exception e) {
1546 strncpy(status.errormsg, e.what(), 200);
1547 }
1548 status.error = 1;
1549 return;
1550 };
1551 
1552 extern "C" short Client_login (void* obj ,char* user ,char* pass ,char* db) {
1553 if (status.error) return (short) 0;
1554 try {
1555 Client* This = (Client*) obj;
1556 IFD_EXTRA;
1557 return (short) This->login(user, pass, db);
1558 }
1559 catch(Event e) {
1560 strncpy(status.errormsg, e.msg().c_str(), 200);
1561 }
1562 catch(exception e) {
1563 strncpy(status.errormsg, e.what(), 200);
1564 }
1565 status.error = 1;
1566 return (short) 0;
1567 };
1568 
1569 
1570 extern "C" short Client_exec (void* obj ,char* cmd ,void* data) {
1571 if (status.error) return (short) 0;
1572 try {
1573 Client* This = (Client*) obj;
1574 IFD_EXTRA;
1575 return (short) This->exec(cmd, (Data*) data);
1576 }
1577 catch(Event e) {
1578 strncpy(status.errormsg, e.msg().c_str(), 200);
1579 }
1580 catch(exception e) {
1581 strncpy(status.errormsg, e.what(), 200);
1582 }
1583 status.error = 1;
1584 return (short) 0;
1585 };
1586 
1587 
1588 
1589 
1590 extern "C" void* Client_code (void* obj ) {
1591 if (status.error) return (void*) 0;
1592 try {
1593 Client* This = (Client*) obj;
1594 IFD_EXTRA;
1595 return (void*) &(This->code);
1596 }
1597 catch(Event e) {
1598 strncpy(status.errormsg, e.msg().c_str(), 200);
1599 }
1600 catch(exception e) {
1601 strncpy(status.errormsg, e.what(), 200);
1602 }
1603 status.error = 1;
1604 return (void*) 0;
1605 };
1606 
1607 extern "C" void* Client_msg (void* obj ) {
1608 if (status.error) return (void*) 0;
1609 try {
1610 Client* This = (Client*) obj;
1611 IFD_EXTRA;
1612 return (void*) &(This->msg);
1613 }
1614 catch(Event e) {
1615 strncpy(status.errormsg, e.msg().c_str(), 200);
1616 }
1617 catch(exception e) {
1618 strncpy(status.errormsg, e.what(), 200);
1619 }
1620 status.error = 1;
1621 return (void*) 0;
1622 };
1623 
1624 extern "C" void* Client_out (void* obj ) {
1625 if (status.error) return (void*) 0;
1626 try {
1627 Client* This = (Client*) obj;
1628 IFD_EXTRA;
1629 return (void*) &(This->out);
1630 }
1631 catch(Event e) {
1632 strncpy(status.errormsg, e.msg().c_str(), 200);
1633 }
1634 catch(exception e) {
1635 strncpy(status.errormsg, e.what(), 200);
1636 }
1637 status.error = 1;
1638 return (void*) 0;
1639 };
1640 
1641 extern "C" void* Client_recv (void* obj ) {
1642 if (status.error) return (void*) 0;
1643 try {
1644 Client* This = (Client*) obj;
1645 IFD_EXTRA;
1646 return (void*) &(This->recv);
1647 }
1648 catch(Event e) {
1649 strncpy(status.errormsg, e.msg().c_str(), 200);
1650 }
1651 catch(exception e) {
1652 strncpy(status.errormsg, e.what(), 200);
1653 }
1654 status.error = 1;
1655 return (void*) 0;
1656 };
1657 
1658 extern "C" void* Client_aux (void* obj ) {
1659 if (status.error) return (void*) 0;
1660 try {
1661 Client* This = (Client*) obj;
1662 IFD_EXTRA;
1663 return (void*) &(This->aux);
1664 }
1665 catch(Event e) {
1666 strncpy(status.errormsg, e.msg().c_str(), 200);
1667 }
1668 catch(exception e) {
1669 strncpy(status.errormsg, e.what(), 200);
1670 }
1671 status.error = 1;
1672 return (void*) 0;
1673 };
1674 
1675 
1676 
1677 
1678 
1679 //--------------------------------------------------------------------
1680 //Wrapper Conf class
1681 extern "C" void* new_Conf (void* dummy ,char* filename) {
1682 if (status.error) return (void*) 0;
1683 try {
1684 IFD_EXTRA;
1685 Conf* This = new Conf (filename);
1686 return (void*) This;
1687 }
1688 catch(Event e) {
1689 strncpy(status.errormsg, e.msg().c_str(), 200);
1690 }
1691 catch(exception e) {
1692 strncpy(status.errormsg, e.what(), 200);
1693 }
1694 status.error = 1;
1695 return (void*) 0;
1696 };
1697 
1698 extern "C" void del_Conf (void* obj) {
1699 if (status.error) return ;
1700 try {;
1701 Conf* This = (Conf*) obj;
1702 delete This;
1703 return;
1704 }
1705 catch(Event e) {
1706 strncpy(status.errormsg, e.msg().c_str(), 200);
1707 }
1708 catch(exception e) {
1709 strncpy(status.errormsg, e.what(), 200);
1710 }
1711 status.error = 1;
1712 return;
1713 };
1714 
1715 extern "C" char* Conf_sval (void* obj ,char* section ,char* key) {
1716 if (status.error) return (char*) 0;
1717 try {
1718 Conf* This = (Conf*) obj;
1719 IFD_EXTRA;
1720 return (char*) This->sval(section, key, "").c_str();
1721 }
1722 catch(Event e) {
1723 strncpy(status.errormsg, e.msg().c_str(), 200);
1724 }
1725 catch(exception e) {
1726 strncpy(status.errormsg, e.what(), 200);
1727 }
1728 status.error = 1;
1729 return (char*) 0;
1730 };
1731 
1732 
1733 
1734 extern "C" int Conf_ival (void* obj ,char* section ,char* key) {
1735 if (status.error) return (int) 0;
1736 try {
1737 Conf* This = (Conf*) obj;
1738 IFD_EXTRA;
1739 return (int) This->ival(section, key, false);
1740 }
1741 catch(Event e) {
1742 strncpy(status.errormsg, e.msg().c_str(), 200);
1743 }
1744 catch(exception e) {
1745 strncpy(status.errormsg, e.what(), 200);
1746 }
1747 status.error = 1;
1748 return (int) 0;
1749 };
bool isOpen()
Tell if a connection to the server is opened.
Definition: Db.cc:91
string print()
Returns a string representation of the object, for debug purpose.
Definition: Data.cc:2520
int posWhoseNameIs(string name, enum ThrowExceptions throwexc=THROW)
Return the index of the first Data objects whose name is "name".
Definition: Record.cc:457
bool setPrev()
Set the record pointer to the previous position in the set.
Definition: Record.cc:817
Record & param()
Returns a reference to a Record object containing all the input parameters.
Definition: Db.cc:205
Connect to a MCS server as a client.
Definition: mcs.hh:7538
Types type()
Return the base type of the object.
Definition: Data.cc:1196
unsigned long long int ulval() const
Convert internal data to an unsigned long long integer value.
Definition: Data.cc:1397
A class to directly set and retrieve value from a database table.
Definition: mcs.hh:5999
string sval(string section, string key)
Search for the specified section/key value and return it as a string.
Definition: Conf.cc:135
Execute queries on the database.
Definition: mcs.hh:5544
void setFieldMap(string s="")
Creates a new field map from the given string.
Definition: Record.cc:480
Record & newRec()
Return a reference to a Record object for insert.
Definition: Db.cc:959
Data & lookup(string field, string table, string where="")
Returns the current record set.
Definition: Db.cc:311
void prepare_with_parameters(int op, string fields, string table, string where="", int nrec=1)
Prepare a query with input parameters.
Definition: Db.cc:846
string sval(bool addWhiteSpaces=false) const
Convert internal data to a string object.
Definition: Data.cc:1555
bool setLast()
Set the record pointer to the last position.
Definition: Record.cc:839
void setTag(unsigned char tag)
Set a new value to internal tag.
Definition: Data.cc:2544
bool setPos(unsigned int i)
Set the record pointer to the i-th position.
Definition: Record.cc:850
Hold informations about an event.
Definition: mcs.hh:814
void setNull(bool null=true)
Set null flag. Following call to isNull() returns the value used here as parameter.
Definition: Data.cc:1923
Record out
Record containing all output lines (code: MSG_OUT) sent by the server while executing the last comman...
Definition: mcs.hh:7598
string name()
Return the name of the object.
Definition: Data.cc:1193
A dynamic array of Data objects.
Definition: mcs.hh:4170
DBConn * newDBConn()
Creates a new DB connection with the same parameters.
Definition: Db.cc:103
void setsval(string v)
Convert string value to base type and store in internal buffer.
Definition: Data.cc:2113
bool setFirst()
Set the record pointer to the first position.
Definition: Record.cc:829
void query(string SQL, bool StoreResult=false)
Wrapper aropund prepare() and execute().
Definition: Db.cc:367
unsigned int nAffectedRows()
Returns number of affected records by the last execute() call.
Definition: Db.cc:199
void close()
Closes a db connection.
Definition: Db.cc:71
void setulval(unsigned long long int v)
Convert unsigned long int value to base type and store in internal buffer.
Definition: Data.cc:1995
The base class that implement the data abstraction layer.
Definition: mcs.hh:4510
void update()
Update the current record.
Definition: Db.cc:973
string msg()
Returns the message.
Definition: Event.cc:104
void connect(string user, string pass, string db, string host="")
Connect to a databae server.
Definition: Db.cc:44
void loadTable()
Reload the table.
Definition: Db.cc:947
bool isUnsigned()
Tell if the object contains unsigned integers.
Definition: Data.cc:1199
char * Data_name(void *obj)
Wrapper to Data::name.
Definition: mcs_c.cc:213
Read and write configuration files.
Definition: mcs.hh:4843
bool isNull()
Tells if no value is stored.
Definition: Data.cc:1200
Record msg
Record containing all reply&#39;s messages sent by the server while executing the last command...
Definition: mcs.hh:7592
unsigned char getTag()
Retrieve the value of the tag.
Definition: Data.cc:2549
Record code
Record containing all reply&#39;s numeric codes sent by the server while executing the last command...
Definition: mcs.hh:7579
int nFields()
Returns number of fields.
Definition: Record.cc:765
void insert()
Insert a new record.
Definition: Db.cc:966
double dval() const
Convert internal data to a double (8 bytes) floating point value.
Definition: Data.cc:1465
void setival(int v)
Convert int value to base type and store in internal buffer.
Definition: Data.cc:1929
bool exec(string cmd, Data *data=NULL)
Execute commands on the server.
Definition: Client.cc:124
void close()
Close the statement and frees anything has been allocated.
Definition: Db.cc:391
unsigned int uival() const
Convert internal data to an unsigned integer value.
Definition: Data.cc:1309
Handle database connection.
Definition: mcs.hh:5432
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.
Definition: Record.cc:865
void addField(Data *d)
Wrapper around Dynamic_Array.push.
Definition: Record.cc:364
long long int lval() const
Convert internal data to a long long integer value.
Definition: Data.cc:1362
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.
Definition: Data.cc:1939
A general purpose data type.
Definition: mcs.hh:3092
void prepare(string SQL="")
Prepare the SQL statement.
Definition: Db.cc:221
float fval() const
Convert internal data to a floating point value.
Definition: Data.cc:1434
Record recv
Record containing all Data objects sent by the server.
Definition: mcs.hh:7601
unsigned short int length()
Return the actual length of the data in the internal buffer.
Definition: Data.cc:1198
void setdval(double v)
Convert double value to base type and store in internal buffer.
Definition: Data.cc:2053
void setuival(unsigned int v)
Convert unsigned int value to base type and store in internal buffer.
Definition: Data.cc:1934
time_t tval() const
Convert internal data to a time_t value.
Definition: Data.cc:1838
void execute(bool StoreResult=false)
Execute the prepared statement.
Definition: Db.cc:332
int count()
Wrapper around Dynamic_Array.count.
Definition: Record.cc:359
int ival() const
Convert internal data to a integer value.
Definition: Data.cc:1209
bool setNext()
Set the record pointer to the next position.
Definition: Record.cc:809
unsigned short int maxLength()
Return the size of the internal buffer.
Definition: Data.cc:1197
void setblob(void *lbuf, unsigned int size)
Copy "size" bytes from the address given in "lbuf" parameter.
Definition: Data.cc:2186
int ival(string section, string key)
Search for the specified section/key value and return it as an integer.
Definition: Conf.cc:142
bool login(string user, string pass, string db="")
Log in to a MCS server.
Definition: Client.cc:76
Record aux
Record containing all auxiliary fields sent by the server.
Definition: mcs.hh:7604
Namespace for MCS library.
Types
Enumeration of base type for Data.
Definition: mcs.hh:54

mcslogo

MCS (My Customizable Server) ver. 0.3.3-alpha7
Documentation generated on Mon May 28 07:39:41 UTC 2018