예제 #1
0
def db_get_int(row_handle, index, error):
    row = ffi.from_handle(row_handle)
    error[0] = 0
    try:
        return int(row.row[index])
    except Exception:
        error[0] = 1
    return 0
예제 #2
0
def db_get_int(row_handle, index, error):
    row = ffi.from_handle(row_handle)
    error[0] = 0
    try:
        return int(row.row[index])
    except Exception:
        error[0] = 1
    return 0
예제 #3
0
def db_get_string(row_handle, index, error):
    row = ffi.from_handle(row_handle)
    error[0] = 0
    try:
        if index not in row.handlers:
            row.handlers[index] = ffi.new("char[]", row.row[index].encode('utf-8'))
        return row.handlers[index]
    except Exception:
        error[0] = 1
    return ffi.NULL
예제 #4
0
def db_get_string(row_handle, index, error):
    row = ffi.from_handle(row_handle)
    error[0] = 0
    try:
        if index not in row.handlers:
            row.handlers[index] = ffi.new("char[]",
                                          row.row[index].encode('utf-8'))
        return row.handlers[index]
    except Exception:
        error[0] = 1
    return ffi.NULL
예제 #5
0
def db_fetchone(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    return cursor.fetchone()
예제 #6
0
def db_execute(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    cursor.result = engine.execute(cursor.statement, cursor.args)
예제 #7
0
def db_prepare(cursor_handle, statement):
    cursor = ffi.from_handle(cursor_handle)
    if cursor.result:
        cursor.result.close()
    cursor._init()
    cursor.statement = ffi.string(statement)
예제 #8
0
def db_close_cursor(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    if cursor.result:
        cursor.result.close()
    handles.remove(cursor_handle)
예제 #9
0
def db_fetchone(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    return cursor.fetchone()
예제 #10
0
def db_execute(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    cursor.result = engine.execute(cursor.statement, cursor.args)
예제 #11
0
def db_prepare(cursor_handle, statement):
    cursor = ffi.from_handle(cursor_handle)
    if cursor.result:
        cursor.result.close()
    cursor._init()
    cursor.statement = ffi.string(statement)
예제 #12
0
def db_close_cursor(cursor_handle):
    cursor = ffi.from_handle(cursor_handle)
    if cursor.result:
        cursor.result.close()
    handles.remove(cursor_handle)