diff options
| -rw-r--r-- | storage/connect/plgdbsem.h | 2 | ||||
| -rw-r--r-- | storage/connect/tabutil.h | 2 | ||||
| -rw-r--r-- | storage/connect/tabxcl.cpp | 20 | ||||
| -rw-r--r-- | storage/connect/tabxcl.h | 1 |
4 files changed, 20 insertions, 5 deletions
diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index 7d5931285ce..ef209a9b8b8 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -582,7 +582,7 @@ DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size); DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&); DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t); DllExport void NewPointer(PTABS, void *, void *); -DllExport char *GetIni(int n= 0); +//lExport char *GetIni(int n= 0); // Not used anymore DllExport void SetTrc(void); DllExport char *GetListOption(PGLOBAL, const char *, const char *, const char *def=NULL); diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index 11f18be074a..606e532d526 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -114,7 +114,7 @@ class DllExport PRXCOL : public COLBLK { {return false;} virtual void ReadColumn(PGLOBAL g); virtual void WriteColumn(PGLOBAL g); - bool Init(PGLOBAL g, PTDBASE tp = NULL); + virtual bool Init(PGLOBAL g, PTDBASE tp = NULL); protected: // Default constructor not to be used diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp index bd3d57257ff..66e2577056a 100644 --- a/storage/connect/tabxcl.cpp +++ b/storage/connect/tabxcl.cpp @@ -184,7 +184,7 @@ bool TDBXCL::OpenDB(PGLOBAL g) /* Check and initialize the subtable columns. */ /*********************************************************************/ for (PCOL cp = Columns; cp; cp = cp->GetNext()) - if (((PXCLCOL)cp)->Init(g)) + if (((PPRXCOL)cp)->Init(g)) return TRUE; /*********************************************************************/ @@ -240,13 +240,26 @@ XCLCOL::XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i) : PRXCOL(cdp, tdbp, cprec, i, "XCL") { // Set additional XXL access method information for column. - Cbuf = (char*)PlugSubAlloc(g, NULL, Long + 1); + Cbuf = NULL; // Will be allocated later Cp = NULL; // Pointer to current position in Cbuf Sep = ((PTDBXCL)tdbp)->Sep; AddStatus(BUF_READ); // Only evaluated from TDBXCL::ReadDB } // end of XCLCOL constructor /***********************************************************************/ +/* XCLCOL initialization routine. */ +/* Allocate Cbuf that will contain the Colp value. */ +/***********************************************************************/ +bool XCLCOL::Init(PGLOBAL g, PTDBASE tp) + { + if (PRXCOL::Init(g, tp)) + return true; + + Cbuf = (char*)PlugSubAlloc(g, NULL, Colp->GetLength() + 1); + return false; + } // end of Init + +/***********************************************************************/ /* What this routine does is to get the comma-separated string */ /* from the source table column, extract the single values and */ /* set the flag for the table ReadDB function. */ @@ -255,7 +268,8 @@ void XCLCOL::ReadColumn(PGLOBAL g) { if (((PTDBXCL)To_Tdb)->New) { Colp->Eval(g); - strcpy(Cbuf, To_Val->GetCharValue()); + strncpy(Cbuf, To_Val->GetCharValue(), Colp->GetLength()); + Cbuf[Colp->GetLength()] = 0; Cp = Cbuf; } // endif New diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 24122573100..05118c5dd25 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -90,6 +90,7 @@ class XCLCOL : public PRXCOL { // Methods virtual void Reset(void) {Colp->Reset();} // Evaluated only by TDBXCL virtual void ReadColumn(PGLOBAL g); + virtual bool Init(PGLOBAL g, PTDBASE tp = NULL); protected: // Default constructor not to be used |
