Skip to content

Commit 970c90e

Browse files
committed
Merge branch 'ob-10.1' into 10.1
2 parents 2b415ea + 5c0c623 commit 970c90e

17 files changed

+604
-278
lines changed

storage/connect/domdoc.cpp

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
8989
/******************************************************************/
9090
/* Initialize XML parser and check library compatibility. */
9191
/******************************************************************/
92-
bool DOMDOC::Initialize(PGLOBAL g)
93-
{
94-
if (TestHr(g, CoInitialize(NULL)))
92+
bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
93+
{
94+
if (zipped && InitZip(g, entry))
95+
return true;
96+
97+
if (TestHr(g, CoInitialize(NULL)))
9598
return true;
9699

97100
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
98101
return true;
99102

100103
return MakeNSlist(g);
101-
} // end of Initialize
104+
} // end of Initialize
102105

103106
/******************************************************************/
104107
/* Parse the XML file and construct node tree in memory. */
105108
/******************************************************************/
106-
bool DOMDOC::ParseFile(char *fn)
107-
{
108-
// Load the document
109+
bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
110+
{
111+
bool b;
112+
109113
Docp->async = false;
110114

111-
if (!(bool)Docp->load((_bstr_t)fn))
115+
if (zip) {
116+
// Parse an in memory document
117+
char *xdoc = GetMemDoc(g, fn);
118+
119+
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
120+
} else
121+
// Load the document
122+
b = (bool)Docp->load((_bstr_t)fn);
123+
124+
if (!b)
112125
return true;
113126

114127
return false;
115-
} // end of ParseFile
128+
} // end of ParseFile
116129

117130
/******************************************************************/
118131
/* Create or reuse an Xblock for this document. */
@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
239252
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
240253
{
241254
CloseXMLFile(g, xp, false);
255+
CloseZip();
242256
} // end of Close
243257

244258
/* ----------------------- class DOMNODE ------------------------ */
@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
616630
/* Reset the pointer on the deleted item. */
617631
/******************************************************************/
618632
bool DOMNODELIST::DropItem(PGLOBAL g, int n)
619-
{
620-
if (Listp == NULL || Listp->length <= n)
621-
return true;
633+
{
634+
if (Listp == NULL || Listp->length < n)
635+
return true;
622636

623637
//Listp->item[n] = NULL; La propriété n'a pas de méthode 'set'
624638
return false;
625-
} // end of DeleteItem
639+
} // end of DeleteItem
626640

627641
/* ----------------------- class DOMATTR ------------------------ */
628642

storage/connect/domdoc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class DOMDOC : public XMLDOCUMENT {
3737
virtual void SetNofree(bool b) {} // Only libxml2
3838

3939
// Methods
40-
virtual bool Initialize(PGLOBAL g);
41-
virtual bool ParseFile(char *fn);
40+
virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
41+
virtual bool ParseFile(PGLOBAL g, char *fn);
4242
virtual bool NewDoc(PGLOBAL g, char *ver);
4343
virtual void AddComment(PGLOBAL g, char *com);
4444
virtual PXNODE GetRoot(PGLOBAL g);

storage/connect/filamap.cpp

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,13 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
319319
/***********************************************************************/
320320
int MAPFAM::ReadBuffer(PGLOBAL g)
321321
{
322-
int len;
322+
int rc, len;
323323

324324
// Are we at the end of the memory
325-
if (Mempos >= Top)
326-
return RC_EF;
325+
if (Mempos >= Top)
326+
if ((rc = GetNext(g)) != RC_OK)
327+
return rc;
328+
327329

328330
if (!Placed) {
329331
/*******************************************************************/
@@ -341,8 +343,10 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
341343
/*******************************************************************/
342344
switch (Tdbp->TestBlock(g)) {
343345
case RC_EF:
344-
return RC_EF;
345-
case RC_NF:
346+
if ((rc = GetNext(g)) != RC_OK)
347+
return rc;
348+
349+
case RC_NF:
346350
// Skip this record
347351
if ((rc = SkipRecord(g, false)) != RC_OK)
348352
return rc;
@@ -569,16 +573,18 @@ int MBKFAM::GetRowID(void)
569573
/***********************************************************************/
570574
int MBKFAM::ReadBuffer(PGLOBAL g)
571575
{
572-
int len;
576+
int rc, len;
573577

574578
/*********************************************************************/
575579
/* Sequential block reading when Placed is not true. */
576580
/*********************************************************************/
577581
if (Placed) {
578582
Placed = false;
579583
} else if (Mempos >= Top) { // Are we at the end of the memory
580-
return RC_EF;
581-
} else if (++CurNum < Nrec) {
584+
if ((rc = GetNext(g)) != RC_OK)
585+
return rc;
586+
587+
} else if (++CurNum < Nrec) {
582588
Fpos = Mempos;
583589
} else {
584590
/*******************************************************************/
@@ -588,16 +594,20 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
588594

589595
next:
590596
if (++CurBlk >= Block)
591-
return RC_EF;
597+
if ((rc = GetNext(g)) != RC_OK)
598+
return rc;
592599

593600
/*******************************************************************/
594601
/* Before reading a new block, check whether block optimization */
595602
/* can be done, as well as for join as for local filtering. */
596603
/*******************************************************************/
597604
switch (Tdbp->TestBlock(g)) {
598605
case RC_EF:
599-
return RC_EF;
600-
case RC_NF:
606+
if ((rc = GetNext(g)) != RC_OK)
607+
return rc;
608+
609+
break;
610+
case RC_NF:
601611
goto next;
602612
} // endswitch rc
603613

@@ -697,14 +707,18 @@ int MPXFAM::InitDelete(PGLOBAL, int fpos, int)
697707
/***********************************************************************/
698708
int MPXFAM::ReadBuffer(PGLOBAL g)
699709
{
710+
int rc;
711+
700712
/*********************************************************************/
701713
/* Sequential block reading when Placed is not true. */
702714
/*********************************************************************/
703715
if (Placed) {
704716
Placed = false;
705717
} else if (Mempos >= Top) { // Are we at the end of the memory
706-
return RC_EF;
707-
} else if (++CurNum < Nrec) {
718+
if ((rc = GetNext(g)) != RC_OK)
719+
return rc;
720+
721+
} else if (++CurNum < Nrec) {
708722
Fpos = Mempos;
709723
} else {
710724
/*******************************************************************/
@@ -714,16 +728,19 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
714728

715729
next:
716730
if (++CurBlk >= Block)
717-
return RC_EF;
731+
return GetNext(g);
718732

719733
/*******************************************************************/
720734
/* Before reading a new block, check whether block optimization */
721735
/* can be done, as well as for join as for local filtering. */
722736
/*******************************************************************/
723737
switch (Tdbp->TestBlock(g)) {
724738
case RC_EF:
725-
return RC_EF;
726-
case RC_NF:
739+
if ((rc = GetNext(g)) != RC_OK)
740+
return rc;
741+
742+
break;
743+
case RC_NF:
727744
goto next;
728745
} // endswitch rc
729746

storage/connect/filamap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class DllExport MAPFAM : public TXTFAM {
4141
virtual int SkipRecord(PGLOBAL g, bool header);
4242
virtual bool OpenTableFile(PGLOBAL g);
4343
virtual bool DeferReading(void) {return false;}
44-
virtual int ReadBuffer(PGLOBAL g);
44+
virtual int GetNext(PGLOBAL g) {return RC_EF;}
45+
virtual int ReadBuffer(PGLOBAL g);
4546
virtual int WriteBuffer(PGLOBAL g);
4647
virtual int DeleteRecords(PGLOBAL g, int irc);
4748
virtual void CloseTableFile(PGLOBAL g, bool abort);

0 commit comments

Comments
 (0)