Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cookie committed Mar 4, 2019
1 parent bf96a40 commit 706597b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/libs/con_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,13 @@ def __exit__(self, exc_type, exc_val, exc_tb):

def search(self, sql=None):
data_dict = []
id = 0
with self.con.cursor(cursor=pymysql.cursors.DictCursor) as cursor:
sqllist = sql
cursor.execute(sqllist)
result = cursor.fetchall()
for field in cursor.description:
if id == 0:
data_dict.append(
{'title': field[0], "key": field[0], "fixed": "left", "width": 150, "tooltip": True})
id += 1
else:
data_dict.append(
{'title': field[0], "key": field[0], "width": 200, "tooltip": True})
data_dict.append(
{'title': field[0], "key": field[0], "width": 200})
len = cursor.rowcount
return {'data': result, 'title': data_dict, 'len': len}

Expand Down

0 comments on commit 706597b

Please sign in to comment.