# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../lua-sqlite3/map_index.patch # Copyright (C) 2010 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- Fixed named parameters with multiple statements (handles) to map correctly. - Rene Rebe --- lua-sqlite3-0.4.1/sqlite3.lua.vanilla 2005-09-14 23:22:59.000000000 +0000 +++ lua-sqlite3-0.4.1/sqlite3.lua 2010-03-29 13:15:37.936666788 +0000 @@ -621,12 +621,14 @@ local function bind_by_names(parameters) local parameter_names = stmt.paranames local mapping = stmt.mapping + local map_index = 1 for _, handle in ipairs(stmt.handles) do for index = 1, api.bind_parameter_count(handle) do - local status = api.bind(handle, index, parameters[parameter_names[mapping[index]]]) + local status = api.bind(handle, index, parameters[parameter_names[mapping[map_index]]]) if is_error(status) then return nil, errmsg(stmt.db.handle) end + map_index = map_index + 1 end end end