Commit 1d468ee0 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix slow processing of pretty json files by BSON tables

parent fc98a6d5
......@@ -376,7 +376,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
} // endswitch ReadDB
} else
jsp = bp->GetArrayValue(bdp, i);
jsp = bp->GetNext(jsp);
if (!(row = (jsp) ? bp->GetObject(jsp) : NULL))
break;
......@@ -2185,7 +2185,9 @@ void BSONCOL::WriteColumn(PGLOBAL g)
TDBBSON::TDBBSON(PGLOBAL g, PBDEF tdp, PTXF txfp) : TDBBSN(g, tdp, txfp)
{
Docp = NULL;
Docrow = NULL;
Multiple = tdp->Multiple;
Docsize = 0;
Done = Changed = false;
Bp->SetPretty(2);
} // end of TDBBSON standard constructor
......@@ -2193,7 +2195,9 @@ TDBBSON::TDBBSON(PGLOBAL g, PBDEF tdp, PTXF txfp) : TDBBSN(g, tdp, txfp)
TDBBSON::TDBBSON(PBTDB tdbp) : TDBBSN(tdbp)
{
Docp = tdbp->Docp;
Docrow = tdbp->Docrow;
Multiple = tdbp->Multiple;
Docsize = tdbp->Docsize;
Done = tdbp->Done;
Changed = tdbp->Changed;
} // end of TDBBSON copy constructor
......@@ -2374,6 +2378,7 @@ int TDBBSON::MakeDocument(PGLOBAL g)
} // endif jsp
Docsize = Bp->GetSize(Docp);
Done = true;
return RC_OK;
} // end of MakeDocument
......@@ -2388,7 +2393,7 @@ int TDBBSON::Cardinality(PGLOBAL g)
else if (Cardinal < 0) {
if (!Multiple) {
if (MakeDocument(g) == RC_OK)
Cardinal = Bp->GetSize(Docp);
Cardinal = Docsize;
} else
return 10;
......@@ -2530,12 +2535,9 @@ int TDBBSON::ReadDB(PGLOBAL)
NextSame = false;
M++;
rc = RC_OK;
} else if (++Fpos < (signed)Bp->GetSize(Docp)) {
Row = Bp->GetArrayValue(Docp, Fpos);
if (Row->Type == TYPE_JVAL)
Row = Bp->GetBson(Row);
} else if (++Fpos < Docsize) {
Docrow = (Docrow) ? Bp->GetNext(Docrow) : Bp->GetArrayValue(Docp, Fpos);
Row = (Docrow->Type == TYPE_JVAL) ? Bp->GetBson(Docrow) : Docrow;
SameRow = 0;
M = 1;
rc = RC_OK;
......
......@@ -318,7 +318,9 @@ class DllExport TDBBSON : public TDBBSN {
// Members
PBVAL Docp; // The document array
PBVAL Docrow; // Document row
int Multiple; // 0: No 1: DIR 2: Section 3: filelist
int Docsize; // The document size
bool Done; // True when document parsing is done
bool Changed; // After Update, Insert or Delete
}; // end of class TDBBSON
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment