Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TBufferSQL.cxx
Go to the documentation of this file.
1// @(#)root/tree:$Id$
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/** \class TBufferSQL
13\ingroup tree
14Implement TBuffer for a SQL backend.
15*/
16
17#include "TError.h"
18
19#include "TBasketSQL.h"
20#include "TBufferSQL.h"
21#include "TSQLResult.h"
22#include "TSQLRow.h"
23
24#include <cstdio>
25#include <cstdlib>
26#include <iostream>
27
29
30////////////////////////////////////////////////////////////////////////////////
31/// Constructor.
32
34 TString *insert_query, TSQLRow ** r) :
36 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
37{
38 fIter = fColumnVec->begin();
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor.
43
44TBufferSQL::TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc,
45 TString *insert_query, TSQLRow ** r) :
46 TBufferFile(mode,bufsiz),
47 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
48{
49 fIter = fColumnVec->begin();
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Constructor.
54
55TBufferSQL::TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc,
56 TString *insert_query, TSQLRow ** r,
57 void *buf, bool adopt) :
58 TBufferFile(mode,bufsiz,buf,adopt),
59 fColumnVec(vc), fInsertQuery(insert_query), fRowPtr(r)
60{
61 fIter = fColumnVec->begin();
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Constructor.
66
67TBufferSQL::TBufferSQL() : TBufferFile(), fColumnVec(nullptr),fInsertQuery(nullptr),fRowPtr(nullptr)
68{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Destructor.
73
75{
76 delete fColumnVec;
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// Operator>>
81
83{
84 b = (bool)atoi((*fRowPtr)->GetField(*fIter));
85
86 if (fIter != fColumnVec->end()) ++fIter;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Operator>>
91
93{
94 c = (Char_t)atoi((*fRowPtr)->GetField(*fIter));
95
96 if (fIter != fColumnVec->end()) ++fIter;
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Operator>>
101
103{
104 h = (Short_t)atoi((*fRowPtr)->GetField(*fIter));
105
106 if (fIter != fColumnVec->end()) ++fIter;
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Operator>>
111
113{
114 i = atoi((*fRowPtr)->GetField(*fIter));
115
116 if (fIter != fColumnVec->end()) ++fIter;
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Operator>>
121
123{
124 f = atof((*fRowPtr)->GetField(*fIter));
125
126 if (fIter != fColumnVec->end()) ++fIter;
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Operator>>
131
133{
134 l = atol((*fRowPtr)->GetField(*fIter));
135
136 if (fIter != fColumnVec->end()) ++fIter;
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Operator>>
141
143{
144 d = atof((*fRowPtr)->GetField(*fIter));
145
146 if (fIter != fColumnVec->end()) ++fIter;
147}
148
149////////////////////////////////////////////////////////////////////////////////
150/// Operator<<
151
153{
154 (*fInsertQuery) += b;
155 (*fInsertQuery) += ",";
156 if (fIter != fColumnVec->end()) ++fIter;
157}
158
159////////////////////////////////////////////////////////////////////////////////
160/// Operator<<
161
163{
164 (*fInsertQuery) += c;
165 (*fInsertQuery) += ",";
166 if (fIter != fColumnVec->end()) ++fIter;
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Operator<<
171
173{
174 (*fInsertQuery) += h;
175 (*fInsertQuery) += ",";
176 if (fIter != fColumnVec->end()) ++fIter;
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// Operator<<
181
183{
184 (*fInsertQuery) += i;
185 (*fInsertQuery) += ",";
186 if (fIter != fColumnVec->end()) ++fIter;
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Operator<<
191
193{
194 (*fInsertQuery) += l;
195 (*fInsertQuery) += ",";
196 if (fIter != fColumnVec->end()) ++fIter;
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Operator<<
201
203{
204 (*fInsertQuery) += f;
205 (*fInsertQuery) += ",";
206 if (fIter != fColumnVec->end()) ++fIter;
207}
208
209////////////////////////////////////////////////////////////////////////////////
210/// Operator<<
211
213{
214 (*fInsertQuery) += d;
215 (*fInsertQuery) += ",";
216 if (fIter != fColumnVec->end()) ++fIter;
217}
218
219////////////////////////////////////////////////////////////////////////////////
220/// Operator>>
221
223{
224 uc = (UChar_t)atoi((*fRowPtr)->GetField(*fIter));
225
226 if (fIter != fColumnVec->end()) ++fIter;
227}
228
229////////////////////////////////////////////////////////////////////////////////
230/// Operator>>
231
233{
234 us = (UShort_t)atoi((*fRowPtr)->GetField(*fIter));
235
236 if (fIter != fColumnVec->end()) ++fIter;
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Operator>>
241
243{
244 TString val = (*fRowPtr)->GetField(*fIter);
245 Int_t code = sscanf(val.Data(), "%u",&ui);
246 if(code == 0) Error("operator>>(UInt_t&)","Error reading UInt_t");
247
248 if (fIter != fColumnVec->end()) ++fIter;
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// Operator>>
253
255{
256 TString val = (*fRowPtr)->GetField(*fIter);
257 Int_t code = sscanf(val.Data(), "%lu",&ul);
258 if(code == 0) Error("operator>>(ULong_t&)","Error reading ULong_t");
259
260 if (fIter != fColumnVec->end()) ++fIter;
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Operator>>
265
267{
268 TString val = (*fRowPtr)->GetField(*fIter);
269 Int_t code = sscanf(val.Data(), "%lld",&ll);
270 if(code == 0) Error("operator>>(ULong_t&)","Error reading Long64_t");
271
272 if (fIter != fColumnVec->end()) ++fIter;
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// Operator>>
277
279{
280 TString val = (*fRowPtr)->GetField(*fIter);
281 Int_t code = sscanf(val.Data(), "%llu",&ull);
282 if(code == 0) Error("operator>>(ULong_t&)","Error reading ULong64_t");
283
284 if (fIter != fColumnVec->end()) ++fIter;
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Operator>>
289
291{
292 strcpy(str,(*fRowPtr)->GetField(*fIter)); // Legacy interface, we have no way to know the user's buffer size ....
293 if (fIter != fColumnVec->end()) ++fIter;
294}
295
296////////////////////////////////////////////////////////////////////////////////
297/// Read a TString
298
300{
301 s = (*fRowPtr)->GetField(*fIter);
302 if (fIter != fColumnVec->end()) ++fIter;
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Write a TString
307
309{
310 (*fInsertQuery) += s;
311 (*fInsertQuery) += ",";
312 if (fIter != fColumnVec->end()) ++fIter;
313}
314
315
316
317////////////////////////////////////////////////////////////////////////////////
318/// Read a std::string
319
320void TBufferSQL::ReadStdString(std::string *s)
321{
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// Write a std::string
327
328void TBufferSQL::WriteStdString(const std::string *s)
329{
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Read a char* string
335
337{
339}
340
341////////////////////////////////////////////////////////////////////////////////
342/// Write a char* string
343
345{
347}
348
349
350// Method to send to database.
351
352////////////////////////////////////////////////////////////////////////////////
353/// Operator<<
354
356{
357 (*fInsertQuery) += uc;
358 (*fInsertQuery) += ",";
359 ++fIter;
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Operator<<
364
366{
367 (*fInsertQuery) += us;
368 (*fInsertQuery) += ",";
369 ++fIter;
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// Operator<<
374
376{
377 (*fInsertQuery) += ui;
378 (*fInsertQuery) += ",";
379 ++fIter;
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Operator<<
384
386{
387 (*fInsertQuery) += ul;
388 (*fInsertQuery) += ",";
389 ++fIter;
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Operator<<
394
396{
397 (*fInsertQuery) += ll;
398 (*fInsertQuery) += ",";
399 ++fIter;
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Operator<<
404
406{
407 (*fInsertQuery) += ull;
408 (*fInsertQuery) += ",";
409 ++fIter;
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Operator<<
414
416{
417 (*fInsertQuery) += "\"";
418 (*fInsertQuery) += str;
419 (*fInsertQuery) += "\",";
420 ++fIter;
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// WriteFastArray SQL implementation.
425/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
426
428{
429 constexpr Int_t dataWidth = 2; // 2 chars
430 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
431 if (n < 0 || n > maxElements)
432 {
433 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
434 return; // In case the user re-routes the error handler to not die when Fatal is called)
435 }
436 for(int i=0; i<n; ++i) {
437 (*fInsertQuery) += b[i];
438 (*fInsertQuery) += ",";
439 ++fIter;
440 }
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// WriteFastArray SQL implementation.
445/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
446
448{
449 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more
450 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
451 if (n < 0 || n > maxElements)
452 {
453 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
454 return; // In case the user re-routes the error handler to not die when Fatal is called)
455 }
456 for(int i=0; i<n; ++i) {
457 (*fInsertQuery) += (Short_t)c[i];
458 (*fInsertQuery) += ",";
459 ++fIter;
460 }
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// WriteFastArray SQL implementation.
465/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
466
468{
469 constexpr Int_t dataWidth = 4; // 4 chars
470 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
471 if (maxElements < 1)
472 {
473 Fatal("WriteFastArrayString", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", 1LL, maxElements);
474 return; // In case the user re-routes the error handler to not die when Fatal is called)
475 }
476 (*fInsertQuery) += "\"";
477 (*fInsertQuery) += c;
478 (*fInsertQuery) += "\",";
479 ++fIter;
480}
481
482////////////////////////////////////////////////////////////////////////////////
483/// WriteFastArray SQL implementation.
484/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
485
487{
488 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
489 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
490 if (n < 0 || n > maxElements)
491 {
492 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
493 return; // In case the user re-routes the error handler to not die when Fatal is called)
494 }
495 for(int i=0; i<n; ++i) {
496 (*fInsertQuery) += uc[i];
497 (*fInsertQuery) += ",";
498 ++fIter;
499 }
500}
501
502////////////////////////////////////////////////////////////////////////////////
503/// WriteFastArray SQL implementation.
504/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
505
507{
508 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
509 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
510 if (n < 0 || n > maxElements)
511 {
512 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
513 return; // In case the user re-routes the error handler to not die when Fatal is called)
514 }
515 for(int i=0; i<n; ++i) {
516 (*fInsertQuery) += h[i];
517 (*fInsertQuery) += ",";
518 ++fIter;
519 }
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// WriteFastArray SQL implementation.
524/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
525
526
528{
529 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
530 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
531 if (n < 0 || n > maxElements)
532 {
533 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
534 return; // In case the user re-routes the error handler to not die when Fatal is called)
535 }
536 for(int i=0; i<n; ++i) {
537 (*fInsertQuery) += us[i];
538 (*fInsertQuery) += ",";
539 ++fIter;
540 }
541}
542
543////////////////////////////////////////////////////////////////////////////////
544/// WriteFastArray SQL implementation.
545/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
546
548{
549 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
550 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
551 if (n < 0 || n > maxElements)
552 {
553 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
554 return; // In case the user re-routes the error handler to not die when Fatal is called)
555 }
556 // std::cerr << "Column: " <<*fIter << " i:" << *ii << std::endl;
557 for(int i=0; i<n; ++i) {
558 (*fInsertQuery) += ii[i];
559 (*fInsertQuery) += ",";
560 ++fIter;
561 }
562}
563
564////////////////////////////////////////////////////////////////////////////////
565/// WriteFastArray SQL implementation.
566/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
567
569{
570 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
571 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
572 if (n < 0 || n > maxElements)
573 {
574 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
575 return; // In case the user re-routes the error handler to not die when Fatal is called)
576 }
577 for(int i=0; i<n; ++i) {
578 (*fInsertQuery) += ui[i];
579 (*fInsertQuery) += ",";
580 ++fIter;
581 }
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// WriteFastArray SQL implementation.
586/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
587
589{
590 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
591 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
592 if (n < 0 || n > maxElements)
593 {
594 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
595 return; // In case the user re-routes the error handler to not die when Fatal is called)
596 }
597 for(int i=0; i<n; ++i) {
598 (*fInsertQuery)+= l[i];
599 (*fInsertQuery)+= ",";
600 ++fIter;
601 }
602}
603
604////////////////////////////////////////////////////////////////////////////////
605/// WriteFastArray SQL implementation.
606/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
607
609{
610 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
611 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
612 if (n < 0 || n > maxElements)
613 {
614 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
615 return; // In case the user re-routes the error handler to not die when Fatal is called)
616 }
617 for(int i=0; i<n; ++i) {
618 (*fInsertQuery) += ul[i];
619 (*fInsertQuery) += ",";
620 ++fIter;
621 }
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// WriteFastArray SQL implementation.
626/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
627
629{
630 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
631 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
632 if (n < 0 || n > maxElements)
633 {
634 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
635 return; // In case the user re-routes the error handler to not die when Fatal is called)
636 }
637 for(int i=0; i<n; ++i) {
638 (*fInsertQuery) += l[i];
639 (*fInsertQuery) += ",";
640 ++fIter;
641 }
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// WriteFastArray SQL implementation.
646/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
647
649{
650 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
651 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
652 if (n < 0 || n > maxElements)
653 {
654 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
655 return; // In case the user re-routes the error handler to not die when Fatal is called)
656 }
657 for(int i=0; i<n; ++i) {
658 (*fInsertQuery) += ul[i];
659 (*fInsertQuery) += ",";
660 ++fIter;
661 }
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// WriteFastArray SQL implementation.
666/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
667
669{
670 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
671 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
672 if (n < 0 || n > maxElements)
673 {
674 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
675 return; // In case the user re-routes the error handler to not die when Fatal is called)
676 }
677 for(int i=0; i<n; ++i) {
678 (*fInsertQuery) += f[i];
679 (*fInsertQuery) += ",";
680 ++fIter;
681 }
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// WriteFastArray SQL implementation.
686/// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
687
689{
690 constexpr Int_t dataWidth = 2; // at least 2 chars, but could be more.
691 const Int_t maxElements = (std::numeric_limits<Int_t>::max() - Length())/dataWidth;
692 if (n < 0 || n > maxElements)
693 {
694 Fatal("WriteFastArray", "Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", n, maxElements);
695 return; // In case the user re-routes the error handler to not die when Fatal is called)
696 }
697 for(int i=0; i<n; ++i) {
698 (*fInsertQuery) += d[i];
699 (*fInsertQuery )+= ",";
700 ++fIter;
701 }
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// WriteFastArray SQL implementation.
706// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
707
709{
710 Fatal("WriteFastArray(void*, const TClass*, Long64_t, TMemberStreamer *)","Not implemented yet");
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// WriteFastArray SQL implementation.
715// \note Due to the current limit of the buffer size, the function aborts execution of the program in case of underflow or overflow. See https://github.com/root-project/root/issues/6734 for more details.
716
718{
719 Fatal("WriteFastArray(void **, const TClass*, Long64_t, bool, TMemberStreamer*)","Not implemented yet");
720 return 0;
721}
722
723////////////////////////////////////////////////////////////////////////////////
724/// ReadFastArray SQL implementation.
725
727{
728 for(int i=0; i<n; ++i) {
729 b[i] = (bool)atoi((*fRowPtr)->GetField(*fIter));
730 ++fIter;
731 }
732}
733
734////////////////////////////////////////////////////////////////////////////////
735/// ReadFastArray SQL implementation.
736
738{
739 for(int i=0; i<n; ++i) {
740 c[i] = (Char_t)atoi((*fRowPtr)->GetField(*fIter));
741 ++fIter;
742 }
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// ReadFastArray SQL implementation.
747
749{
750 strcpy(c,((*fRowPtr)->GetField(*fIter)));
751 ++fIter;
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// ReadFastArray SQL implementation.
756
758{
759 for(int i=0; i<n; ++i) {
760 uc[i] = (UChar_t)atoi((*fRowPtr)->GetField(*fIter));
761 ++fIter;
762 }
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// ReadFastArray SQL implementation.
767
769{
770 for(int i=0; i<n; ++i) {
771 s[i] = (Short_t)atoi((*fRowPtr)->GetField(*fIter));
772 ++fIter;
773 }
774}
775
776////////////////////////////////////////////////////////////////////////////////
777/// ReadFastArray SQL implementation.
778
780{
781 for(int i=0; i<n; ++i) {
782 us[i] = (UShort_t)atoi((*fRowPtr)->GetField(*fIter));
783 ++fIter;
784 }
785}
786
787////////////////////////////////////////////////////////////////////////////////
788/// ReadFastArray SQL implementation.
789
791{
792 for(int i=0; i<n; ++i) {
793 in[i] = atoi((*fRowPtr)->GetField(*fIter));
794 ++fIter;
795 }
796}
797
798////////////////////////////////////////////////////////////////////////////////
799/// ReadFastArray SQL implementation.
800
802{
803 for(int i=0; i<n; ++i) {
804 ui[i] = atoi((*fRowPtr)->GetField(*fIter));
805 ++fIter;
806 }
807}
808
809////////////////////////////////////////////////////////////////////////////////
810/// ReadFastArray SQL implementation.
811
813{
814 for(int i=0; i<n; ++i) {
815 l[i] = atol((*fRowPtr)->GetField(*fIter));
816 ++fIter;
817 }
818}
819
820////////////////////////////////////////////////////////////////////////////////
821/// ReadFastArray SQL implementation.
822
824{
825 for(int i=0; i<n; ++i) {
826 (*this) >> ul[i];
827 }
828}
829
830////////////////////////////////////////////////////////////////////////////////
831/// ReadFastArray SQL implementation.
832
834{
835 for(int i=0; i<n; ++i) {
836 (*this) >> ll[i];
837 }
838}
839
840////////////////////////////////////////////////////////////////////////////////
841/// ReadFastArray SQL implementation.
842
844{
845 for(int i=0; i<n; ++i) {
846 (*this) >> ull[i];
847 }
848}
849
850////////////////////////////////////////////////////////////////////////////////
851/// ReadFastArray SQL implementation.
852
854{
855 for(int i=0; i<n; ++i) {
856 f[i] = atof((*fRowPtr)->GetField(*fIter));
857 ++fIter;
858 }
859}
860
861////////////////////////////////////////////////////////////////////////////////
862/// ReadFastArray SQL implementation.
863
865{
866 for(int i=0; i<n; ++i) {
867 d[i] = atof((*fRowPtr)->GetField(*fIter));
868 ++fIter;
869 }
870}
871
872////////////////////////////////////////////////////////////////////////////////
873/// ReadFastArray SQL implementation.
874
876{
877 Fatal("ReadFastArrayFloat16(Float_t *, Int_t , TStreamerElement *)","Not implemented yet");
878}
879
880////////////////////////////////////////////////////////////////////////////////
881/// Read array of Float16_t from buffer
882
884{
885 Fatal("ReadFastArrayWithFactor(Float_t *, Int_t, Double_t, Double_t)","Not implemented yet");
886}
887
888////////////////////////////////////////////////////////////////////////////////
889/// Read array of Float16_t from buffer
890
892{
893 Fatal("ReadFastArrayWithNbits(Float_t *, Int_t , Int_t )","Not implemented yet");
894}
895
896////////////////////////////////////////////////////////////////////////////////
897/// Read array of Double32_t from buffer
898
900{
901 Fatal("ReadFastArrayWithFactor(Double_t *, Int_t, Double_t, Double_t)","Not implemented yet");
902}
903
904////////////////////////////////////////////////////////////////////////////////
905/// Read array of Double32_t from buffer
906
908{
909 Fatal("ReadFastArrayWithNbits(Double_t *, Int_t , Int_t )","Not implemented yet");
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// ReadFastArray SQL implementation.
914
916{
917 Fatal("ReadFastArrayDouble32(Double_t *, Int_t , TStreamerElement *)","Not implemented yet");
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// ReadFastArray SQL implementation.
922
924{
925 Fatal("ReadFastArray(void *, const TClass *, Int_t, TMemberStreamer *, const TClass *)","Not implemented yet");
926}
927
928////////////////////////////////////////////////////////////////////////////////
929/// ReadFastArray SQL implementation.
930
931void TBufferSQL::ReadFastArray(void **, const TClass *, Int_t, bool, TMemberStreamer *, const TClass *)
932{
933 Fatal("ReadFastArray(void **, const TClass *, Int_t, bool, TMemberStreamer *, const TClass *)","Not implemented yet");
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// Reset Offset.
938
940{
941 fIter = fColumnVec->begin();
942}
943
944#if 0
945////////////////////////////////////////////////////////////////////////////////
946
947void TBufferSQL::insert_test(const char* dsn, const char* usr,
948 const char* pwd, const TString& tblname)
949{
950 TString str;
951 TString select = "select * from ";
952 TString sql;
953 TSQLStatement* stmt;
954 sql = select + "ins";
955
956 con = gSQLDriverManager->GetConnection(dsn,usr,pwd);
957
958 if(!con)
959 printf("\n\n\nConnection NOT Successful\n\n\n");
960 else
961 printf("\n\n\nConnection Sucessful\n\n\n");
962
963 stmt = con->CreateStatement(0, odbc::ResultSet::CONCUR_READ_ONLY);
964
965 ptr = stmt->ExecuteQuery(sql.Data());
966 if(!ptr) printf("No recorSet found!");
967
968 ptr->Next();
969 ptr->MoveToInsertRow();
970 std::cerr << "IsAfterLast(): " << ptr->IsAfterLast() << std::endl;
971 ptr->UpdateInt(1, 5555);
972 ptr->InsertRow();
973 con->Commit();
974
975 ptr1 = stmt->ExecuteQuery(sql.Data());
976
977}
978#endif
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
unsigned short UShort_t
Definition RtypesCore.h:40
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
long long Long64_t
Definition RtypesCore.h:80
unsigned long long ULong64_t
Definition RtypesCore.h:81
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char mode
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
void ReadCharStar(char *&s) override
Read char* from TBuffer.
void WriteCharStar(char *s) override
Write char* into TBuffer.
void WriteStdString(const std::string *s) override
Write std::string to TBuffer.
void ReadStdString(std::string *s) override
Read std::string from TBuffer.
Implement TBuffer for a SQL backend.
Definition TBufferSQL.h:30
void ReadLong(Long_t &l) final
Operator>>
void WriteDouble(Double_t d) final
Operator<<.
void ReadFastArray(bool *, Int_t) final
ReadFastArray SQL implementation.
TBufferSQL()
Constructor.
void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=nullptr) final
ReadFastArray SQL implementation.
void WriteFastArrayString(const Char_t *c, Long64_t n) final
WriteFastArray SQL implementation.
void WriteULong(ULong_t l) final
Operator<<.
void WriteUInt(UInt_t i) final
Operator<<.
void WriteFloat(Float_t f) final
Operator<<.
void ReadULong64(ULong64_t &l) final
Operator>>
void ReadCharStar(char *&s) final
Read a char* string.
void ReadInt(Int_t &i) final
Operator>>
void ReadTString(TString &s) final
Read a TString.
void WriteUChar(UChar_t c) final
Operator<<.
void WriteShort(Short_t s) final
Operator<<.
void WriteUShort(UShort_t s) final
Operator<<.
void ReadShort(Short_t &s) final
Operator>>
void WriteLong(Long_t l) final
Operator<<.
void ReadLong64(Long64_t &l) final
Operator>>
void ReadChar(Char_t &c) final
Operator>>
std::vector< Int_t > * fColumnVec
Definition TBufferSQL.h:35
void ReadFastArrayString(Char_t *, Int_t) final
ReadFastArray SQL implementation.
void WriteStdString(const std::string *s) final
Write a std::string.
void ReadStdString(std::string *s) final
Read a std::string.
void WriteInt(Int_t i) final
Operator<<.
void ReadUShort(UShort_t &s) final
Operator>>
void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final
Read array of Float16_t from buffer.
void WriteTString(const TString &s) final
Write a TString.
void ReadUInt(UInt_t &i) final
Operator>>
void WriteULong64(ULong64_t l) final
Operator<<.
~TBufferSQL() override
Destructor.
void ReadCharP(Char_t *c) final
Operator>>
void WriteCharStar(char *s) final
Write a char* string.
void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final
Read array of Float16_t from buffer.
std::vector< Int_t >::const_iterator fIter
Definition TBufferSQL.h:33
void WriteFastArray(const bool *b, Long64_t n) final
WriteFastArray SQL implementation.
void ResetOffset()
Reset Offset.
void WriteBool(bool b) final
Operator<<.
void WriteCharP(const Char_t *c) final
Operator<<.
void WriteLong64(Long64_t l) final
Operator<<.
void ReadDouble(Double_t &d) final
Operator>>
void ReadULong(ULong_t &l) final
Operator>>
void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=nullptr) final
ReadFastArray SQL implementation.
void ReadFloat(Float_t &f) final
Operator>>
void WriteChar(Char_t c) final
Operator<<.
void ReadBool(bool &b) final
Operator>>
void ReadUChar(UChar_t &c) final
Operator>>
Int_t Length() const
Definition TBuffer.h:100
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1015
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
const Int_t n
Definition legend1.C:16
TLine l
Definition textangle.C:4
static byte * ptr1
Definition gifdecode.c:16