source: trunk/Mars/msql/MBufferSQL.cc@ 15419

Last change on this file since 15419 was 15417, checked in by tbretz, 12 years ago
Some copies of root classes with some minor fixed to allow the use of rows which contain NULLs
File size: 21.6 KB
Line 
1// @(#)root/tree:$Id: MBufferSQL.cxx 43518 2012-03-28 01:04:07Z pcanal $
2// Author: Philippe Canal and al. 08/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// MBufferSQL //
15// //
16// Implement TBuffer for a SQL backend //
17// //
18//////////////////////////////////////////////////////////////////////////
19
20#include <vector>
21#include <stdio.h>
22#include "TError.h"
23
24#include "MBufferSQL.h"
25#include "TSQLResult.h"
26#include "TSQLRow.h"
27#include <stdlib.h>
28
29using namespace std;
30
31ClassImp(MBufferSQL);
32
33//________________________________________________________________________
34MBufferSQL::MBufferSQL(TBuffer::EMode mode, vector<Int_t> *vc,
35 TString *insert_query, TSQLRow ** r) :
36 TBufferFile(mode),
37 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
38{
39 // Constructor.
40
41 fIter = fColumnVec->begin();
42}
43
44//________________________________________________________________________
45MBufferSQL::MBufferSQL(TBuffer::EMode mode, Int_t bufsiz, vector<Int_t> *vc,
46 TString *insert_query, TSQLRow ** r) :
47 TBufferFile(mode,bufsiz),
48 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
49{
50 // Constructor.
51
52 fIter = fColumnVec->begin();
53}
54
55//________________________________________________________________________
56MBufferSQL::MBufferSQL(TBuffer::EMode mode, Int_t bufsiz, vector<Int_t> *vc,
57 TString *insert_query, TSQLRow ** r,
58 void *buf, Bool_t adopt) :
59 TBufferFile(mode,bufsiz,buf,adopt),
60 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
61{
62 // Constructor.
63
64 fIter = fColumnVec->begin();
65}
66
67//________________________________________________________________________
68MBufferSQL::MBufferSQL() : TBufferFile(), fColumnVec(0),fInsertQuery(0),fRowPtr(0)
69{
70 // Constructor.
71
72}
73
74//________________________________________________________________________
75MBufferSQL::~MBufferSQL()
76{
77 // Destructo.
78
79 delete fColumnVec;
80}
81
82//________________________________________________________________________
83void MBufferSQL::ReadBool(Bool_t &b)
84{
85 // Operator>>
86 const char *ptr = (*fRowPtr)->GetField(*fIter);
87
88 b = (Bool_t)atoi(ptr?ptr:"");
89
90 if (fIter != fColumnVec->end()) ++fIter;
91
92 if(ptr==0) Error("operator>>(Bool_t&)","Error reading Bool_t");
93}
94
95//________________________________________________________________________
96void MBufferSQL::ReadChar(Char_t &c)
97{
98 // Operator>>
99 const char *ptr = (*fRowPtr)->GetField(*fIter);
100
101 c = (Char_t)atoi(ptr?ptr:"");
102
103 if (fIter != fColumnVec->end()) ++fIter;
104
105 if(ptr==0) Error("operator>>(Char_t&)","Error reading Char_t");
106}
107
108//________________________________________________________________________
109void MBufferSQL::ReadShort(Short_t &h)
110{
111 // Operator>>
112 const char *ptr = (*fRowPtr)->GetField(*fIter);
113
114 h = (Short_t)atoi(ptr?ptr:"");
115
116 if (fIter != fColumnVec->end()) ++fIter;
117
118 if(ptr==0) Error("operator>>(Short_t&)","Error reading Short_t");
119}
120
121//________________________________________________________________________
122void MBufferSQL::ReadInt(Int_t &i)
123{
124 // Operator>>
125 const char *ptr = (*fRowPtr)->GetField(*fIter);
126
127 i = atoi(ptr?ptr:"");
128
129 if (fIter != fColumnVec->end()) ++fIter;
130
131 if(ptr==0) Error("operator>>(Int_t&)","Error reading Int_t");
132}
133
134//________________________________________________________________________
135void MBufferSQL::ReadFloat(Float_t &f)
136{
137 // Operator>>
138 const char *ptr = (*fRowPtr)->GetField(*fIter);
139
140 f = atof(ptr?ptr:"");
141
142 if (fIter != fColumnVec->end()) ++fIter;
143
144 if(ptr==0) Error("operator>>(Float_t&)","Error reading Float_t");
145}
146
147//________________________________________________________________________
148void MBufferSQL::ReadLong(Long_t &l)
149{
150 // Operator>>
151 const char *ptr = (*fRowPtr)->GetField(*fIter);
152
153 l = atol(ptr?ptr:"");
154
155 if (fIter != fColumnVec->end()) ++fIter;
156
157 if(ptr==0) Error("operator>>(Long_t&)","Error reading Long_t");
158}
159
160//________________________________________________________________________
161void MBufferSQL::ReadDouble(Double_t &d)
162{
163 // Operator>>
164 const char *ptr = (*fRowPtr)->GetField(*fIter);
165
166 d = atof(ptr?ptr:"");
167
168 if (fIter != fColumnVec->end()) ++fIter;
169
170 if(ptr==0) Error("operator>>(Double_t&)","Error reading Double_t");
171}
172
173
174//________________________________________________________________________
175void MBufferSQL::WriteBool(Bool_t b)
176{
177 // Operator<<
178
179 (*fInsertQuery) += b;
180 (*fInsertQuery) += ",";
181 if (fIter != fColumnVec->end()) ++fIter;
182}
183
184//________________________________________________________________________
185void MBufferSQL::WriteChar(Char_t c)
186{
187 // Operator<<
188
189 (*fInsertQuery) += c;
190 (*fInsertQuery) += ",";
191 if (fIter != fColumnVec->end()) ++fIter;
192}
193
194//________________________________________________________________________
195void MBufferSQL::WriteShort(Short_t h)
196{
197 // Operator<<
198
199 (*fInsertQuery) += h;
200 (*fInsertQuery) += ",";
201 if (fIter != fColumnVec->end()) ++fIter;
202}
203
204//________________________________________________________________________
205void MBufferSQL::WriteInt(Int_t i)
206{
207 // Operator<<
208
209 (*fInsertQuery) += i;
210 (*fInsertQuery) += ",";
211 if (fIter != fColumnVec->end()) ++fIter;
212}
213
214//________________________________________________________________________
215void MBufferSQL::WriteLong(Long_t l)
216{
217 // Operator<<
218
219 (*fInsertQuery) += l;
220 (*fInsertQuery) += ",";
221 if (fIter != fColumnVec->end()) ++fIter;
222}
223
224//________________________________________________________________________
225void MBufferSQL::WriteFloat(Float_t f)
226{
227 // Operator<<
228
229 (*fInsertQuery) += f;
230 (*fInsertQuery) += ",";
231 if (fIter != fColumnVec->end()) ++fIter;
232}
233
234//________________________________________________________________________
235void MBufferSQL::WriteDouble(Double_t d)
236{
237 // Operator<<
238
239 (*fInsertQuery) += d;
240 (*fInsertQuery) += ",";
241 if (fIter != fColumnVec->end()) ++fIter;
242}
243
244//________________________________________________________________________
245void MBufferSQL::ReadUChar(UChar_t& uc)
246{
247 // Operator>>
248 const char *ptr = (*fRowPtr)->GetField(*fIter);
249
250 uc = (UChar_t)atoi(ptr?ptr:"");
251
252 if (fIter != fColumnVec->end()) ++fIter;
253
254 if(ptr==0) Error("operator>>(UChar_t&)","Error reading UChar_t");
255}
256
257//________________________________________________________________________
258void MBufferSQL::ReadUShort(UShort_t& us)
259{
260 // Operator>>
261 const char *ptr = (*fRowPtr)->GetField(*fIter);
262
263 us = (UShort_t)atoi(ptr?ptr:"");
264
265 if (fIter != fColumnVec->end()) ++fIter;
266
267 if(ptr==0) Error("operator>>(UShort_t&)","Error reading UShort_t");
268}
269
270//________________________________________________________________________
271void MBufferSQL::ReadUInt(UInt_t& ui)
272{
273 // Operator>>
274
275 TString val = (*fRowPtr)->GetField(*fIter);
276 Int_t code = sscanf(val.Data(), "%u",&ui);
277 if(code == 0) Error("operator>>(UInt_t&)","Error reading UInt_t");
278
279 if (fIter != fColumnVec->end()) ++fIter;
280}
281
282//________________________________________________________________________
283void MBufferSQL::ReadULong(ULong_t& ul)
284{
285 // Operator>>
286
287 TString val = (*fRowPtr)->GetField(*fIter);
288 Int_t code = sscanf(val.Data(), "%lu",&ul);
289 if(code == 0) Error("operator>>(ULong_t&)","Error reading ULong_t");
290
291 if (fIter != fColumnVec->end()) ++fIter;
292}
293
294//________________________________________________________________________
295void MBufferSQL::ReadLong64(Long64_t &ll)
296{
297 // Operator>>
298
299 TString val = (*fRowPtr)->GetField(*fIter);
300 Int_t code = sscanf(val.Data(), "%lld",&ll);
301 if(code == 0) Error("operator>>(ULong_t&)","Error reading Long64_t");
302
303 if (fIter != fColumnVec->end()) ++fIter;
304}
305
306//________________________________________________________________________
307void MBufferSQL::ReadULong64(ULong64_t &ull)
308{
309 // Operator>>
310
311 TString val = (*fRowPtr)->GetField(*fIter);
312 Int_t code = sscanf(val.Data(), "%llu",&ull);
313 if(code == 0) Error("operator>>(ULong_t&)","Error reading ULong64_t");
314
315 if (fIter != fColumnVec->end()) ++fIter;
316}
317
318//________________________________________________________________________
319void MBufferSQL::ReadCharP(Char_t *str)
320{
321 // Operator>>
322
323 strcpy(str,(*fRowPtr)->GetField(*fIter)); // Legacy interface, we have no way to know the user's buffer size ....
324 if (fIter != fColumnVec->end()) ++fIter;
325}
326
327//________________________________________________________________________
328void MBufferSQL::ReadTString(TString &)
329{
330 // Operator>>
331
332 //strcpy(str,(*fRowPtr)->GetField(*fIter));
333 //if (fIter != fColumnVec->end()) ++fIter;
334 printf("ERROR NOT IMPLEMENTED\n");
335}
336
337//________________________________________________________________________
338void MBufferSQL::WriteTString(const TString &)
339{
340 // Operator>>
341
342 //strcpy(str,(*fRowPtr)->GetField(*fIter));
343 //if (fIter != fColumnVec->end()) ++fIter;
344 printf("ERROR NOT IMPLEMENTED\n");
345}
346
347// Method to send to database.
348
349//________________________________________________________________________
350void MBufferSQL::WriteUChar(UChar_t uc)
351{
352 // Operator<<
353
354 (*fInsertQuery) += uc;
355 (*fInsertQuery) += ",";
356 ++fIter;
357}
358
359//________________________________________________________________________
360void MBufferSQL::WriteUShort(UShort_t us)
361{
362 // Operator<<
363
364 (*fInsertQuery) += us;
365 (*fInsertQuery) += ",";
366 ++fIter;
367}
368
369//________________________________________________________________________
370void MBufferSQL::WriteUInt(UInt_t ui)
371{
372 // Operator<<
373
374 (*fInsertQuery) += ui;
375 (*fInsertQuery) += ",";
376 ++fIter;
377}
378
379//________________________________________________________________________
380void MBufferSQL::WriteULong(ULong_t ul)
381{
382 // Operator<<
383
384 (*fInsertQuery) += ul;
385 (*fInsertQuery) += ",";
386 ++fIter;
387}
388
389//________________________________________________________________________
390void MBufferSQL::WriteLong64(Long64_t ll)
391{
392 // Operator<<
393
394 (*fInsertQuery) += ll;
395 (*fInsertQuery) += ",";
396 ++fIter;
397}
398
399//________________________________________________________________________
400void MBufferSQL::WriteULong64(ULong64_t ull)
401{
402 // Operator<<
403
404 (*fInsertQuery) += ull;
405 (*fInsertQuery) += ",";
406 ++fIter;
407}
408
409//________________________________________________________________________
410void MBufferSQL::WriteCharP(const Char_t *str)
411{
412 // Operator<<
413
414 (*fInsertQuery) += "\"";
415 (*fInsertQuery) += str;
416 (*fInsertQuery) += "\",";
417 ++fIter;
418}
419
420//________________________________________________________________________
421void MBufferSQL::WriteFastArray(const Bool_t *b, Int_t n)
422{
423 // WriteFastArray SQL implementation.
424 for(int i=0; i<n; ++i) {
425 (*fInsertQuery) += b[i];
426 (*fInsertQuery) += ",";
427 ++fIter;
428 }
429}
430
431//________________________________________________________________________
432void MBufferSQL::WriteFastArray(const Char_t *c, Int_t n)
433{
434 // WriteFastArray SQL implementation.
435
436 for(int i=0; i<n; ++i) {
437 (*fInsertQuery) += (Short_t)c[i];
438 (*fInsertQuery) += ",";
439 ++fIter;
440 }
441}
442
443//________________________________________________________________________
444void MBufferSQL::WriteFastArrayString(const Char_t *c, Int_t /* n */)
445{
446 // WriteFastArray SQL implementation.
447
448 (*fInsertQuery) += "\"";
449 (*fInsertQuery) += c;
450 (*fInsertQuery) += "\",";
451 ++fIter;
452}
453
454//________________________________________________________________________
455void MBufferSQL::WriteFastArray(const UChar_t *uc, Int_t n)
456{
457 // WriteFastArray SQL implementation.
458
459 for(int i=0; i<n; ++i) {
460 (*fInsertQuery) += uc[i];
461 (*fInsertQuery) += ",";
462 ++fIter;
463 }
464}
465
466//________________________________________________________________________
467void MBufferSQL::WriteFastArray(const Short_t *h, Int_t n)
468{
469 // WriteFastArray SQL implementation.
470
471 for(int i=0; i<n; ++i) {
472 (*fInsertQuery) += h[i];
473 (*fInsertQuery) += ",";
474 ++fIter;
475 }
476}
477
478//________________________________________________________________________
479void MBufferSQL::WriteFastArray(const UShort_t *us, Int_t n)
480{
481 // WriteFastArray SQL implementation.
482
483 for(int i=0; i<n; ++i) {
484 (*fInsertQuery) += us[i];
485 (*fInsertQuery) += ",";
486 ++fIter;
487 }
488}
489
490//________________________________________________________________________
491void MBufferSQL::WriteFastArray(const Int_t *ii, Int_t n)
492{
493 // WriteFastArray SQL implementation.
494
495 // cerr << "Column: " <<*fIter << " i:" << *ii << endl;
496 for(int i=0; i<n; ++i) {
497 (*fInsertQuery) += ii[i];
498 (*fInsertQuery) += ",";
499 ++fIter;
500 }
501}
502
503//________________________________________________________________________
504void MBufferSQL::WriteFastArray(const UInt_t *ui, Int_t n)
505{
506 // WriteFastArray SQL implementation.
507
508 for(int i=0; i<n; ++i) {
509 (*fInsertQuery) += ui[i];
510 (*fInsertQuery) += ",";
511 ++fIter;
512 }
513}
514
515//________________________________________________________________________
516void MBufferSQL::WriteFastArray(const Long_t *l, Int_t n)
517{
518 // WriteFastArray SQL implementation.
519
520 for(int i=0; i<n; ++i) {
521 (*fInsertQuery)+= l[i];
522 (*fInsertQuery)+= ",";
523 ++fIter;
524 }
525}
526
527//________________________________________________________________________
528void MBufferSQL::WriteFastArray(const ULong_t *ul, Int_t n)
529{
530 // WriteFastArray SQL implementation.
531
532 for(int i=0; i<n; ++i) {
533 (*fInsertQuery) += ul[i];
534 (*fInsertQuery) += ",";
535 ++fIter;
536 }
537}
538
539//________________________________________________________________________
540void MBufferSQL::WriteFastArray(const Long64_t *l, Int_t n)
541{
542 // WriteFastArray SQL implementation.
543
544 for(int i=0; i<n; ++i) {
545 (*fInsertQuery) += l[i];
546 (*fInsertQuery) += ",";
547 ++fIter;
548 }
549}
550
551//________________________________________________________________________
552void MBufferSQL::WriteFastArray(const ULong64_t *ul, Int_t n)
553{
554 // WriteFastArray SQL implementation.
555
556 for(int i=0; i<n; ++i) {
557 (*fInsertQuery) += ul[i];
558 (*fInsertQuery) += ",";
559 ++fIter;
560 }
561}
562
563//________________________________________________________________________
564void MBufferSQL::WriteFastArray(const Float_t *f, Int_t n)
565{
566 // WriteFastArray SQL implementation.
567
568 for(int i=0; i<n; ++i) {
569 (*fInsertQuery) += f[i];
570 (*fInsertQuery) += ",";
571 ++fIter;
572 }
573}
574
575//________________________________________________________________________
576void MBufferSQL::WriteFastArray(const Double_t *d, Int_t n)
577{
578 // WriteFastArray SQL implementation.
579
580 for(int i=0; i<n; ++i) {
581 (*fInsertQuery) += d[i];
582 (*fInsertQuery )+= ",";
583 ++fIter;
584 }
585}
586
587//________________________________________________________________________
588void MBufferSQL::WriteFastArray(void*, const TClass*, Int_t, TMemberStreamer *)
589{
590 // WriteFastArray SQL implementation.
591
592 Fatal("riteFastArray(void*, const TClass*, Int_t, TMemberStreamer *)","Not implemented yet");
593}
594
595//________________________________________________________________________
596Int_t MBufferSQL::WriteFastArray(void **, const TClass*, Int_t, Bool_t, TMemberStreamer*)
597{
598 // WriteFastArray SQL implementation.
599
600 Fatal("WriteFastArray(void **, const TClass*, Int_t, Bool_t, TMemberStreamer*)","Not implemented yet");
601 return 0;
602}
603
604//________________________________________________________________________
605void MBufferSQL::ReadFastArray(Bool_t *b, Int_t n)
606{
607 // ReadFastArray SQL implementation.
608
609 for(int i=0; i<n; ++i) {
610 b[i] = (Bool_t)atoi((*fRowPtr)->GetField(*fIter));
611 ++fIter;
612 }
613}
614
615//________________________________________________________________________
616void MBufferSQL::ReadFastArray(Char_t *c, Int_t n)
617{
618 // ReadFastArray SQL implementation.
619 for(int i=0; i<n; ++i) {
620 c[i] = (Char_t)atoi((*fRowPtr)->GetField(*fIter));
621 ++fIter;
622 }
623}
624
625//________________________________________________________________________
626void MBufferSQL::ReadFastArrayString(Char_t *c, Int_t /* n */)
627{
628 // ReadFastArray SQL implementation.
629 strcpy(c,((*fRowPtr)->GetField(*fIter)));
630 ++fIter;
631}
632
633//________________________________________________________________________
634void MBufferSQL::ReadFastArray(UChar_t *uc, Int_t n)
635{
636 // ReadFastArray SQL implementation.
637 for(int i=0; i<n; ++i) {
638 uc[i] = (UChar_t)atoi((*fRowPtr)->GetField(*fIter));
639 ++fIter;
640 }
641}
642
643//________________________________________________________________________
644void MBufferSQL::ReadFastArray(Short_t *s, Int_t n)
645{
646 // ReadFastArray SQL implementation.
647 for(int i=0; i<n; ++i) {
648 s[i] = (Short_t)atoi((*fRowPtr)->GetField(*fIter));
649 ++fIter;
650 }
651}
652
653//________________________________________________________________________
654void MBufferSQL::ReadFastArray(UShort_t *us, Int_t n)
655{
656 // ReadFastArray SQL implementation.
657 for(int i=0; i<n; ++i) {
658 us[i] = (UShort_t)atoi((*fRowPtr)->GetField(*fIter));
659 ++fIter;
660 }
661}
662
663//________________________________________________________________________
664void MBufferSQL::ReadFastArray(Int_t *in, Int_t n)
665{
666 // ReadFastArray SQL implementation.
667 for(int i=0; i<n; ++i) {
668 in[i] = atoi((*fRowPtr)->GetField(*fIter));
669 ++fIter;
670 }
671}
672
673//________________________________________________________________________
674void MBufferSQL::ReadFastArray(UInt_t *ui, Int_t n)
675{
676 // ReadFastArray SQL implementation.
677 for(int i=0; i<n; ++i) {
678 ui[i] = atoi((*fRowPtr)->GetField(*fIter));
679 ++fIter;
680 }
681}
682
683//________________________________________________________________________
684void MBufferSQL::ReadFastArray(Long_t *l, Int_t n)
685{
686 // ReadFastArray SQL implementation.
687 for(int i=0; i<n; ++i) {
688 l[i] = atol((*fRowPtr)->GetField(*fIter));
689 ++fIter;
690 }
691}
692
693//________________________________________________________________________
694void MBufferSQL::ReadFastArray(ULong_t *ul, Int_t n)
695{
696 // ReadFastArray SQL implementation.
697 for(int i=0; i<n; ++i) {
698 (*this) >> ul[i];
699 }
700}
701
702//________________________________________________________________________
703void MBufferSQL::ReadFastArray(Long64_t *ll, Int_t n)
704{
705 // ReadFastArray SQL implementation.
706 for(int i=0; i<n; ++i) {
707 (*this) >> ll[i];
708 }
709}
710
711//________________________________________________________________________
712void MBufferSQL::ReadFastArray(ULong64_t *ull, Int_t n)
713{
714 // ReadFastArray SQL implementation.
715 for(int i=0; i<n; ++i) {
716 (*this) >> ull[i];
717 }
718}
719
720//________________________________________________________________________
721void MBufferSQL::ReadFastArray(Float_t *f, Int_t n)
722{
723 // ReadFastArray SQL implementation.
724 for(int i=0; i<n; ++i) {
725 f[i] = atof((*fRowPtr)->GetField(*fIter));
726 ++fIter;
727 }
728}
729
730//________________________________________________________________________
731void MBufferSQL::ReadFastArray(Double_t *d, Int_t n)
732{
733 // ReadFastArray SQL implementation.
734 for(int i=0; i<n; ++i) {
735 d[i] = atof((*fRowPtr)->GetField(*fIter));
736 ++fIter;
737 }
738}
739
740//________________________________________________________________________
741void MBufferSQL::ReadFastArrayFloat16(Float_t *, Int_t , TStreamerElement *)
742{
743 // ReadFastArray SQL implementation.
744 Fatal("ReadFastArrayFloat16(Float_t *, Int_t , TStreamerElement *)","Not implemented yet");
745}
746
747//________________________________________________________________________
748void MBufferSQL::ReadFastArrayDouble32(Double_t *, Int_t , TStreamerElement *)
749{
750 // ReadFastArray SQL implementation.
751 Fatal("ReadFastArrayDouble32(Double_t *, Int_t , TStreamerElement *)","Not implemented yet");
752}
753
754//________________________________________________________________________
755void MBufferSQL::ReadFastArray(void *, const TClass *, Int_t, TMemberStreamer *, const TClass *)
756{
757 // ReadFastArray SQL implementation.
758 Fatal("ReadFastArray(void *, const TClass *, Int_t, TMemberStreamer *, const TClass *)","Not implemented yet");
759}
760
761//________________________________________________________________________
762void MBufferSQL::ReadFastArray(void **, const TClass *, Int_t, Bool_t, TMemberStreamer *, const TClass *)
763{
764 // ReadFastArray SQL implementation.
765 Fatal("ReadFastArray(void **, const TClass *, Int_t, Bool_t, TMemberStreamer *, const TClass *)","Not implemented yet");
766}
767
768//________________________________________________________________________
769void MBufferSQL::ResetOffset()
770{
771 // Reset Offset.
772 fIter = fColumnVec->begin();
773}
774
775#if 0
776//________________________________________________________________________
777void MBufferSQL::insert_test(const char* dsn, const char* usr,
778 const char* pwd, const TString& tblname)
779{
780 TString str;
781 TString select = "select * from ";
782 TString sql;
783 TSQLStatement* stmt;
784 sql = select + "ins";
785
786 con = gSQLDriverManager->GetConnection(dsn,usr,pwd);
787
788 if(!con)
789 printf("\n\n\nConnection NOT Successful\n\n\n");
790 else
791 printf("\n\n\nConnection Sucessful\n\n\n");
792
793
794
795 stmt = con->CreateStatement(0, odbc::ResultSet::CONCUR_READ_ONLY);
796
797 ptr = stmt->ExecuteQuery(sql.Data());
798 if(!ptr) printf("No recorSet found!");
799
800 ptr->Next();
801 ptr->MoveToInsertRow();
802 cerr << "IsAfterLast(): " << ptr->IsAfterLast() << endl;
803 ptr->UpdateInt(1, 5555);
804 ptr->InsertRow();
805 con->Commit();
806
807 ptr1 = stmt->ExecuteQuery(sql.Data());
808
809}
810#endif
Note: See TracBrowser for help on using the repository browser.