Commit dd0872eb authored by Olivier Bertrand's avatar Olivier Bertrand

- Handle TINY in ODBC type conversion

modified:
  storage/connect/odbconn.cpp

- Enhance TYPBLK<TYPE>::GetMaxLength

modified:
  storage/connect/valblk.cpp
parent 730bf690
......@@ -76,8 +76,9 @@ static short GetSQLType(int type)
case TYPE_SHORT: tp = SQL_SMALLINT; break;
case TYPE_INT: tp = SQL_INTEGER; break;
case TYPE_DATE: tp = SQL_TIMESTAMP; break;
case TYPE_BIGINT: tp = SQL_BIGINT; break; // (-5)
case TYPE_BIGINT: tp = SQL_BIGINT; break; // (-5)
case TYPE_FLOAT: tp = SQL_DOUBLE; break;
case TYPE_TINY : tp = SQL_TINYINT; break;
} // endswitch type
return tp;
......@@ -97,6 +98,7 @@ static int GetSQLCType(int type)
case TYPE_DATE: tp = SQL_C_TIMESTAMP; break;
case TYPE_BIGINT: tp = SQL_C_SBIGINT; break;
case TYPE_FLOAT: tp = SQL_C_DOUBLE; break;
case TYPE_TINY : tp = SQL_C_TINYINT; break;
} // endswitch type
return tp;
......@@ -127,9 +129,11 @@ int TranslateSQLType(int stp, int prec, int& len)
type = TYPE_INT;
break;
case SQL_SMALLINT: // 5
type = TYPE_SHORT;
break;
case SQL_TINYINT: // (-6)
case SQL_BIT: // (-7)
type = TYPE_SHORT;
type = TYPE_TINY;
break;
case SQL_FLOAT: // 6
case SQL_REAL: // 7
......
......@@ -447,13 +447,12 @@ int TYPBLK<TYPE>::Find(PVAL vp)
template <class TYPE>
int TYPBLK<TYPE>::GetMaxLength(void)
{
char buf[12];
int i, n;
char buf[32];
int i, n, m;
for (i = n = 0; i < Nval; i++) {
sprintf(buf, Fmt, Typp[i]);
n = max(n, (signed)strlen(buf));
m = sprintf(buf, Fmt, Typp[i]);
n = max(n, m);
} // endfor i
return n;
......
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