Module Name:    src
Committed By:   mbalmer
Date:           Sat Oct 15 12:58:20 UTC 2011

Modified Files:
        src/lib/lua/sqlite: sqlite.c

Log Message:
Add db:changes()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/lua/sqlite/sqlite.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/lua/sqlite/sqlite.c
diff -u src/lib/lua/sqlite/sqlite.c:1.2 src/lib/lua/sqlite/sqlite.c:1.3
--- src/lib/lua/sqlite/sqlite.c:1.2	Sat Oct 15 10:35:06 2011
+++ src/lib/lua/sqlite/sqlite.c	Sat Oct 15 12:58:20 2011
@@ -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 <m...@msys.ch>
@@ -182,6 +182,16 @@ db_get_autocommit(lua_State *L)
 }
 
 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 @@ luaopen_sqlite(lua_State* L)
 		{ "errcode",		db_errcode },
 		{ "errmsg",		db_errmsg },
 		{ "get_autocommit",	db_get_autocommit },
+		{ "changes",		db_changes },
 		{ NULL,			NULL }
 	};
 	static const struct luaL_Reg stmt_methods[] = {

Reply via email to