From 65e29a82c3db1d74b17ea8536ac8bae85aa2a2a6 Mon Sep 17 00:00:00 2001 From: Can KAYA Date: Tue, 25 Sep 2018 19:41:00 +0300 Subject: [PATCH 1/3] reserved keyword issue --- app/create_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/create_db.py b/app/create_db.py index 276b789c..717b7164 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -251,7 +251,7 @@ def update_db_v_3_2_3(**kwargs): def update_db_v_3_2_8(**kwargs): con, cur = get_cur() sql = """ - ALTER TABLE `servers` ADD COLUMN desc varchar(64); + ALTER TABLE `servers` ADD COLUMN `desc` varchar(64); """ try: cur.execute(sql) @@ -286,4 +286,4 @@ def update_all_silent(): if __name__ == "__main__": create_table() update_all() - \ No newline at end of file + From 8e6d287b947fa12e7d380d9aa84b81f4f3396783 Mon Sep 17 00:00:00 2001 From: Can KAYA Date: Tue, 25 Sep 2018 19:44:19 +0300 Subject: [PATCH 2/3] reserved keyword --- app/sql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/sql.py b/app/sql.py index 31a9de12..4094a575 100644 --- a/app/sql.py +++ b/app/sql.py @@ -118,7 +118,7 @@ def update_group(name, descript, id): def add_server(hostname, ip, group, typeip, enable, master, cred, alert, metrics, port, desc): con, cur = create_db.get_cur() - sql = """ INSERT INTO servers (hostname, ip, groups, type_ip, enable, master, cred, alert, metrics, port, desc) + sql = """ INSERT INTO servers (hostname, ip, groups, type_ip, enable, master, cred, alert, metrics, port, `desc`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s') """ % (hostname, ip, group, typeip, enable, master, cred, alert, metrics, port, desc) try: @@ -1233,4 +1233,4 @@ if form.getvalue('updatetoken') is not None: if form.getvalue('updatesettings') is not None: print('Content-type: text/html\n') - update_setting(form.getvalue('updatesettings'), form.getvalue('val') ) \ No newline at end of file + update_setting(form.getvalue('updatesettings'), form.getvalue('val') ) From 3e87f8f862c55a6651b8895fdb02d6f24a9f6f26 Mon Sep 17 00:00:00 2001 From: Can KAYA Date: Tue, 25 Sep 2018 19:47:14 +0300 Subject: [PATCH 3/3] reserved --- app/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sql.py b/app/sql.py index 4094a575..ce4a5f70 100644 --- a/app/sql.py +++ b/app/sql.py @@ -159,7 +159,7 @@ def update_server(hostname, ip, group, typeip, enable, master, id, cred, alert, alert = '%s', metrics = '%s', port = '%s', - desc = '%s' + `desc` = '%s' where id = '%s'""" % (hostname, ip, group, typeip, enable, master, cred, alert, metrics, port, desc, id) try: cur.execute(sql)