示例#1
0
bool QtSqlCachedResult::fetch(int i)
{
    if ((!isActive()) || (i < 0))
	return FALSE;
    if (at() == i)
	return TRUE;
    if (d->forwardOnly) {
	// speed hack - do not copy values if not needed
	if (at() > i || at() == QSql::AfterLast)
	    return FALSE;
	while(at() < i - 1) {
	    if (!gotoNext(0))
		return FALSE;
	    setAt(at() + 1);
	}
	if (!gotoNext(d->current))
	    return FALSE;
	setAt(at() + 1);
	return TRUE;
    }
    if (d->seek(i)) {
	setAt(i);
	return TRUE;
    }
    setAt(d->rowCacheEnd - 1);
    while (at() < i) {
	if (!cacheNext())
	    return FALSE;
    }
    return TRUE;
}
bool ZSqliteCipherCachedResult::fetchNext()
{
    if (d->canSeek(at() + 1)) {
        setAt(at() + 1);
        return true;
    }
    return cacheNext();
}
示例#3
0
bool QtSqlCachedResult::fetchNext()
{
    if (d->seek(at() + 1)) {
	setAt(at() + 1);
	return TRUE;
    }
    return cacheNext();
}
bool ZSqliteCipherCachedResult::fetchFirst()
{
    if (d->forwardOnly && at() != QSql::BeforeFirstRow) {
        return false;
    }
    if (d->canSeek(0)) {
        setAt(0);
        return true;
    }
    return cacheNext();
}
示例#5
0
bool QtSqlCachedResult::fetchFirst()
{
    if (d->forwardOnly && at() != QSql::BeforeFirst) {
	return FALSE;
    }
    if (d->seek(0)) {
	setAt(0);
	return TRUE;
    }
    return cacheNext();
}
bool ZSqliteCipherCachedResult::fetch(int i)
{
    if ((!isActive()) || (i < 0))
        return false;
    if (at() == i)
        return true;
    if (d->forwardOnly) {
        // speed hack - do not copy values if not needed
        if (at() > i || at() == QSql::AfterLastRow)
            return false;
        while(at() < i - 1) {
            if (!gotoNext(d->cache, -1))
                return false;
            setAt(at() + 1);
        }
        if (!gotoNext(d->cache, 0))
            return false;
        setAt(at() + 1);
        return true;
    }
    if (d->canSeek(i)) {
        setAt(i);
        return true;
    }
    if (d->rowCacheEnd > 0)
        setAt(d->cacheCount());
    while (at() < i + 1) {
        if (!cacheNext()) {
            if (d->canSeek(i))
                break;
            return false;
        }
    }
    setAt(i);

    return true;
}