# -*- coding: utf-8 -*- """ /*************************************************************************** Công cụ tự động rà soát và sửa lỗi trùng mã lô khi đồng bộ dữ liệu giữa máy khách và máy chủ. Bản quyền: @ THANHGIS @ May-2019. THANHGIS bảo lưu mọi quyền. ***************************************************************************/ """ import os, os.path, sys, psycopg2 from PyQt4.QtGui import * conn = psycopg2.connect("dbname='data_forest' host=localhost port=5433 user='postgres' password=''") cur = conn.cursor() query_out = """ delete from symds.sym_outgoing_batch;""" query_up = """ delete from symds.sym_data where event_type in ('I','U') and table_name = 'plot_history';""" query_in = """ delete from symds.sym_incoming_error; """ query_in_batch = """ delete from symds.sym_incoming_batch; """ query_down = """ delete from symds.sym_data where event_type in ('I','U') and table_name = 'plot'; """ cur.execute(query_in_batch) cur.execute(query_out) cur.execute(query_up) cur.execute(query_in) cur.execute(query_down) conn.commit() conn.close() QMessageBox.warning(iface.mainWindow(),u"Đã xong!", u"Vui lòng thực hiện đồng bộ lại dữ liệu. \n Báo lỗi nếu có để sửa tiếp." )