Skip to content

Commit 82913b0

Browse files
committed
Commit changes made for version 10.1
1 parent 4314768 commit 82913b0

30 files changed

+1740
-185
lines changed

storage/connect/connect.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,22 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
157157
/* Returns valid: true if this is a table info. */
158158
/***********************************************************************/
159159
bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
160-
{
161-
bool b;
162-
PTDBDOS tdbp= (PTDBDOS)tp;
160+
{
161+
if (tp) {
162+
bool b = ((PTDBASE)tp)->GetFtype() == RECFM_NAF;
163+
PTDBDOS tdbp = b ? NULL : (PTDBDOS)tp;
163164

164-
if (tdbp) {
165-
b= tdbp->GetFtype() != RECFM_NAF;
166-
info->data_file_length= (b) ? (ulonglong)tdbp->GetFileLength(g) : 0;
165+
info->data_file_length = (b) ? 0 : (ulonglong)tdbp->GetFileLength(g);
167166

168-
if (!b || info->data_file_length)
169-
info->records= (unsigned)tdbp->Cardinality(g);
170-
// info->records= (unsigned)tdbp->GetMaxSize(g);
167+
if (b || info->data_file_length)
168+
info->records= (unsigned)tp->Cardinality(g);
169+
// info->records= (unsigned)tp->GetMaxSize(g);
171170
else
172171
info->records= 0;
173172

174173
// info->mean_rec_length= tdbp->GetLrecl();
175174
info->mean_rec_length= 0;
176-
info->data_file_name= (b) ? tdbp->GetFile(g) : NULL;
175+
info->data_file_name= (b) ? NULL : tdbp->GetFile(g);
177176
return true;
178177
} else {
179178
info->data_file_length= 0;
@@ -183,7 +182,7 @@ bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
183182
return false;
184183
} // endif tdbp
185184

186-
} // end of CntInfo
185+
} // end of CntInfo
187186

188187
/***********************************************************************/
189188
/* GetTDB: Get the table description block of a CONNECT table. */

storage/connect/domdoc.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
116116
// Parse an in memory document
117117
char *xdoc = GetMemDoc(g, fn);
118118

119-
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
119+
// This is not equivalent to load for UTF8 characters
120+
// It is why get node content is not the same
121+
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
120122
} else
121123
// Load the document
122124
b = (bool)Docp->load((_bstr_t)fn);
@@ -266,6 +268,7 @@ DOMNODE::DOMNODE(PXDOC dp, MSXML2::IXMLDOMNodePtr np) : XMLNODE(dp)
266268
Nodep = np;
267269
Ws = NULL;
268270
Len = 0;
271+
Zip = (bool)dp->zip;
269272
} // end of DOMNODE constructor
270273

271274
/******************************************************************/
@@ -316,8 +319,10 @@ RCODE DOMNODE::GetContent(PGLOBAL g, char *buf, int len)
316319
RCODE rc = RC_OK;
317320

318321
// Nodep can be null for a missing HTML table column
319-
if (Nodep) {
320-
if (!WideCharToMultiByte(CP_UTF8, 0, Nodep->text, -1,
322+
if (Nodep) {
323+
if (Zip) {
324+
strcpy(buf, Nodep->text);
325+
} else if (!WideCharToMultiByte(CP_UTF8, 0, Nodep->text, -1,
321326
buf, len, NULL, NULL)) {
322327
DWORD lsr = GetLastError();
323328

storage/connect/domdoc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class DOMNODE : public XMLNODE {
9393
char Name[64];
9494
WCHAR *Ws;
9595
int Len;
96+
bool Zip;
9697
}; // end of class DOMNODE
9798

9899
/******************************************************************/

storage/connect/filamap.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* COPYRIGHT: */
77
/* ---------- */
8-
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
8+
/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
99
/* */
1010
/* WHAT THIS PROGRAM DOES: */
1111
/* ----------------------- */
@@ -45,6 +45,7 @@
4545
#include "maputil.h"
4646
#include "filamap.h"
4747
#include "tabdos.h"
48+
#include "tabfmt.h"
4849

4950
/* --------------------------- Class MAPFAM -------------------------- */
5051

@@ -322,17 +323,20 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
322323
int rc, len;
323324

324325
// Are we at the end of the memory
325-
if (Mempos >= Top)
326+
if (Mempos >= Top) {
326327
if ((rc = GetNext(g)) != RC_OK)
327328
return rc;
329+
else if (Tdbp->GetAmType() == TYPE_AM_CSV && ((PTDBCSV)Tdbp)->Header)
330+
if ((rc = SkipRecord(g, true)) != RC_OK)
331+
return rc;
332+
333+
} // endif Mempos
328334

329335

330336
if (!Placed) {
331337
/*******************************************************************/
332338
/* Record file position in case of UPDATE or DELETE. */
333339
/*******************************************************************/
334-
int rc;
335-
336340
next:
337341
Fpos = Mempos;
338342
CurBlk = (int)Rows++;

storage/connect/filamdbf.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,25 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info)
281281
/************************************************************************/
282282
switch (thisfield.Type) {
283283
case 'C': // Characters
284-
case 'L': // Logical 'T' or 'F'
285-
type = TYPE_STRING;
284+
case 'L': // Logical 'T' or 'F' or space
285+
type = TYPE_STRING;
286+
break;
287+
case 'M': // Memo a .DBT block number
288+
case 'B': // Binary a .DBT block number
289+
case 'G': // Ole a .DBT block number
290+
type = TYPE_STRING;
286291
break;
292+
//case 'I': // Long
293+
//case '+': // Autoincrement
294+
// type = TYPE_INT;
295+
// break;
287296
case 'N':
288297
type = (thisfield.Decimals) ? TYPE_DOUBLE
289298
: (len > 10) ? TYPE_BIGINT : TYPE_INT;
290299
break;
291-
case 'F':
292-
type = TYPE_DOUBLE;
300+
case 'F': // Float
301+
//case 'O': // Double
302+
type = TYPE_DOUBLE;
293303
break;
294304
case 'D':
295305
type = TYPE_DATE; // Is this correct ???
@@ -441,6 +451,7 @@ int DBFFAM::Cardinality(PGLOBAL g)
441451

442452
if (Accept) {
443453
Lrecl = rln;
454+
Blksize = Nrec * rln;
444455
PushWarning(g, Tdbp);
445456
} else
446457
return -1;

storage/connect/filamgz.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,20 +724,20 @@ void ZBKFAM::Rewind(void)
724724
/***********************************************************************/
725725
/* Constructors. */
726726
/***********************************************************************/
727-
ZIXFAM::ZIXFAM(PDOSDEF tdp) : ZBKFAM(tdp)
727+
GZXFAM::GZXFAM(PDOSDEF tdp) : ZBKFAM(tdp)
728728
{
729729
//Block = tdp->GetBlock();
730730
//Last = tdp->GetLast();
731731
Nrec = (tdp->GetElemt()) ? tdp->GetElemt() : DOS_BUFF_LEN;
732732
Blksize = Nrec * Lrecl;
733-
} // end of ZIXFAM standard constructor
733+
} // end of GZXFAM standard constructor
734734

735735
/***********************************************************************/
736736
/* ZIX Cardinality: returns table cardinality in number of rows. */
737737
/* This function can be called with a null argument to test the */
738738
/* availability of Cardinality implementation (1 yes, 0 no). */
739739
/***********************************************************************/
740-
int ZIXFAM::Cardinality(PGLOBAL g)
740+
int GZXFAM::Cardinality(PGLOBAL g)
741741
{
742742
if (Last)
743743
return (g) ? (int)((Block - 1) * Nrec + Last) : 1;
@@ -750,7 +750,7 @@ int ZIXFAM::Cardinality(PGLOBAL g)
750750
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
751751
/* be allocated because is it also used to move lines into the file. */
752752
/***********************************************************************/
753-
bool ZIXFAM::AllocateBuffer(PGLOBAL g)
753+
bool GZXFAM::AllocateBuffer(PGLOBAL g)
754754
{
755755
Buflen = Blksize;
756756
To_Buf = (char*)PlugSubAlloc(g, NULL, Buflen);
@@ -788,7 +788,7 @@ bool ZIXFAM::AllocateBuffer(PGLOBAL g)
788788
/***********************************************************************/
789789
/* ReadBuffer: Read one line from a compressed text file. */
790790
/***********************************************************************/
791-
int ZIXFAM::ReadBuffer(PGLOBAL g)
791+
int GZXFAM::ReadBuffer(PGLOBAL g)
792792
{
793793
int n, rc = RC_OK;
794794

@@ -850,7 +850,7 @@ int ZIXFAM::ReadBuffer(PGLOBAL g)
850850
/* WriteDB: Data Base write routine for ZDOS access method. */
851851
/* Update is not possible without using a temporary file (NIY). */
852852
/***********************************************************************/
853-
int ZIXFAM::WriteBuffer(PGLOBAL g)
853+
int GZXFAM::WriteBuffer(PGLOBAL g)
854854
{
855855
/*********************************************************************/
856856
/* In Insert mode, blocs are added sequentialy to the file end. */

storage/connect/filamgz.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
typedef class GZFAM *PGZFAM;
1414
typedef class ZBKFAM *PZBKFAM;
15-
typedef class ZIXFAM *PZIXFAM;
15+
typedef class GZXFAM *PZIXFAM;
1616
typedef class ZLBFAM *PZLBFAM;
1717

1818
/***********************************************************************/
@@ -101,16 +101,16 @@ class DllExport ZBKFAM : public GZFAM {
101101
/* length files compressed using the gzip library functions. */
102102
/* The file is always accessed by block. */
103103
/***********************************************************************/
104-
class DllExport ZIXFAM : public ZBKFAM {
104+
class DllExport GZXFAM : public ZBKFAM {
105105
public:
106106
// Constructor
107-
ZIXFAM(PDOSDEF tdp);
108-
ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
107+
GZXFAM(PDOSDEF tdp);
108+
GZXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
109109

110110
// Implementation
111111
virtual int GetNextPos(void) {return 0;}
112112
virtual PTXF Duplicate(PGLOBAL g)
113-
{return (PTXF)new(g) ZIXFAM(this);}
113+
{return (PTXF)new(g) GZXFAM(this);}
114114

115115
// Methods
116116
virtual int Cardinality(PGLOBAL g);
@@ -120,7 +120,7 @@ class DllExport ZIXFAM : public ZBKFAM {
120120

121121
protected:
122122
// No additional Members
123-
}; // end of class ZIXFAM
123+
}; // end of class GZXFAM
124124

125125
/***********************************************************************/
126126
/* This is the DOS/UNIX Access Method class declaration for PlugDB */

0 commit comments

Comments
 (0)