Merge branch 'master' of github.com:keplerproject/luasql

This commit is contained in:
Tomas Guisasola 2013-08-16 19:48:10 -03:00 committed by Toms Guisasola
commit 531ab6a13f
2 changed files with 11 additions and 3 deletions

View File

@ -190,7 +190,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
/* nUmber */ /* nUmber */
case 'u': { case 'u': {
double num; double num;
SQLINTEGER 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))
return fail(L, hSTMT, hstmt); return fail(L, hSTMT, hstmt);
@ -203,7 +203,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
/* bOol */ /* bOol */
case 'o': { case 'o': {
char b; char b;
SQLINTEGER 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))
return fail(L, hSTMT, hstmt); return fail(L, hSTMT, hstmt);
@ -218,7 +218,7 @@ static int push_column(lua_State *L, int coltypes, const SQLHSTMT hstmt,
/* bInary */ /* bInary */
case 'i': { case 'i': {
SQLSMALLINT stype = (type == 't') ? SQL_C_CHAR : SQL_C_BINARY; SQLSMALLINT stype = (type == 't') ? SQL_C_CHAR : SQL_C_BINARY;
SQLINTEGER got; SQLLEN got;
char *buffer; char *buffer;
luaL_Buffer b; luaL_Buffer b;
SQLRETURN rc; SQLRETURN rc;

View File

@ -382,7 +382,11 @@ static int conn_execute(lua_State *L)
int numcols; int numcols;
const char *tail; 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); res = sqlite3_prepare(conn->sql_conn, statement, -1, &vm, &tail);
#endif
if (res != SQLITE_OK) if (res != SQLITE_OK)
{ {
errmsg = sqlite3_errmsg(conn->sql_conn); errmsg = sqlite3_errmsg(conn->sql_conn);
@ -544,7 +548,11 @@ static int env_connect(lua_State *L)
sourcename = luaL_checkstring(L, 2); 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); res = sqlite3_open(sourcename, &conn);
#endif
if (res != SQLITE_OK) if (res != SQLITE_OK)
{ {
errmsg = sqlite3_errmsg(conn); errmsg = sqlite3_errmsg(conn);