Skip to content
Permalink
Browse files
…-from-multiple-files-in-mariadb/60637429#60637429

  Import complex XML from multiple files in MariaDB
  Some row results are missing and replaced by the last file one.
  Thats because Nx and Sx column members are not reset when changing file.
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/tabxml.h
  • Loading branch information
Buggynours committed Mar 12, 2020
1 parent ce49812 commit 4ba36cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
@@ -2962,10 +2962,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LE_FUNC: vop= OP_LE; break;
case Item_func::GE_FUNC: vop= OP_GE; break;
case Item_func::GT_FUNC: vop= OP_GT; break;
case Item_func::LIKE_FUNC:
vop= OP_LIKE;
neg= ((Item_func_opt_neg *)condf)->negated;
break;
//case Item_func::LIKE_FUNC:
// vop= OP_LIKE;
// neg= ((Item_func_like *)condf)->negated;
// break;
case Item_func::ISNOTNULL_FUNC:
neg= true;
// fall through
@@ -240,7 +240,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)

more:
if (vp->atp) {
strncpy(colname, vp->atp->GetName(g), sizeof(colname));
size_t z = sizeof(colname) - 1;
strncpy(colname, vp->atp->GetName(g), z);
colname[z] = 0;
strncat(xcol->Name, colname, XLEN(xcol->Name));

switch (vp->atp->GetText(g, buf, sizeof(buf))) {
@@ -811,12 +813,15 @@ bool TDBXML::Initialize(PGLOBAL g)
if (Void)
return false;

if (Columns && !Bufdone) {
if (Columns) {
// Allocate the buffers that will contain node values
for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext())
if (!colp->IsSpecial()) // Not a pseudo column
if (colp->AllocBuf(g, Mode == MODE_INSERT))
return true;
if (!colp->IsSpecial()) { // Not a pseudo column
if (!Bufdone && colp->AllocBuf(g, Mode == MODE_INSERT))
return true;

colp->Nx = colp->Sx = -1;
} // endif Special

Bufdone = true;
} // endif Bufdone
@@ -157,6 +157,7 @@ class DllExport TDBXML : public TDBASE {
/* Class XMLCOL: XDB table access method column descriptor. */
/***********************************************************************/
class XMLCOL : public COLBLK {
friend class TDBXML;
public:
// Constructors
XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "XML");

0 comments on commit 4ba36cf

Please sign in to comment.