Commit 5746fcc9 authored by Olivier Bertrand's avatar Olivier Bertrand

- Make INI and XML tables not writing null column values

modified:
  mysql-test/suite/connect/r/dbf.result
  storage/connect/tabsys.cpp
  storage/connect/tabxml.cpp
  storage/connect/tabxml.h
parent 19e9fa45
......@@ -605,7 +605,7 @@ INSERT INTO t1 VALUES ('30',DEFAULT,30,DEFAULT);
SELECT * FROM t1;
c1 c2 i1 i2
10 10 10 10
20 20 0
20 def 20 123
30 def 30 123
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
......
......@@ -543,6 +543,10 @@ void INICOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, false); // Convert the updated value
// Null key are missing keys
if (Value->IsNull())
return;
p = Value->GetCharString(Valbuf);
if (strlen(p) > (unsigned)Long) {
......
......@@ -81,7 +81,6 @@ XMLDEF::XMLDEF(void)
Limit = 0;
Xpand = false;
Usedom = false;
Skipnull = false;
} // end of XMLDEF constructor
/***********************************************************************/
......@@ -144,7 +143,6 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
DefNs = Cat->GetStringCatInfo(g, Name, "DefNs", "");
Limit = Cat->GetIntCatInfo(Name, "Limit", 2);
Xpand = (Cat->GetIntCatInfo(Name, "Expand", 0) != 0);
Skipnull = (Cat->GetIntCatInfo(Name, "Skipnull", 0) != 0);
Header = Cat->GetIntCatInfo(Name, "Header", 0);
Cat->GetCharCatInfo(Name, "Xmlsup", "*", buf, sizeof(buf));
......@@ -227,7 +225,6 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp)
Coltype = tdp->Coltype;
Limit = tdp->Limit;
Xpand = tdp->Xpand;
Skipnull = tdp->Skipnull;
Changed = false;
Checked = false;
NextSame = false;
......@@ -272,7 +269,6 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp)
Coltype = tdbp->Coltype;
Limit = tdbp->Limit;
Xpand = tdbp->Xpand;
Skipnull = tdbp->Skipnull;
Changed = tdbp->Changed;
Checked = tdbp->Checked;
NextSame = tdbp->NextSame;
......@@ -733,7 +729,6 @@ bool TDBXML::OpenDB(PGLOBAL g)
/* OpenDB: initialize the XML file processing. */
/*********************************************************************/
Write = (Mode == MODE_INSERT || Mode == MODE_UPDATE);
Skipnull = (Skipnull && Mode == MODE_INSERT);
if (Initialize(g))
return true;
......@@ -1256,7 +1251,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, false); // Convert the updated value
if (Tdbp->Skipnull && Value->IsZero())
if (Value->IsNull())
return;
/*********************************************************************/
......@@ -1476,7 +1471,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, false); // Convert the updated value
if (Tdbp->Skipnull && Value->IsZero())
if (Value->IsNull())
return;
/*********************************************************************/
......@@ -1692,7 +1687,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
if (Value != To_Val)
Value->SetValue_pval(To_Val, false); // Convert the updated value
if (Tdbp->Skipnull && Value->IsZero())
if (Value->IsNull())
return;
/*********************************************************************/
......
......@@ -52,7 +52,6 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
int Header; /* n first rows are header rows */
bool Xpand; /* Put multiple tags in several rows */
bool Usedom; /* True: DOM, False: libxml2 */
bool Skipnull; /* True: skip writing null nodes */
}; // end of XMLDEF
#if defined(INCLUDE_TDBXML)
......@@ -127,7 +126,6 @@ class DllExport TDBXML : public TDBASE {
bool Usedom; // True for DOM, False for libxml2
bool Bufdone; // True when column buffers allocated
bool Nodedone; // True when column nodes allocated
bool Skipnull; // True to skip writing nullnodes
bool Void; // True if the file does not exist
char *Xfile; // The XML file
char *Enc; // New XML table file encoding
......
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