コード例 #1
0
ファイル: sql_funcs.py プロジェクト: toku463ne/zabbix_anomaly
def exec_selsql(conftarget, strsql, colidx=-1):
    data = db(conftarget).exec_selsql(strsql)
    if colidx < 0:
        return data
    arr = []
    for r in data:
        arr.append(r[colidx])
    return arr
コード例 #2
0
ファイル: sql_funcs.py プロジェクト: toku463ne/zabbix_anomaly
def g_get_data(conftarget, strsql):
    cursor = db(conftarget).get_cursor()
    cursor.execute(strsql)

    for row in cursor:
        tpl = ()
        for col in row:
            tpl += (col,)
        yield tpl

    cursor.close()
コード例 #3
0
def g_get_kabuka(meigaras=[], startd="", endd=""):
    strsql = "select code, date, open, high, low, close, volume from trade.kabuka"
    wherestr = general_kabuka_where(meigaras, startd, endd)
    strsql = strsql + wherestr
    strsql = strsql + " order by code, date ;"
    
    cursor = db().get_cursor()
    cursor.execute(strsql)

    for row in cursor:
        i = iter(row)
        code = next(i)
        date = next(i)
        open = next(i)
        high = next(i)
        low = next(i)
        close = next(i)
        vol = next(i)
        yield (code, date, open, high, low, close, vol)
    
    cursor.close()
コード例 #4
0
ファイル: sql_funcs.py プロジェクト: toku463ne/zabbix_anomaly
def exec_updsql(conftarget, strsql):
    db(conftarget).exec_updsql(strsql)
コード例 #5
0
ファイル: sql_funcs.py プロジェクト: toku463ne/zabbix_anomaly
def exec_selsqlh(conftarget, strsql):
    return db(conftarget).exec_selsqlh(strsql)
コード例 #6
0
ファイル: sqlrun.py プロジェクト: toku463ne/trade_advisor
def exec_updsql(strsql):
    db().exec_updsql(strsql)
コード例 #7
0
ファイル: sqlrun.py プロジェクト: toku463ne/trade_advisor
def exec_selsqlh(strsql):
    return db().exec_selsqlh(strsql)