Пример #1
0
def is_existed(stockId, report_date, errorType):
    mycursor = mydb.cursor()
    mycursor.execute(sqlIsExisted, (stockId, report_date, errorType))
    result = mycursor.fetchall()
    mydb.commit()
    if (len(result) > 0):
        return True
    else:
        return False
Пример #2
0
def is_existed(sql, stockId, data):
    mycursor = mydb.cursor()
    mycursor.execute(sqlIsExisted, (stockId, data[0]))
    result = mycursor.fetchall()
    mydb.commit()
    if (len(result) > 0):
        return True
    else:
        return False
Пример #3
0
def save(stockId, report_date, errorType):
    data = []
    now = datetime.datetime.now()
    now = now.strftime("%Y-%m-%d %H:%M:%S")
    data.append(now)
    data.append(stockId)
    data.append(report_date)
    data.append(errorType)
    data.append(0)
    if (is_existed(stockId, report_date, errorType)):
        print("存储股票代码:" + stockId + "," + report_date + "期错误日志已存在")
    else:
        mycursor = mydb.cursor()
        mycursor.execute(sqlInsert, data)
        mydb.commit()
        print("存储股票代码:" + stockId + "," + report_date + "期错误日志成功")
Пример #4
0
def save(sql, data):
    mycursor = mydb.cursor()
    mycursor.execute(sql, data)
    mydb.commit()
Пример #5
0
def save(sql, data):
    mycursor = mydb.cursor()
    mycursor.execute(sql, data)
    mydb.commit()
    print(mycursor.lastrowid)