Error with increment_to_next


#1

Hi
I get this error which I can’t figure out. This is the bug message and my source code. it always stops at the second attribute’s iteration.
Thanks for anyone helping me

Chunk iterator 0 loaded.
Chunk iterator 1 loaded.
Chunk iterator 2 loaded.
Chunk iterator 3 loaded.
Chunk iterator 4 loaded.
Chunk iterator 5 loaded.
Chunk iterator 6 loaded.
Chunk iterator 7 loaded.
Chunk iterator 8 loaded.
Chunk iterator 0 loaded.
Traceback (most recent call last):
File “test.py”, line 34, in
main()
File “test.py”, line 30, in main
iters[i].increment_to_next()
File “/opt/scidb/12.3/lib/libscidbpython.py”, line 841, in increment_to_next
def increment_to_next(self): return _libscidbpython.ConstIterator_increment_to_next(self)
IndexError: UserException in file: src/array/StreamArray.cpp function: moveNext line: 108
Error id: scidb::SCIDB_SE_EXECUTION::SCIDB_LE_NO_CURRENT_BITMAP_CHUNK
Error description: Error during query execution. No current bitmap chunk.

This is the source

[code]def main():
db = scidb.connect(“localhost”, 1239)
result = db.executeQuery(“select * from scan(sciaddr)”, “aql”)
desc = result.array.getArrayDesc()
dims = desc.getDimensions()
attrs = desc.getAttributes()

iters = []
for i in range (attrs.size()): 
    attrid = attrs[i].getId() 
    iters.append(result.array.getConstIterator(attrid))
    print "attribute attrid = %d loaded" % (attrid)
for i in range(attrs.size()-1):
    nc = -1
    while not iters[i].end():
        nc += 1
        print ('Chunk iterator {} loaded.'.format(nc))                
        iters[i].increment_to_next()[/code]

#2

Hi jianhe,

This line should be placed in the for loop, instead of the while loop as following:

[code]def main():
db = scidb.connect(“localhost”, 1239)
result = db.executeQuery(“select * from scan(sciaddr)”, “aql”)
desc = result.array.getArrayDesc()
dims = desc.getDimensions()
attrs = desc.getAttributes()

iters = []
for i in range (attrs.size()): 
    attrid = attrs[i].getId() 
    iters.append(result.array.getConstIterator(attrid))
    print "attribute attrid = %d loaded" % (attrid)
for i in range(attrs.size()-1):
    nc = -1
    while not iters[i].end():
        nc += 1
        print ('Chunk iterator {} loaded.'.format(nc))                
    [b]iters[i].increment_to_next()[/b][/code]