From e33f4b8548e03baaa526e35f336042874b74fbeb Mon Sep 17 00:00:00 2001 From: spartan057 Date: Fri, 16 Feb 2018 11:11:21 +0100 Subject: [PATCH] Fixed parameters tuple access with unicode index (#98) On executing context for a prepared statement which calls parameterized functions, stored procedures, etc. HANA returns parametermetadata containing the parameters name as id. On execution cursor.py used this id for index access to the parameters tuple. Now an enumeration is used to get the position of the current parameter/parametermetadata and for access to the parameters tuple. --- pyhdb/cursor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhdb/cursor.py b/pyhdb/cursor.py index 81e5ee9..c682306 100644 --- a/pyhdb/cursor.py +++ b/pyhdb/cursor.py @@ -99,7 +99,7 @@ def __next__(self): if len(parameters) != len(self._params_metadata): raise ProgrammingError("Prepared statement parameters expected %d supplied %d." % (len(self._params_metadata), len(parameters))) - row_params = [self.ParamTuple(p.id, p.datatype, p.length, parameters[p.id]) for p in self._params_metadata] + row_params = [self.ParamTuple(p.id, p.datatype, p.length, parameters[i]) for i, p in enumerate(self._params_metadata)] self._iter_row_count += 1 return row_params