/* Create a new Connection object and push it on top of the stack.  */
static int create_connection(lua_State *L, int env, sqlite *sql_conn)
/* Create a new Connection object and push it on top of the stack.  */
static int create_connection(lua_State *L, int env, sqlite *sql_conn)
{
	conn_data *conn = (conn_data*)lua_newuserdata(L, sizeof(conn_data));
	luasql_setmeta(L, LUASQL_CONNECTION_SQLITE);
	conn->closed = 0;
	conn->env = LUA_NOREF;
	conn->auto_commit = 1;
	conn->sql_conn = sql_conn;
	conn->cur_counter = 0;
	lua_pushvalue (L, env);
	conn->env = luaL_ref (L, LUA_REGISTRYINDEX);
	return 1;
}