bool SelectStepCallback(SQLiteQuery qr, bool hasdata, object state)
    {
        TestCallbackData data = state as TestCallbackData;

        if (hasdata)
        {
            // we have something to read!
            // do test readed values...
            string testStringFromSelect = qr.GetString("str_field");
            if (testStringFromSelect != testString)
            {
                throw new Exception("Test string are not equal!");
            }

            byte[] testBlobFromSelect = qr.GetBlob("blob_field");

            if (testBlobFromSelect.Length != testBlob.Length)
            {
                throw new Exception("Test blobs are not equal!");
            }

            for (int i = 0; i < testBlobFromSelect.Length; i++)
            {
                if (testBlobFromSelect[i] != testBlob[i])
                {
                    throw new Exception("Test blobs are not equal!");
                }
            }

            data.Decriment();
        }

        return(hasdata);        // repeat, maybe we have one more record
    }
Exemple #2
0
    void SelectStepCallback(SQLiteQuery qr, bool step, object state)
    {
        TestCallbackData data = state as TestCallbackData;

        if (step)
        {
            // we have something to read!
            // do test readed values...
            string testStringFromSelect = qr.GetString("str_field");
            if (testStringFromSelect != testString)
            {
                throw new Exception("Test string are not equal!");
            }

            byte[] testBlobFromSelect = qr.GetBlob("blob_field");

            if (testBlobFromSelect.Length != testBlob.Length)
            {
                throw new Exception("Test blobs are not equal!");
            }

            for (int i = 0; i < testBlobFromSelect.Length; i++)
            {
                if (testBlobFromSelect[i] != testBlob[i])
                {
                    throw new Exception("Test blobs are not equal!");
                }
            }

            data.Decriment();

            // do next read.
            asyncDB.Step(qr, SelectStepCallback, state);
        }
        else
        {
            // we reach limit or finish reading.
            asyncDB.Release(qr, SelectQueryReleased, null);
        }
    }