Skip to content

Commit

Permalink
Some small changes.
Browse files Browse the repository at this point in the history
===================
- Fix unhandled throws, add some trace + typo
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/valblk.cpp
  modified:   storage/connect/value.cpp
  • Loading branch information
Buggynours committed Oct 16, 2019
1 parent 425dc6d commit b56589e
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 297 deletions.
11 changes: 8 additions & 3 deletions storage/connect/jdbconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,14 @@ int JDBConn::GetResultSize(PCSZ sql, PCOL colp)
if ((rc = ExecuteQuery(sql)) != RC_OK)
return -1;

if ((rc = Fetch()) > 0)
SetColumnValue(1, NULL, colp->GetValue());
else
if ((rc = Fetch()) > 0) {
try {
SetColumnValue(1, NULL, colp->GetValue());
} catch (...) {
return -4;
} // end catch

} else
return -2;

if ((rc = Fetch()) != 0)
Expand Down
6 changes: 4 additions & 2 deletions storage/connect/tabodbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,10 @@ bool TDBODBC::OpenDB(PGLOBAL g)
Cnp->InitValue(g);

if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) {
strcpy(g->Message, "Cannot get result size");
return true;
char* msg = PlugDup(g, g->Message);

sprintf(g->Message, "Get result size: %s (rc=%d)", msg, n);
return true;
} else if (n) {
Ocp->m_Rows = n;

Expand Down
4 changes: 3 additions & 1 deletion storage/connect/valblk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ void VALBLK::ChkIndx(int n)
{
if (n < 0 || n >= Nval) {
PGLOBAL& g = Global;
xtrc(1, "ChkIndx: n=%d Nval=%d\n", n, Nval);
strcpy(g->Message, MSG(BAD_VALBLK_INDX));
throw Type;
} // endif n
Expand All @@ -216,7 +217,8 @@ void VALBLK::ChkTyp(PVAL v)
{
if (Check && (Type != v->GetType() || Unsigned != v->IsUnsigned())) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
xtrc(1, "ChkTyp: Type=%d valType=%d\n", Type, v->GetType());
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
throw Type;
} // endif Type

Expand Down
Loading

0 comments on commit b56589e

Please sign in to comment.