diff options
Diffstat (limited to 'storage/connect/tabxml.cpp')
-rw-r--r-- | storage/connect/tabxml.cpp | 65 |
1 files changed, 55 insertions, 10 deletions
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index 3feba14ca5e..aa1133b0e92 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -1,9 +1,9 @@ /************* Tabxml C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: TABXML */ /* ------------- */ -/* Version 2.6 */ +/* Version 2.7 */ /* */ -/* Author Olivier BERTRAND 2007 - 2013 */ +/* Author Olivier BERTRAND 2007 - 2014 */ /* */ /* This program are the XML tables classes using MS-DOM or libxml2. */ /***********************************************************************/ @@ -47,6 +47,7 @@ #include "xindex.h" #include "plgxml.h" #include "tabxml.h" +#include "tabmul.h" extern "C" { extern char version[]; @@ -136,7 +137,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) } // endswitch typname Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated - Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); + Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); // Deprecated + Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname); Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow); Colname = Cat->GetStringCatInfo(g, "Colnode", defcol); Mulnode = Cat->GetStringCatInfo(g, "Mulnode", ""); @@ -177,7 +179,12 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) /***********************************************************************/ PTDB XMLDEF::GetTable(PGLOBAL g, MODE m) { - return new(g) TDBXML(this); + PTDBASE tdbp = new(g) TDBXML(this); + + if (Multiple) + tdbp = new(g) TDBMUL(tdbp); + + return tdbp; } // end of GetTable /***********************************************************************/ @@ -245,6 +252,7 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp) Void = false; Usedom = tdp->Usedom; Header = tdp->Header; + Multiple = tdp->Multiple; Nrow = -1; Irow = Header - 1; Nsub = 0; @@ -287,6 +295,7 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp) Void = tdbp->Void; Usedom = tdbp->Usedom; Header = tdbp->Header; + Multiple = tdbp->Multiple; Nrow = tdbp->Nrow; Irow = tdbp->Irow; Nsub = tdbp->Nsub; @@ -578,7 +587,7 @@ bool TDBXML::Initialize(PGLOBAL g) #endif } // end of try-catches - if (Root && Columns && !Nodedone) { + if (Root && Columns && (Multiple || !Nodedone)) { // Allocate class nodes to avoid dynamic allocation for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext()) if (!colp->IsSpecial()) // Not a pseudo column @@ -671,7 +680,10 @@ void TDBXML::SetNodeAttr(PGLOBAL g, char *attr, PXNODE node) int TDBXML::Cardinality(PGLOBAL g) { if (!g) - return (Xpand || Coltype == 2) ? 0 : 1; + return (Multiple || Xpand || Coltype == 2) ? 0 : 1; + + if (Multiple) + return 10; if (Nrow < 0) if (Initialize(g)) @@ -685,8 +697,13 @@ int TDBXML::Cardinality(PGLOBAL g) /***********************************************************************/ int TDBXML::GetMaxSize(PGLOBAL g) { - if (MaxSize < 0) - MaxSize = Cardinality(g) * ((Xpand) ? Limit : 1); + if (MaxSize < 0) { + if (!Multiple) + MaxSize = Cardinality(g) * ((Xpand) ? Limit : 1); + else + MaxSize = 10; + + } // endif MaxSize return MaxSize; } // end of GetMaxSize @@ -952,6 +969,34 @@ void TDBXML::CloseDB(PGLOBAL g) Docp->CloseDoc(g, To_Xb); } // endif docp + if (Multiple) { + // Reset all constants to start a new parse + Docp = NULL; + Root = NULL; + Curp = NULL; + DBnode = NULL; + TabNode = NULL; + RowNode = NULL; + ColNode = NULL; + Nlist = NULL; + Clist = NULL; + To_Xb = NULL; + Colp = NULL; + Changed = false; + Checked = false; + NextSame = false; + NewRow = false; + Hasnod = false; + Write = false; +// Bufdone = false; + Nodedone = false; + Void = false; + Nrow = -1; + Irow = Header - 1; + Nsub = 0; + N = 0; + } // endif Multiple + } // end of CloseDB // ------------------------ XMLCOL functions ---------------------------- @@ -1168,10 +1213,10 @@ bool XMLCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) if (GetDomain() || ((DTVAL *)value)->IsFormatted()) goto newval; // This will make a new value; - } else if (Buf_Type == TYPE_FLOAT) + } else if (Buf_Type == TYPE_DOUBLE) // Float values must be written with the correct (column) precision // Note: maybe this should be forced by ShowValue instead of this ? - value->SetPrec(GetPrecision()); + value->SetPrec(GetScale()); Value = value; // Directly access the external value } else { |