From 7a099cfa0eb582bdf0e641bd8e869655ef8e7f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20Burgue=C3=B1o?= Date: Mon, 3 Sep 2012 15:18:31 -0300 Subject: [PATCH 1/2] Use _v2 APIs for SQLite version 3.6.13 and above. --- src/ls_sqlite3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ls_sqlite3.c b/src/ls_sqlite3.c index 96e4085..150073c 100644 --- a/src/ls_sqlite3.c +++ b/src/ls_sqlite3.c @@ -382,7 +382,11 @@ static int conn_execute(lua_State *L) int numcols; const char *tail; +#if SQLITE_VERSION_NUMBER > 3006013 + res = sqlite3_prepare_v2(conn->sql_conn, statement, -1, &vm, &tail); +#else res = sqlite3_prepare(conn->sql_conn, statement, -1, &vm, &tail); +#endif if (res != SQLITE_OK) { errmsg = sqlite3_errmsg(conn->sql_conn); @@ -544,7 +548,11 @@ static int env_connect(lua_State *L) sourcename = luaL_checkstring(L, 2); +#if SQLITE_VERSION_NUMBER > 3006013 + res = sqlite3_open_v2(sourcename, &conn, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); +#else res = sqlite3_open(sourcename, &conn); +#endif if (res != SQLITE_OK) { errmsg = sqlite3_errmsg(conn); From 42adcf2a78e8877683c2572f23c1aa8e0cec2ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Pereira?= Date: Thu, 25 Oct 2012 10:48:14 -0200 Subject: [PATCH 2/2] Update src/ls_odbc.c Changes needed to compile and run without "#runtime ckeck error" in x64 connecting in SQL Server 2008 RC2 --- src/ls_odbc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ls_odbc.c b/src/ls_odbc.c index 64ca376..3983039 100644 --- a/src/ls_odbc.c +++ b/src/ls_odbc.c @@ -190,7 +190,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt, /* nUmber */ case 'u': { double num; - SQLINTEGER got; + SQLLEN got; SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_DOUBLE, &num, 0, &got); if (error(rc)) return fail(L, hSTMT, hstmt); @@ -203,7 +203,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt, /* bOol */ case 'o': { char b; - SQLINTEGER got; + SQLLEN got; SQLRETURN rc = SQLGetData(hstmt, i, SQL_C_BIT, &b, 0, &got); if (error(rc)) return fail(L, hSTMT, hstmt); @@ -218,7 +218,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt, /* bInary */ case 'i': { SQLSMALLINT stype = (type == 't') ? SQL_C_CHAR : SQL_C_BINARY; - SQLINTEGER got; + SQLLEN got; char *buffer; luaL_Buffer b; SQLRETURN rc;