Merge pull request #13 from echiesse/master
Fixed compilation error on function "conn_escape" on Visual Studio 2008.
This commit is contained in:
commit
25eebb2222
@ -371,14 +371,17 @@ static int conn_escape (lua_State *L) {
|
||||
conn_data *conn = getconnection (L);
|
||||
size_t len;
|
||||
const char *from = luaL_checklstring (L, 2, &len);
|
||||
char to[len*sizeof(char)*2+1];
|
||||
char *to = malloc(len*sizeof(char)*2+1);
|
||||
int error;
|
||||
int ret = 1;
|
||||
len = PQescapeStringConn (conn->pg_conn, to, from, len, &error);
|
||||
if (error == 0) { /* success ! */
|
||||
lua_pushlstring (L, to, len);
|
||||
return 1;
|
||||
} else
|
||||
return luasql_failmsg (L, "cannot escape string. PostgreSQL: ", PQerrorMessage (conn->pg_conn));
|
||||
} else {
|
||||
ret = luasql_failmsg (L, "cannot escape string. PostgreSQL: ", PQerrorMessage (conn->pg_conn));
|
||||
}
|
||||
free(to);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user