Source-Changes-HG archive

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

[src/trunk]: src/lib/lua/sqlite - Update to the version on github.com.



details:   https://anonhg.NetBSD.org/src/rev/a69eeb0e5dc9
branches:  trunk
changeset: 782414:a69eeb0e5dc9
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Fri Nov 02 12:24:52 2012 +0000

description:
- 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.

diffstat:

 lib/lua/sqlite/sqlite.c |  55 ++++++++++++++++++++++++------------------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diffs (95 lines):

diff -r b392ce2e43ef -r a69eeb0e5dc9 lib/lua/sqlite/sqlite.c
--- a/lib/lua/sqlite/sqlite.c   Fri Nov 02 12:07:58 2012 +0000
+++ b/lib/lua/sqlite/sqlite.c   Fri Nov 02 12:24:52 2012 +0000
@@ -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 <marc%msys.ch@localhost>
@@ -207,7 +207,7 @@
                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 @@
 gpio_set_info(lua_State *L)
 {
        lua_pushliteral(L, "_COPYRIGHT");
-       lua_pushliteral(L, "Copyright (C) 2011 Marc Balmer <marc%msys.ch@localhost>");
+       lua_pushliteral(L, "Copyright (C) 2011, 2012 by "
+           "Marc Balmer <marc%msys.ch@localhost>");
        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 @@
 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;



Home | Main Index | Thread Index | Old Index