def __init__(self, _columns, _placeholders, _data): self.query = "insert into tb_earthquake_fast_ver2 ({0}) values ({1})".format( _columns, _placeholders) self.cur = db.getCursor() try: self.cur.execute(self.query, _data.values()) except BaseException as e: self.returnMsg = FailMessage().getMessage() else: self.returnMsg = SuccessMessage().getMessage() db.getDB().commit()
def __init__(self, _type, _cnt): self.query = "select word, count from tb_word_count where type like '" + str( _type) + "' order by count desc limit " + str(_cnt) + ";" self.cur = db.getCursor() try: self.cur.execute(self.query) except BaseException as e: self.returnMsg = FailMessage().getMessage() else: self.row = self.cur.fetchall() self.returnMsg = SuccessMessage().getMessage()
def __init__(self, _userIP, _encryptKey): self.query = "insert into tb_access_auth values ('" + _userIP + "',HEX(AES_ENCRYPT('" + _encryptKey + "','acorn')),sysdate(),'on',null);" self.cur = db.getCursor() try: self.cur.execute(self.query) self.returnMsg = SuccessMessage().getMessage() except BaseException as e: logger.writeLog("error", "Token Insert Error. : {0}".format(e)) self.returnMsg = FailMessage().getMessage() else: logger.writeLog("info", "Token Commit Success.") db.getDB().commit()
def __init__(self, _key, _title, _content, _percentage): self.query = "insert into tb_notice(time, value, route, content, percentage) values (sysdate(), '" + _key + "', 'Twitter', '" + _content + "', " + _percentage + ");" self.cur = db.getCursor() try: self.cur.execute(self.query) self.returnMsg = SuccessMessage().getMessage() except BaseException as e: logger.writeLog("error", "Notice Insert Error. : {0}".format(e)) self.returnMsg = FailMessage().getMessage() else: logger.writeLog("info", "Notice Commit Success.") db.getDB().commit()
def __init__(self, _Dict): values = ",".join(_Dict.keys()) placeHolder = ",".join(['%s'] * len(_Dict)) self.query = "insert into tb_twitter_contents ({0}) values ({1});".format( values, placeHolder) self.cur = db.getCursor() try: self.cur.execute(self.query, _Dict.values()) except BaseException as e: self.returnMsg = FailMessage().getMessage() else: self.returnMsg = SuccessMessage().getMessage() db.getDB().commit()
def isEmpty(self, _row): if _row[0] is 1: #값이 있으면 self.returnMsg = SuccessMessage().getMessage() else: #값이 없으면 self.returnMsg = FailMessage().getMessage()