Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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()
Ejemplo n.º 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()
Ejemplo n.º 4
0
def exec_updsql(conftarget, strsql):
    db(conftarget).exec_updsql(strsql)
Ejemplo n.º 5
0
def exec_selsqlh(conftarget, strsql):
    return db(conftarget).exec_selsqlh(strsql)
Ejemplo n.º 6
0
def exec_updsql(strsql):
    db().exec_updsql(strsql)
Ejemplo n.º 7
0
def exec_selsqlh(strsql):
    return db().exec_selsqlh(strsql)