def odb_exec(self, sql, params=(), fetch='many', auto_commit=True): """ Выполнение запросов """ self.db_message = '' res = [] if self.db_connect: try: res = self.db_cursor.execute(sql, params) if re.findall( 'delete|update|execute|insert|DELETE|UPDATE|EXECUTE|INSERT', sql): fetch = 'none' if fetch == 'many': res = self.db_cursor.fetchall() if fetch == 'one': res = self.db_cursor.fetchone() if auto_commit: self.db_connect.commit() except mysql.connector.InterfaceError as err: self.db_message = rqu.TracebackLog(err) else: self.db_message = 'Unable to complete network request to host' return res
def run(self): print 'db/layer=%s, server code=%s' % (self.__name_db, self.__server_code) + c.kr_term_enter try: a = QKernel(self.__name_db, self.__server_code, db_user=self.__db_user, db_pass=self.__db_pass, layer_code=self.__name_db, layer_conf=self.__layer_conf, run_server=False, sn_name=self.__sn_name) a.run(kill_event=self.__kill_event) except: print rqu.TracebackLog('')
def get_connect(self): """ Установка подключения к БД MSSQL """ pyodbc.pooling = False self.db_connect = None self.db_message = '' self.db_cursor = None if self.cfg.status_config == c.kr_status_config_error: self.db_message = c.kr_message_error_badconfig try: self.db_connect = pyodbc.connect(self.cfg.connectstring) self.db_cursor = self.db_connect.cursor() except: self.db_message = rqu.TracebackLog('')
#a = k.QKernel('NVS6', 'NVSHOP6') #a = k.QKernel('NVS4', 'NVSHOP4') #a = k.QKernel('statistic', 'NVSTAT') #a = k.QKernel('vinsent', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('MAGNIT', 'TASKSERVER') # a = k.QKernel('NVWH', 'TASKSERVER') #a = k.QKernel('NVWHTEST', 'TASKSERVER') #a = k.QKernel('AMSTOR', 'TASKSERVER') #a = k.QKernel('ARTWINE', 'TASKSERVER') #a = k.QKernel('URWH', 'TSD2') #a = k.QKernel('ZK', 'ZK') #a = k.QKernel('VT', 'TASKSERVER') #a = k.QKernel('VTSC', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('DONTEXPROM', 'TASKSERVER') #a = k.QKernel('SURGUT', 'TASKSERVER') #a = k.QKernel('UPRODTORG', 'TASKSERVER') a = k.QKernel('3Pine', 'TASKSERVER') #a = k.QKernel('BPL', 'TASKSERVER') #a = k.QKernel('ENGINE_LITEBOX', 'TASKSERVER') #a = k.QKernel('L_DR', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('L_RARUS', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('L_AKREM', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('L_VESTA', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('L_V', 'TASKSERVER', 'SYSDBA', 'masterkey') #a = k.QKernel('L_MIR', 'TASKSERVER', 'SYSDBA', 'masterkey', sn_name='VEGA', layer_code='OOO_Mir_=160531_110910U') #a = k.QKernel('Skaynet', 'TASKSERVER', 'SYSDBA', 'masterkey', sn_name='VEGA', layer_code='OOO_Skaynet=160530_092519B') #a = k.QKernel('L_TRIUMF', 'TASKSERVER', 'SYSDBA', 'masterkey', sn_name='VEGA', layer_code='OOO_Triumf=160614_0829186') # a = k.QKernel('L_GLOBAL', 'TASKSERVER', 'SYSDBA', 'masterkey') except: print rqu.TracebackLog('')
def TracebackLog(self, message, SaveLogDB=False): message = rqu.TracebackLog(message) self.LogFile(message, SaveLogDB=SaveLogDB)
def TracebackLog(self, message): message = rqu.TracebackLog(message) self.parent.log_server(message, krconst.log_error)