[FIX] base_external_dbsource_sqlite crashing when sqlparams equal None

This commit is contained in:
Adrià Gil Sorribes
2018-11-13 15:26:17 +01:00
committed by David Alonso // Solvos
parent 04bd1abb34
commit 753d7d68c8
2 changed files with 5 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{ {
'name': 'External Database Source - SQLite', 'name': 'External Database Source - SQLite',
'version': '11.0.1.0.0', 'version': '11.0.1.0.1',
'category': 'Tools', 'category': 'Tools',
'author': "Daniel Reis, " 'author': "Daniel Reis, "
"LasLabs, " "LasLabs, "

View File

@@ -51,6 +51,9 @@ class BaseExternalDbsource(models.Model):
rows, cols = list(), list() rows, cols = list(), list()
for record in self: for record in self:
with record.connection_open() as connection: with record.connection_open() as connection:
if sqlparams is None:
cur = connection.execute(sqlquery)
else:
cur = connection.execute(sqlquery, sqlparams) cur = connection.execute(sqlquery, sqlparams)
if metadata: if metadata:
cols = list(cur.keys()) cols = list(cur.keys())