コード例 #1
0
ファイル: ib_test1.py プロジェクト: vpelletier/python-innodb
def do_query(crsr):
    tpl = innodb.clust_read_tuple_create(crsr)
    assert tpl
    innodb.cursor_first(crsr)
    while True:
        try:
            innodb.cursor_read_row(crsr, tpl)
        except innodb.InnoDBError, exc:
            error_code = exc.getErrorCode()
            assert(error_code in (libinnodb.DB_END_OF_INDEX,
                libinnodb.DB_RECORD_NOT_FOUND))
            break
        test0aux.print_tuple(sys.stdout, tpl)
        tpl = innodb.tuple_clear(tpl)
        assert tpl
        try:
            innodb.cursor_next(crsr)
        except innodb.InnoDBError, exc:
            error_code = exc.getErrorCode()
            assert(error_code in (libinnodb.DB_END_OF_INDEX,
                libinnodb.DB_RECORD_NOT_FOUND))
            break
コード例 #2
0
def print_lt_5(tpl):
    result = tpl[0] < 5
    if result:
        test0aux.print_tuple(sys.stdout, tpl._tuple)
    return result
コード例 #3
0
def print_all(tpl):
    test0aux.print_tuple(sys.stdout, tpl._tuple)
    return True