Module Name:    src
Committed By:   mbalmer
Date:           Fri Nov  2 12:24:52 UTC 2012

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

Log Message:
- Update to the version on github.com.
- Fix stmt_bind(): SQLite makes a copy of the string passed (which can be
  garbage collected).  Problem found by Kubo Takehiro.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/lib/lua/sqlite/sqlite.c:1.5
--- src/lib/lua/sqlite/sqlite.c:1.4	Thu Mar 15 02:02:21 2012
+++ src/lib/lua/sqlite/sqlite.c	Fri Nov  2 12:24:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sqlite.c,v 1.4 2012/03/15 02:02:21 joerg Exp $ */
+/*	$NetBSD: sqlite.c,v 1.5 2012/11/02 12:24:52 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2011 Marc Balmer <m...@msys.ch>
@@ -207,7 +207,7 @@ stmt_bind(lua_State *L)
 		break;
 	case LUA_TSTRING:
 		lua_pushinteger(L, sqlite3_bind_text(*stmt, pidx,
-		    lua_tostring(L, 3), -1, NULL));
+		    lua_tostring(L, 3), -1, SQLITE_TRANSIENT));
 		break;
 	case LUA_TNIL:
 		lua_pushinteger(L, sqlite3_bind_null(*stmt, pidx));
@@ -391,13 +391,14 @@ static void
 gpio_set_info(lua_State *L)
 {
 	lua_pushliteral(L, "_COPYRIGHT");
-	lua_pushliteral(L, "Copyright (C) 2011 Marc Balmer <m...@msys.ch>");
+	lua_pushliteral(L, "Copyright (C) 2011, 2012 by "
+	    "Marc Balmer <m...@msys.ch>");
 	lua_settable(L, -3);
 	lua_pushliteral(L, "_DESCRIPTION");
 	lua_pushliteral(L, "SQLite interface for Lua");
 	lua_settable(L, -3);
 	lua_pushliteral(L, "_VERSION");
-	lua_pushliteral(L, "sqlite 1.0.0");
+	lua_pushliteral(L, "sqlite 1.0.2");
 	lua_settable(L, -3);
 }
 
@@ -405,36 +406,36 @@ int
 luaopen_sqlite(lua_State* L)
 {
 	static const struct luaL_Reg sqlite_methods[] = {
-		{ "initialize",		sqlite_initialize },
-		{ "shutdown",		sqlite_shutdown },
-		{ "open",		sqlite_open },
-		{ "libversion",		sqlite_libversion },
-		{ "libversion_number",	sqlite_libversion_number },
-		{ "sourceid",		sqlite_sourceid },
-		{ NULL,			NULL }
+		{ "initialize",			sqlite_initialize },
+		{ "shutdown",			sqlite_shutdown },
+		{ "open",			sqlite_open },
+		{ "libversion",			sqlite_libversion },
+		{ "libversion_number",		sqlite_libversion_number },
+		{ "sourceid",			sqlite_sourceid },
+		{ NULL,				NULL }
 	};
 	static const struct luaL_Reg db_methods[] = {
-		{ "close",		db_close },
-		{ "prepare",		db_prepare },
-		{ "exec",		db_exec },
-		{ "errcode",		db_errcode },
-		{ "errmsg",		db_errmsg },
-		{ "get_autocommit",	db_get_autocommit },
-		{ "changes",		db_changes },
-		{ NULL,			NULL }
+		{ "close",			db_close },
+		{ "prepare",			db_prepare },
+		{ "exec",			db_exec },
+		{ "errcode",			db_errcode },
+		{ "errmsg",			db_errmsg },
+		{ "get_autocommit",		db_get_autocommit },
+		{ "changes",			db_changes },
+		{ NULL,				NULL }
 	};
 	static const struct luaL_Reg stmt_methods[] = {
-		{ "bind",		stmt_bind },
+		{ "bind",			stmt_bind },
 		{ "bind_parameter_count",	stmt_bind_parameter_count },
 		{ "bind_parameter_index",	stmt_bind_parameter_index },
 		{ "bind_parameter_name",	stmt_bind_parameter_name },
-		{ "step",		stmt_step },
-		{ "column",		stmt_column },
-		{ "reset",		stmt_reset },
-		{ "clear_bindings",	stmt_clear_bindings },
-		{ "finalize",		stmt_finalize },
-		{ "column_name",	stmt_column_name },
-		{ "column_count",	stmt_column_count },
+		{ "step",			stmt_step },
+		{ "column",			stmt_column },
+		{ "reset",			stmt_reset },
+		{ "clear_bindings",		stmt_clear_bindings },
+		{ "finalize",			stmt_finalize },
+		{ "column_name",		stmt_column_name },
+		{ "column_count",		stmt_column_count },
 		{ NULL,		NULL }
 	};
 	int n;

Reply via email to