Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/lua/sqlite Add db:changes()



details:   https://anonhg.NetBSD.org/src/rev/37f4ed032563
branches:  trunk
changeset: 770390:37f4ed032563
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Sat Oct 15 12:58:20 2011 +0000

description:
Add db:changes()

diffstat:

 lib/lua/sqlite/sqlite.c |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r 598e8e419fbb -r 37f4ed032563 lib/lua/sqlite/sqlite.c
--- a/lib/lua/sqlite/sqlite.c   Sat Oct 15 11:31:40 2011 +0000
+++ b/lib/lua/sqlite/sqlite.c   Sat Oct 15 12:58:20 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sqlite.c,v 1.2 2011/10/15 10:35:06 mbalmer Exp $ */
+/*     $NetBSD: sqlite.c,v 1.3 2011/10/15 12:58:20 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2011 Marc Balmer <marc%msys.ch@localhost>
@@ -182,6 +182,16 @@
 }
 
 static int
+db_changes(lua_State *L)
+{
+       sqlite3 **db;
+
+       db = luaL_checkudata(L, 1, SQLITE_DB_METATABLE);
+       lua_pushinteger(L, sqlite3_changes(*db));
+       return 1;
+}
+
+static int
 stmt_bind(lua_State *L)
 {
        sqlite3_stmt **stmt;
@@ -410,6 +420,7 @@
                { "errcode",            db_errcode },
                { "errmsg",             db_errmsg },
                { "get_autocommit",     db_get_autocommit },
+               { "changes",            db_changes },
                { NULL,                 NULL }
        };
        static const struct luaL_Reg stmt_methods[] = {



Home | Main Index | Thread Index | Old Index