--- a/dbd/sqlite3/statement.c Sat Jun 13 08:55:44 2009 +0000 +++ b/dbd/sqlite3/statement.c Tue Sep 01 13:15:02 2009 +0000 @@ -342,6 +342,17 @@ return 0; } +/* + * __tostring + */ +static int statement_tostring(lua_State *L) { + statement_t *statement = (statement_t *)luaL_checkudata(L, 1, DBD_SQLITE_STATEMENT); + + lua_pushfstring(L, "%s: %p", DBD_SQLITE_STATEMENT, statement); + + return 1; +} + int dbd_sqlite3_statement_create(lua_State *L, connection_t *conn, const char *sql_query) { statement_t *statement = NULL; @@ -386,6 +397,9 @@ lua_pushcfunction(L, statement_gc); lua_setfield(L, -2, "__gc"); + lua_pushcfunction(L, statement_tostring); + lua_setfield(L, -2, "__tostring"); + luaL_register(L, DBD_SQLITE_STATEMENT, statement_class_methods); return 1;