Commit 70160c22 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix calculating the number of fields of CSV and FMT tables. Could be wrong

  on UPDATE and INSERT if the table had special columns.
modified:
  storage/connect/tabfmt.cpp
parent c1973c80
......@@ -649,7 +649,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
} else
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsVirtual())
if (!cdp->IsSpecial() && !cdp->IsVirtual())
Fields++;
Offset = (int*)PlugSubAlloc(g, NULL, sizeof(int) * Fields);
......@@ -686,7 +686,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
} else // MODE_UPDATE
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsVirtual()) {
if (!cdp->IsSpecial() && !cdp->IsVirtual()) {
i = cdp->GetOffset() - 1;
len = cdp->GetLength();
Field[i] = (PSZ)PlugSubAlloc(g, NULL, len + 1);
......@@ -1118,7 +1118,8 @@ bool TDBFMT::OpenDB(PGLOBAL g)
// Get the column formats
for (cdp = tdp->GetCols(); cdp; cdp = cdp->GetNext())
if (!cdp->IsVirtual() && (i = cdp->GetOffset() - 1) < Fields) {
if (!cdp->IsSpecial() && !cdp->IsVirtual()
&& (i = cdp->GetOffset() - 1) < Fields) {
if (!(pfm = cdp->GetFmt())) {
sprintf(g->Message, MSG(NO_FLD_FORMAT), i + 1, Name);
return true;
......
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