diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-08-25 11:12:54 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-08-25 11:12:54 +0200 |
commit | dd0872eb9cb1068da7f148865a2eab49955762a5 (patch) | |
tree | b14b77e4b1f04d8010c3bbc27190928637a7147d /storage | |
parent | 730bf6906b2bb87b3cab95949cdb0f8b080f04b1 (diff) | |
download | mariadb-git-dd0872eb9cb1068da7f148865a2eab49955762a5.tar.gz |
- Handle TINY in ODBC type conversion
modified:
storage/connect/odbconn.cpp
- Enhance TYPBLK<TYPE>::GetMaxLength
modified:
storage/connect/valblk.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/odbconn.cpp | 8 | ||||
-rw-r--r-- | storage/connect/valblk.cpp | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 6129c93d388..397b7c2a2f4 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -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 diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index 55f9da7571b..06c7776d2f5 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -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; |