Skip to content

Commit

Permalink
Fix MDEV-27055 (regression of MDEV-24493)
Browse files Browse the repository at this point in the history
  • Loading branch information
Buggynours committed Nov 26, 2021
1 parent 94fb9d9 commit c819a7a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions storage/connect/odbconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
PGLOBAL& g = m_G;
void *buffer;
bool b;
UWORD n;
UWORD n, k;
SWORD len, tp, ncol = 0;
ODBCCOL *colp;
RETCODE rc;
Expand Down Expand Up @@ -1489,15 +1489,16 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
} else {
do {
rc = SQLExecDirect(hstmt, (PUCHAR)sql, SQL_NTS);
} while (rc == SQL_STILL_EXECUTING);
} while (rc == SQL_STILL_EXECUTING);

if (!Check(rc))
ThrowDBX(rc, "SQLExecDirect", hstmt);

do {
rc = SQLNumResultCols(hstmt, &ncol);
} while (rc == SQL_STILL_EXECUTING);
} while (rc == SQL_STILL_EXECUTING);

k = 0; // used for column number
} // endif Srcdef

for (n = 0, colp = tocols; colp; colp = (PODBCCOL)colp->GetNext())
Expand All @@ -1519,18 +1520,23 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
sprintf(m_G->Message, MSG(INV_COLUMN_TYPE),
colp->GetResultType(), SVP(colp->GetName()));
ThrowDBX(m_G->Message);
} // endif tp
} // endif tp

if (m_Tdb->Srcdef)
k = colp->GetIndex();
else
k++;

if (trace(1))
htrc("Binding col=%u type=%d buf=%p len=%d slen=%p\n",
n, tp, buffer, len, colp->GetStrLen());
k, tp, buffer, len, colp->GetStrLen());

rc = SQLBindCol(hstmt, colp->GetIndex(), tp, buffer, len, colp->GetStrLen());
rc = SQLBindCol(hstmt, k, tp, buffer, len, colp->GetStrLen());

if (!Check(rc))
ThrowDBX(rc, "SQLBindCol", hstmt);

} // endif pcol
} // endif colp

} catch(DBX *x) {
if (trace(1))
Expand Down

0 comments on commit c819a7a

Please sign in to comment.