188 TString stropt = option;
189 stropt.ReplaceAll(
" ",
"");
192 t1 = stropt.Index(pattern.Data());
193 t1 = t2 = stropt.Index(
"=",t1) + 1;
194 TString
str = stropt(t1,1024);
197 for(
int i=0;isdigit(tmp[
i])!=0;i++) t2=i+1;
213 if( (fd=fopen(filename.Data(),
"w")) == NULL ) {
221 for(
int i=1;
i <= ncollumns; ++
i ) {
257 while ( rs->
Next() ) {
260 for(
int i=1;
i<ncollumns+1;
i++) {
279 if(
i<ncollumns) str +=
",";
282 fputs(str.Data(),
fd);
302 Warning(
"Print()",
"TSQLResultSet is destroyed\n");
309 TString stropt = option;
311 if(stropt.Contains(
"file")) {
323 Int_t save_row = th->
GetRow();
327 Int_t srow = save_row;
333 if(stropt.Contains(
"begin")) {
335 srow = atoi(str.Data());
338 if (stropt.Contains(
"end")) {
340 erow = atoi(str.Data());
343 if (stropt.Contains(
"nrows")) {
345 nrows = atoi(str.Data());
350 nn =
new Int_t[ncols+1];
351 pd1 =
new Int_t[ncols+1];
353 for(
int i=1;
i<ncols+1;
i++) {
356 dl = colname.Length() + 2;
357 nn[
i] = dl > ds ? dl : ds;
362 for(
int i=1;
i<ncols+1;
i++) {
363 cout <<
"+"; cout.fill(
'-'); cout.width(nn[
i]+1); cout <<
"+";
366 for(
int i=1;
i<ncols+1;
i++) {
368 cout <<
"| " << colname <<
" ";
369 cout.fill(
' '); cout.width(pd1[
i]+1); cout <<
"|";
373 for(
int i=1;
i<ncols+1;
i++) {
374 cout <<
"+"; cout.fill(
'-'); cout.width(nn[
i]+1); cout <<
"+";
384 while ( th->
Next() && cur_row+2 < srow) cur_row = th->
GetRow();
392 while ( th->
Next() ) {
394 if(nrows > 0 && nr >= nrows)
break;
395 if(erow > 0 && cur_row >= erow )
break;
399 for(
int i=1;
i<ncols+1;
i++) {
402 pd2 = nn[
i] - str.Length();
403 cout.fill(
' '); cout.width(pd2); cout <<
"|";
407 for(
int i=1;
i<ncols+1;
i++) {
408 cout <<
"+"; cout.fill(
'-'); cout.width(nn[
i]+1); cout <<
"+";
415 Warning(
"Print",
"To set cursor to initial position -> re-execute Query.");
448 Int_t yy,
mm, dd, hh, mi, ss;
451 Int_t save_row =
GetRow();
454 Int_t srow = begin > 0 ? begin : save_row;
455 Int_t erow = end > 0 ? end : -1;
467 for(
int i=1;
i <= ncollumns; ++
i ) {
476 siz +=
sizeof(Int_t);
481 siz +=
sizeof(UInt_t);
486 siz +=
sizeof(Short_t);
489 siz +=
sizeof(Float_t);
501 siz +=
sizeof(Double_t);
507 for(
int i=1;
i <= ncollumns; ++
i ) {
515 sprintf(tmpstr,
"[%d]",prec);
516 leafList += clmname + tmpstr +
"/C:";
519 leafList += clmname +
"/I:";
524 leafList += clmname +
"/i:";
529 leafList += clmname +
"/S:";
532 leafList += clmname +
"/F:";
544 leafList += clmname +
"/D:";
548 if(!leafList.IsNull()) leafList.Resize(leafList.Length()-1);
555 if(tblname.IsNull()) {
557 sprintf(tmpstr,
"%d",rand()%1000);
563 TTree*
tree =
new TTree(tblname.Data(),
"Created by TSQLResultSet:Tree() method");
565 tree->Branch(tblname.Data(),(
void*)buf,leafList.Data());
575 while (
Next() && cur_row+2 < srow) cur_row =
GetRow();
584 if(erow>0 && cur_row >= erow)
break;
587 for(
int i=1;
i <= ncollumns; ++
i ) {
595 memcpy(&buf[offset],str.Data(),siz);
600 memcpy(&buf[offset],&intg,siz);
605 siz =
sizeof(Short_t);
607 memcpy(&buf[offset],&shrt,siz);
610 siz =
sizeof(Float_t);
612 memcpy(&buf[offset],&flt,siz);
617 siz =
sizeof(UInt_t);
619 sscanf(str.Data(),
"%d-%d-%d %d:%d:%d",
620 &yy, &
mm, &dd, &hh, &mi, &ss);
621 tp.tm_year = yy-1900;
628 t = (UInt_t)mktime(&
tp);
629 memcpy(&buf[offset],&t,siz);
641 siz =
sizeof(Double_t);
643 memcpy(&buf[offset],&dbl,siz);
657 Warning(
"Print",
"To set cursor to initial position -> re-execute Query.");