Fix ODBC types to match standard typedefs

This fixes a bug that I'm currently experiencing reproducible in the following way:

-Use lua5.3
-"long int" must have size 8
-SQLINTEGER must have size 4

Selecting a column of integer type would mess up the values.
This commit is contained in:
Mauro 2019-06-14 13:26:50 +02:00 committed by GitHub
parent e717678e2b
commit 6942e2b3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,7 +346,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
switch (type) { switch (type) {
/* nUmber */ /* nUmber */
case 'u': { case 'u': {
double num; SQLDOUBLE num;
SQLLEN got; SQLLEN got;
SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_DOUBLE, &num, 0, &got); SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_DOUBLE, &num, 0, &got);
if (error(rc)) if (error(rc))
@ -360,7 +360,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
#if LUA_VERSION_NUM>=503 #if LUA_VERSION_NUM>=503
/* iNteger */ /* iNteger */
case 'n': { case 'n': {
long int num; SQLINTEGER num;
SQLLEN got; SQLLEN got;
SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_SLONG, &num, 0, &got); SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_SLONG, &num, 0, &got);
if (error(rc)) if (error(rc))
@ -374,7 +374,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
#endif #endif
/* bOol */ /* bOol */
case 'o': { case 'o': {
char b; SQLCHAR b;
SQLLEN got; SQLLEN got;
SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_BIT, &b, 0, &got); SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_BIT, &b, 0, &got);
if (error(rc)) if (error(rc))