RdbStoreResultSetJsunit.test.js 67.5 KB
Newer Older
S
smagicyun 已提交
1 2 3 4 5 6 7 8 9
/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
Y
yanglifeng 已提交
10
 * distributed under the License is distributed on an 'AS IS' BASIS,
S
smagicyun 已提交
11 12 13 14 15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
16
import dataRdb from '@ohos.data.rdb'
S
smagicyun 已提交
17

Y
yanglifeng 已提交
18 19
const TAG = '[RDB_JSKITS_TEST]'
const CREATE_TABLE_TEST = 'CREATE TABLE IF NOT EXISTS test (' + 'id INTEGER PRIMARY KEY AUTOINCREMENT, ' + 'data1 text,' + 'data2 long, ' + 'data3 double,' + 'data4 blob)';
S
smagicyun 已提交
20 21

const STORE_CONFIG = {
Y
yanglifeng 已提交
22
    name: 'Resultset.db',
S
smagicyun 已提交
23
}
1
18834416147 已提交
24
const COLOUNM_NAMES = ["id","data1","data2","data3","data4"];
S
smagicyun 已提交
25 26 27 28 29
var rdbStore = undefined;

describe('rdbResultSetTest', function () {
    beforeAll(async function () {
        console.info(TAG + 'beforeAll')
30
        rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
S
smagicyun 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
        await rdbStore.executeSql(CREATE_TABLE_TEST, null);
        await createTest();
    })

    beforeEach(async function () {
        console.info(TAG + 'beforeEach')
    })

    afterEach(function () {
        console.info(TAG + 'afterEach')
    })

    afterAll(async function () {
        console.info(TAG + 'afterAll')
        rdbStore = null
Y
yanglifeng 已提交
46
        await dataRdb.deleteRdbStore('Resultset.db');
S
smagicyun 已提交
47 48 49
    })
    //插入数据
    async function createTest() {
L
liangzhenyu123 已提交
50
        console.info(TAG + 'createTest data start');
S
smagicyun 已提交
51 52 53
        {
            var u8 = new Uint8Array([1, 2, 3])
            const valueBucket = {
Y
yanglifeng 已提交
54 55 56 57
                'data1': 'hello',
                'data2': 10,
                'data3': 1.0,
                'data4': u8,
S
smagicyun 已提交
58
            }
Y
yanglifeng 已提交
59
            await rdbStore.insert('test', valueBucket)
S
smagicyun 已提交
60 61 62 63
        }
        {
            var u8 = new Uint8Array([3, 4, 5])
            const valueBucket = {
Y
yanglifeng 已提交
64 65 66 67
                'data1': '2',
                'data2': -5,
                'data3': 2.5,
                'data4': u8,
S
smagicyun 已提交
68
            }
Y
yanglifeng 已提交
69
            await rdbStore.insert('test', valueBucket)
S
smagicyun 已提交
70 71 72 73
        }
        {
            var u8 = new Uint8Array(0)
            const valueBucket = {
Y
yanglifeng 已提交
74 75 76 77
                'data1': 'hello world',
                'data2': 3,
                'data3': 1.8,
                'data4': u8,
S
smagicyun 已提交
78
            }
Y
yanglifeng 已提交
79
            await rdbStore.insert('test', valueBucket)
S
smagicyun 已提交
80
        }
L
liangzhenyu123 已提交
81
        console.info(TAG + 'createTest data end');
S
smagicyun 已提交
82 83 84 85 86 87 88 89
    }

    /**
     * @tc.name resultSet getBlob normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0010
     * @tc.desc resultSet getBlob normal test
     */
    it('testGetBlob0001', 0, async function (done) {
L
liangzhenyu123 已提交
90
        console.info(TAG + '************* testGetBlob0001 start *************');
Y
yanglifeng 已提交
91
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
92 93 94 95
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
Y
yanglifeng 已提交
96 97
                const id = resultSet.getLong(resultSet.getColumnIndex('id'))
                const data4 = resultSet.getBlob(resultSet.getColumnIndex('data4'))
L
liangzhenyu123 已提交
98
                console.info(TAG + 'id=' + id + ', data4=' + data4);
S
smagicyun 已提交
99 100 101 102 103 104 105 106 107 108 109
                expect(1).assertEqual(data4[0]);
                expect(2).assertEqual(data4[1]);
                expect(3).assertEqual(data4[2]);
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
110
        console.info(TAG + '************* testGetBlob0001 end *************');
S
smagicyun 已提交
111 112 113 114 115 116 117 118
    })

    /**
     * @tc.name resultSet getBlob normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0011
     * @tc.desc resultSet getBlob normal test
     */
    it('testGetBlob0002', 0, async function (done) {
L
liangzhenyu123 已提交
119
        console.info(TAG + '************* testGetBlob0002 start *************');
Y
yanglifeng 已提交
120
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
121 122 123 124 125
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
126 127
                const id = resultSet.getLong(resultSet.getColumnIndex('id'))
                const data4 = resultSet.getBlob(resultSet.getColumnIndex('data4'))
L
liangzhenyu123 已提交
128
                console.info(TAG + 'id=' + id + ', data4=' + data4);
S
smagicyun 已提交
129 130 131 132 133 134 135 136 137 138 139
                expect(3).assertEqual(data4[0]);
                expect(4).assertEqual(data4[1]);
                expect(5).assertEqual(data4[2]);
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
140
        console.info(TAG + '************* testGetBlob0002 end *************');
S
smagicyun 已提交
141 142 143 144 145 146 147 148
    })

    /**
     * @tc.name resultSet getBlob normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0012
     * @tc.desc resultSet getBlob normal test
     */
    it('testGetBlob0003', 0, async function (done) {
L
liangzhenyu123 已提交
149
        console.info(TAG + '************* testGetBlob0003 start *************');
Y
yanglifeng 已提交
150
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
151 152 153 154 155 156
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
157 158
                const id = resultSet.getLong(resultSet.getColumnIndex('id'))
                const data4 = resultSet.getBlob(resultSet.getColumnIndex('data4'))
L
liangzhenyu123 已提交
159
                console.info(TAG + 'id=' + id);
S
smagicyun 已提交
160 161 162 163 164 165 166 167
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
168
        console.info(TAG + '************* testGetBlob0003 end *************');
S
smagicyun 已提交
169 170 171 172 173 174 175 176
    })

    /**
     * @tc.name resultSet isStarted normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0020
     * @tc.desc resultSet isStarted normal test
     */
    it('testIsStarted0001', 0, async function (done) {
L
liangzhenyu123 已提交
177
        console.info(TAG + '************* testIsStarted0001 start *************');
Y
yanglifeng 已提交
178
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
179 180 181 182 183 184 185 186
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(false).assertEqual(resultSet.isStarted)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
187
        console.info(TAG + '************* testIsStarted0001 end *************');
S
smagicyun 已提交
188 189 190 191 192 193 194 195
    })

    /**
     * @tc.name resultSet isStarted normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0021
     * @tc.desc resultSet isStarted normal test
     */
    it('testIsStarted0002', 0, async function (done) {
L
liangzhenyu123 已提交
196
        console.info(TAG + '************* testIsStarted0002 start *************');
Y
yanglifeng 已提交
197
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
198 199 200 201 202 203 204 205 206
        let resultSet = await rdbStore.query(predicates)
        try {
            resultSet.goTo(1)
            expect(true).assertEqual(resultSet.isStarted)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
207
        console.info(TAG + '************* testIsStarted0002 end *************');
S
smagicyun 已提交
208 209 210 211 212 213 214 215
    })

    /**
     * @tc.name resultSet isStarted normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0022
     * @tc.desc resultSet isStarted normal test
     */
    it('testIsStarted0003', 0, async function (done) {
L
liangzhenyu123 已提交
216
        console.info(TAG + '************* testIsStarted0003 start *************');
Y
yanglifeng 已提交
217
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
218 219 220 221 222 223 224 225 226 227 228
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToNextRow())
            expect(true).assertEqual(resultSet.isStarted)
            expect(false).assertEqual(resultSet.goToPreviousRow())
            expect(false).assertEqual(resultSet.isStarted)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
229
        console.info(TAG + '************* testIsStarted0003 end *************');
S
smagicyun 已提交
230 231 232 233 234 235 236 237
    })

    /**
     * @tc.name resultSet isStarted with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0023
     * @tc.desc resultSet isStarted with no result test
     */
    it('testIsStarted0004', 0, async function (done) {
L
liangzhenyu123 已提交
238
        console.info(TAG + '************* testIsStarted0004 start *************');
Y
yanglifeng 已提交
239
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
240 241 242 243 244 245 246 247 248 249
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToNextRow())
            expect(true).assertEqual(resultSet.isStarted)
            expect(true).assertEqual(resultSet.isStarted)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
250
        console.info(TAG + '************* testIsStarted0004 end *************');
S
smagicyun 已提交
251 252 253 254 255 256 257 258 259
    })


    /**
     * @tc.name resultSet isEnded normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0030
     * @tc.desc resultSet isEnded normal test
     */
    it('testIsEnded0001', 0, async function (done) {
L
liangzhenyu123 已提交
260
        console.info(TAG + '************* testIsEnded0001 start *************');
Y
yanglifeng 已提交
261
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
262 263 264 265 266 267 268 269 270
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToFirstRow())
            expect(false).assertEqual(resultSet.isEnded)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
271
        console.info(TAG + '************* testIsEnded0001 end *************');
S
smagicyun 已提交
272 273 274 275 276 277 278 279
    })

    /**
     * @tc.name resultSet isEnded normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0031
     * @tc.desc resultSet isEnded normal test
     */
    it('testIsEnded0002', 0, async function (done) {
L
liangzhenyu123 已提交
280
        console.info(TAG + '************* testIsEnded0002 start *************');
Y
yanglifeng 已提交
281
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
282 283 284 285 286 287 288 289 290
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToLastRow())
            expect(false).assertEqual(resultSet.isEnded)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
291
        console.info(TAG + '************* testIsEnded0002 end *************');
S
smagicyun 已提交
292 293 294 295 296 297 298 299
    })

    /**
     * @tc.name resultSet isEnded normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0032
     * @tc.desc resultSet isEnded normal test
     */
    it('testIsEnded0003', 0, async function (done) {
L
liangzhenyu123 已提交
300
        console.info(TAG + '************* testIsEnded0003 start *************');
Y
yanglifeng 已提交
301
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
302 303 304 305 306 307 308 309 310
        let resultSet = await rdbStore.query(predicates)
        try {
            resultSet.goToRow(3)
            expect(true).assertEqual(resultSet.isEnded)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
311
        console.info(TAG + '************* testIsEnded0003 end *************');
S
smagicyun 已提交
312 313 314 315 316 317 318 319
    })

    /**
     * @tc.name resultSet isEnded normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0033
     * @tc.desc resultSet isEnded normal test
     */
    it('testIsEnded0004', 0, async function (done) {
L
liangzhenyu123 已提交
320
        console.info(TAG + '************* testIsEnded0004 start *************');
Y
yanglifeng 已提交
321
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
322 323 324 325 326 327 328 329 330 331
        let resultSet = await rdbStore.query(predicates)
        try {
            resultSet.goToRow(3)
            expect(true).assertEqual(resultSet.isEnded)
            expect(true).assertEqual(resultSet.isEnded)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
332
        console.info(TAG + '************* testIsEnded0004 end *************');
S
smagicyun 已提交
333 334 335 336 337 338 339 340
    })

    /**
     * @tc.name resultSet rowCount normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0040
     * @tc.desc resultSet rowCount normal test
     */
    it('testRowCount0001', 0, async function (done) {
L
liangzhenyu123 已提交
341
        console.info(TAG + '************* testRowCount0001 start *************');
Y
yanglifeng 已提交
342
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
343 344 345 346 347 348 349 350
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(3).assertEqual(resultSet.rowCount)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
351
        console.info(TAG + '************* testRowCount0001 end *************');
S
smagicyun 已提交
352 353 354 355 356 357 358 359
    })

    /**
     * @tc.name resultSet rowCount with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0041
     * @tc.desc resultSet rowCount with no result test
     */
    it('testRowCount0002', 0, async function (done) {
L
liangzhenyu123 已提交
360
        console.info(TAG + '************* testRowCount0002 start *************');
Y
yanglifeng 已提交
361 362
        let predicates = await new dataRdb.RdbPredicates('test')
        predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
363 364 365 366 367 368 369 370
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(-1).assertEqual(resultSet.rowCount)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
371
        console.info(TAG + '************* testRowCount0002 end *************');
S
smagicyun 已提交
372 373 374 375 376 377 378 379
    })

    /**
     * @tc.name resultSet rowCount test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0042
     * @tc.desc resultSet rowCount test
     */
    it('testRowCount0003', 0, async function (done) {
L
liangzhenyu123 已提交
380
        console.info(TAG + '************* testRowCount0003 start *************');
Y
yanglifeng 已提交
381 382
        let predicates = await new dataRdb.RdbPredicates('test')
        predicates.equalTo('data1', 'hello');
S
smagicyun 已提交
383 384 385 386 387 388 389 390
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(1).assertEqual(resultSet.rowCount)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
391
        console.info(TAG + '************* testRowCount0003 end *************');
S
smagicyun 已提交
392 393 394 395 396 397 398 399
    })

    /**
     * @tc.name resultSet rowCount test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0043
     * @tc.desc resultSet rowCount test
     */
    it('testRowCount0004', 0, async function (done) {
L
liangzhenyu123 已提交
400
        console.info(TAG + '************* testRowCount0004 start *************');
Y
yanglifeng 已提交
401 402 403
        let predicates = await new dataRdb.RdbPredicates('test')
        predicates.equalTo('data1', 'hello');
        predicates.equalTo('data2', 3);
S
smagicyun 已提交
404 405 406 407 408 409 410 411
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(0).assertEqual(resultSet.rowCount)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
412
        console.info(TAG + '************* testRowCount0003 end *************');
S
smagicyun 已提交
413 414 415 416 417 418 419 420
    })

    /**
     * @tc.name resultSet getLong test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0050
     * @tc.desc resultSet getLong test
     */
    it('testGetLong0001', 0, async function (done) {
L
liangzhenyu123 已提交
421
        console.info(TAG + '************* testGetLong0001 start *************');
Y
yanglifeng 已提交
422
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
423 424 425 426
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
Y
yanglifeng 已提交
427 428
                const id = resultSet.getLong(resultSet.getColumnIndex('id'))
                const data2 = resultSet.getLong(resultSet.getColumnIndex('data2'))
L
liangzhenyu123 已提交
429
                console.info(TAG + 'id=' + id + ', data2=' + data2);
S
smagicyun 已提交
430 431 432 433 434 435 436 437 438
                expect(10).assertEqual(data2);
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
439
        console.info(TAG + '************* testGetLong0001 end *************');
S
smagicyun 已提交
440 441 442 443 444 445 446 447
    })

    /**
     * @tc.name resultSet getLong test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0051
     * @tc.desc resultSet getLong test
     */
    it('testGetLong0002', 0, async function (done) {
L
liangzhenyu123 已提交
448
        console.info(TAG + '************* testGetLong0002 start *************');
Y
yanglifeng 已提交
449
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
450 451 452 453 454
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
455
                const data1 = resultSet.getLong(resultSet.getColumnIndex('data1'))
S
smagicyun 已提交
456 457 458 459 460 461 462 463 464
                expect(2).assertEqual(data1);
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
465
        console.info(TAG + '************* testGetLong0002 end *************');
S
smagicyun 已提交
466 467 468 469 470 471 472 473
    })

    /**
     * @tc.name resultSet getLong test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0052
     * @tc.desc resultSet getLong test
     */
    it('testGetLong0003', 0, async function (done) {
L
liangzhenyu123 已提交
474
        console.info(TAG + '************* testGetLong0003 start *************');
Y
yanglifeng 已提交
475
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
476 477 478 479 480
        let resultSet = await rdbStore.query(predicates)
        try {
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
481
                const data2 = resultSet.getLong(resultSet.getColumnIndex('data2'))
S
smagicyun 已提交
482 483 484 485 486 487 488 489 490
                expect(-5).assertEqual(data2);
            }
            resultSet.close();
            expect(true).assertEqual(resultSet.isClosed)
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
491
        console.info(TAG + '************* testGetLong0003 end *************');
S
smagicyun 已提交
492 493 494 495 496 497 498 499
    })

    /**
     * @tc.name resultSet getString test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0060
     * @tc.desc resultSet getString test
     */
    it('testGetString0001', 0, async function (done) {
L
liangzhenyu123 已提交
500
        console.info(TAG + '************* testGetString0001 start *************');
Y
yanglifeng 已提交
501
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
502 503 504
        let resultSet = await rdbStore.query(predicates)
        {
            expect(true).assertEqual(resultSet.goToFirstRow())
Y
yanglifeng 已提交
505 506
            const data1 = resultSet.getString(resultSet.getColumnIndex('data1'))
            expect('hello').assertEqual(data1);
S
smagicyun 已提交
507 508 509
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
510
        console.info(TAG + '************* testGetString0001 end *************');
S
smagicyun 已提交
511 512 513 514 515 516 517 518
    })

    /**
     * @tc.name resultSet getString test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0061
     * @tc.desc resultSet getString test
     */
    it('testGetString0002', 0, async function (done) {
L
liangzhenyu123 已提交
519
        console.info(TAG + '************* testGetString0002 start *************');
Y
yanglifeng 已提交
520
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
521 522 523
        let resultSet = await rdbStore.query(predicates)
        {
            expect(true).assertEqual(resultSet.goToFirstRow())
Y
yanglifeng 已提交
524 525
            const data2 = resultSet.getString(resultSet.getColumnIndex('data2'))
            expect('10').assertEqual(data2);
S
smagicyun 已提交
526 527 528
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
529
        console.info(TAG + '************* testGetString0002 end *************');
S
smagicyun 已提交
530 531 532 533 534 535 536 537
    })

    /**
     * @tc.name resultSet getString test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0062
     * @tc.desc resultSet getString test
     */
    it('testGetString0003', 0, async function (done) {
L
liangzhenyu123 已提交
538
        console.info(TAG + '************* testGetString0003 start *************');
Y
yanglifeng 已提交
539
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
540 541 542 543
        let resultSet = await rdbStore.query(predicates)
        {
            expect(true).assertEqual(resultSet.goToFirstRow())
            expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
544 545
            const data3 = resultSet.getString(resultSet.getColumnIndex('data3'))
            expect('2.5').assertEqual(data3);
S
smagicyun 已提交
546 547 548
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
549
        console.info(TAG + '************* testGetString0003 end *************');
S
smagicyun 已提交
550 551 552 553 554 555 556 557
    })

    /**
     * @tc.name resultSet getString test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0063
     * @tc.desc resultSet getString test
     */
    it('testGetString0004', 0, async function (done) {
L
liangzhenyu123 已提交
558
        console.info(TAG + '************* testGetString0004 start *************');
Y
yanglifeng 已提交
559
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
560 561 562 563 564
        let resultSet = await rdbStore.query(predicates)
        {
            expect(true).assertEqual(resultSet.goToFirstRow())
            expect(true).assertEqual(resultSet.goToNextRow())
            expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
565 566 567 568 569 570
            const data1 = resultSet.getString(resultSet.getColumnIndex('data1'))
            const data2 = resultSet.getString(resultSet.getColumnIndex('data2'))
            const data3 = resultSet.getString(resultSet.getColumnIndex('data3'))
            expect('hello world').assertEqual(data1);
            expect('3').assertEqual(data2);
            expect('1.8').assertEqual(data3);
S
smagicyun 已提交
571 572 573
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
574
        console.info(TAG + '************* testGetString0004 end *************');
S
smagicyun 已提交
575 576 577 578 579 580 581 582
    })

    /**
     * @tc.name resultSet isClosed test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0070
     * @tc.desc resultSet isClosed test
     */
    it('testIsClosed0001', 0, async function (done) {
L
liangzhenyu123 已提交
583
        console.info(TAG + '************* testIsClosed0001 start *************');
Y
yanglifeng 已提交
584
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
585 586 587 588 589 590 591 592
        let resultSet = await rdbStore.query(predicates)

        expect(3).assertEqual(resultSet.rowCount)
        resultSet.close();
        expect(true).assertEqual(resultSet.isClosed)

        resultSet = null
        done();
L
liangzhenyu123 已提交
593
        console.info(TAG + '************* testIsClosed0001 end *************');
S
smagicyun 已提交
594 595 596 597 598 599 600 601
    })

    /**
     * @tc.name resultSet isClosed with not close test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0071
     * @tc.desc resultSet isClosed with not close test
     */
    it('testIsClosed0002', 0, async function (done) {
L
liangzhenyu123 已提交
602
        console.info(TAG + '************* testIsClosed0002 start *************');
Y
yanglifeng 已提交
603
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
604 605 606 607 608
        let resultSet = await rdbStore.query(predicates)
        expect(false).assertEqual(resultSet.isClosed)

        resultSet = null
        done();
L
liangzhenyu123 已提交
609
        console.info(TAG + '************* testIsClosed0002 end *************');
S
smagicyun 已提交
610 611 612 613 614 615 616 617
    })

    /**
     * @tc.name resultSet isClosed with not close test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0072
     * @tc.desc resultSet isClosed with not close test
     */
    it('testIsClosed0003', 0, async function (done) {
L
liangzhenyu123 已提交
618
        console.info(TAG + '************* testIsClosed0003 start *************');
Y
yanglifeng 已提交
619 620
        let predicates = await new dataRdb.RdbPredicates('test')
        predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
621 622 623 624 625
        let resultSet = await rdbStore.query(predicates)
        expect(false).assertEqual(resultSet.isClosed)

        resultSet = null
        done();
L
liangzhenyu123 已提交
626
        console.info(TAG + '************* testIsClosed0003 end *************');
S
smagicyun 已提交
627 628 629 630 631 632 633 634
    })

    /**
     * @tc.name resultSet columnCount test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0080
     * @tc.desc resultSet columnCount test
     */
    it('testColumnCount0001', 0, async function (done) {
L
liangzhenyu123 已提交
635
        console.info(TAG + '************* testColumnCount0001 start *************');
S
smagicyun 已提交
636
        {
Y
yanglifeng 已提交
637
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
638 639 640 641
            let resultSet = await rdbStore.query(predicates)
            expect(5).assertEqual(resultSet.columnCount);
            resultSet = null;
            done();
L
liangzhenyu123 已提交
642
            console.info(TAG + '************* testColumnCount0001 end *************');
S
smagicyun 已提交
643 644 645 646 647 648 649 650 651
        }
    })

    /**
     * @tc.name resultSet columnCount test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0081
     * @tc.desc resultSet columnCount test
     */
    it('testColumnCount0002', 0, async function (done) {
L
liangzhenyu123 已提交
652
        console.info(TAG + '************* testColumnCount0002 start *************');
S
smagicyun 已提交
653
        {
Y
yanglifeng 已提交
654 655
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
656 657 658 659
            let resultSet = await rdbStore.query(predicates)
            expect(0).assertEqual(resultSet.columnCount);
            resultSet = null;
            done();
L
liangzhenyu123 已提交
660
            console.info(TAG + '************* testColumnCount0002 end *************');
S
smagicyun 已提交
661 662 663 664 665 666 667 668 669
        }
    })

    /**
     * @tc.name resultSet rowIndex test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0090
     * @tc.desc resultSet rowIndex test
     */
    it('testRowIndex0001', 0, async function (done) {
L
liangzhenyu123 已提交
670
        console.info(TAG + '************* testRowIndex0001 *************');
S
smagicyun 已提交
671
        {
Y
yanglifeng 已提交
672
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
673 674 675 676 677 678 679 680
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(0).assertEqual(resultSet.rowIndex)
            }

            resultSet = null;
            done();
L
liangzhenyu123 已提交
681
            console.info(TAG + '************* testRowIndex0001 end *************');
S
smagicyun 已提交
682 683 684 685 686 687 688 689 690
        }
    })

    /**
     * @tc.name resultSet rowIndex at last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0091
     * @tc.desc resultSet rowIndex at last row test
     */
    it('testRowIndex0002', 0, async function (done) {
L
liangzhenyu123 已提交
691
        console.info(TAG + '************* testRowIndex0002 *************');
S
smagicyun 已提交
692
        {
Y
yanglifeng 已提交
693
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
694 695 696 697 698 699 700 701
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(2).assertEqual(resultSet.rowIndex)
            }

            resultSet = null;
            done();
L
liangzhenyu123 已提交
702
            console.info(TAG + '************* testRowIndex0002 end *************');
S
smagicyun 已提交
703 704 705 706 707 708 709 710 711
        }
    })

    /**
     * @tc.name resultSet goToFirstRow normal test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0100
     * @tc.desc resultSet goToFirstRow normal test
     */
    it('testGoToFirstRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
712
        console.info(TAG + '************* testGoToFirstRow0001 start *************');
S
smagicyun 已提交
713

Y
yanglifeng 已提交
714
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
715 716 717 718 719 720 721 722 723
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToFirstRow())
            resultSet.close();
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
724
        console.info(TAG + '************* testGoToFirstRow0001 end *************');
S
smagicyun 已提交
725 726 727 728 729 730 731 732
    })

    /**
     * @tc.name resultSet goToFirstRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0101
     * @tc.desc resultSet goToFirstRow with no result test
     */
    it('testGoToFirstRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
733
        console.info(TAG + '************* testGoToFirstRow0002 start *************');
S
smagicyun 已提交
734

Y
yanglifeng 已提交
735 736
        let predicates = await new dataRdb.RdbPredicates('test')
        predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
737 738 739 740 741 742 743 744
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(false).assertEqual(resultSet.goToFirstRow())
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
745
        console.info(TAG + '************* testGoToFirstRow0002 end *************');
S
smagicyun 已提交
746 747 748 749 750 751 752 753
    })

    /**
     * @tc.name resultSet goToFirstRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0102
     * @tc.desc resultSet goToFirstRow test
     */
    it('testGoToFirstRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
754
        console.info(TAG + '************* testGoToFirstRow0003 start *************');
S
smagicyun 已提交
755

Y
yanglifeng 已提交
756
        let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
757 758 759 760 761 762 763 764 765 766
        let resultSet = await rdbStore.query(predicates)
        try {
            expect(true).assertEqual(resultSet.goToFirstRow())
            expect(true).assertEqual(resultSet.goToNextRow())
            expect(true).assertEqual(resultSet.goToFirstRow())
        } catch (e) {
            expect(null).assertFail();
        }
        resultSet = null
        done();
L
liangzhenyu123 已提交
767
        console.info(TAG + '************* testGoToFirstRow0003 end *************');
S
smagicyun 已提交
768 769 770 771 772 773 774 775
    })

    /**
     * @tc.name resultSet goToLastRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0110
     * @tc.desc resultSet goToFirstRow test
     */
    it('testGoToLastRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
776
        console.info(TAG + '************* testGoToLastRow0001 start *************');
S
smagicyun 已提交
777
        {
Y
yanglifeng 已提交
778
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
779 780 781 782 783 784
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
785
            console.info(TAG + '************* testGoToLastRow0001 end *************');
S
smagicyun 已提交
786 787 788 789 790 791 792 793 794
        }
    })

    /**
     * @tc.name resultSet goToLastRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0111
     * @tc.desc resultSet goToLastRow with no result test
     */
    it('testGoToLastRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
795
        console.info(TAG + '************* testGoToLastRow0002 start *************');
S
smagicyun 已提交
796
        {
Y
yanglifeng 已提交
797 798
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
799 800 801 802 803 804
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.goToLastRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
805
            console.info(TAG + '************* testGoToLastRow0002 end *************');
S
smagicyun 已提交
806 807 808 809 810 811 812 813 814
        }
    })

    /**
     * @tc.name resultSet goToLastRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0112
     * @tc.desc resultSet goToLastRow test
     */
    it('testGoToLastRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
815
        console.info(TAG + '************* testGoToLastRow0003 start *************');
S
smagicyun 已提交
816
        {
Y
yanglifeng 已提交
817
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
818 819 820 821 822 823 824 825
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(true).assertEqual(resultSet.goToPreviousRow())
                expect(true).assertEqual(resultSet.goToLastRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
826
            console.info(TAG + '************* testGoToLastRow0003 end *************');
S
smagicyun 已提交
827 828 829 830 831 832 833 834 835
        }
    })

    /**
     * @tc.name resultSet goToNextRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0120
     * @tc.desc resultSet goToNextRow test
     */
    it('testGoToNextRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
836
        console.info(TAG + '************* testGoToNextRow0001 start *************');
S
smagicyun 已提交
837
        {
Y
yanglifeng 已提交
838
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
839 840 841 842 843 844
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToNextRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
845
            console.info(TAG + '************* testGoToNextRow0001 end *************');
S
smagicyun 已提交
846 847 848 849 850 851 852 853 854
        }
    })

    /**
     * @tc.name resultSet goToNextRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0121
     * @tc.desc resultSet goToNextRow with no result test
     */
    it('testGoToNextRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
855
        console.info(TAG + '************* testGoToNextRow0002 start *************');
S
smagicyun 已提交
856
        {
Y
yanglifeng 已提交
857 858
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
859 860 861 862 863 864
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.goToNextRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
865
            console.info(TAG + '************* testGoToNextRow0002 end *************');
S
smagicyun 已提交
866 867 868 869 870 871 872 873 874
        }
    })

    /**
     * @tc.name resultSet goToNextRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0122
     * @tc.desc resultSet goToNextRow test
     */
    it('testGoToNextRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
875
        console.info(TAG + '************* testGoToNextRow0003 start *************');
S
smagicyun 已提交
876
        {
Y
yanglifeng 已提交
877
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
878 879 880 881 882 883 884 885 886
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToPreviousRow())
                expect(true).assertEqual(resultSet.goToNextRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
887
            console.info(TAG + '************* testGoToNextRow0003 end *************');
S
smagicyun 已提交
888 889 890 891 892 893 894 895 896
        }
    })

    /**
     * @tc.name resultSet goToNextRow after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0123
     * @tc.desc resultSet goToNextRow after last row test
     */
    it('testGoToNextRow0004', 0, async function (done) {
L
liangzhenyu123 已提交
897
        console.info(TAG + '************* testGoToNextRow0004 start *************');
S
smagicyun 已提交
898
        {
Y
yanglifeng 已提交
899
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
900 901 902 903 904 905 906
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(false).assertEqual(resultSet.goToNextRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
907
            console.info(TAG + '************* testGoToNextRow0004 end *************');
S
smagicyun 已提交
908 909 910 911 912 913 914 915 916
        }
    })

    /**
     * @tc.name resultSet goToPreviousRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0130
     * @tc.desc resultSet goToPreviousRow test
     */
    it('testGoToPreviousRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
917
        console.info(TAG + '************* testGoToPreviousRow0001 start *************');
S
smagicyun 已提交
918
        {
Y
yanglifeng 已提交
919
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
920 921 922 923 924 925
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.goToPreviousRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
926
            console.info(TAG + '************* testGoToPreviousRow0001 end *************');
S
smagicyun 已提交
927 928 929 930 931 932 933 934 935
        }
    })

    /**
     * @tc.name resultSet goToPreviousRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0131
     * @tc.desc resultSet goToPreviousRow with no result test
     */
    it('testGoToPreviousRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
936
        console.info(TAG + '************* testGoToPreviousRow0002 start *************');
S
smagicyun 已提交
937
        {
Y
yanglifeng 已提交
938 939
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
940 941 942 943 944 945
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.goToPreviousRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
946
            console.info(TAG + '************* testGoToPreviousRow0002 end *************');
S
smagicyun 已提交
947 948 949 950 951 952 953 954 955
        }
    })

    /**
     * @tc.name resultSet goToPreviousRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0132
     * @tc.desc resultSet goToPreviousRow test
     */
    it('testGoToPreviousRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
956
        console.info(TAG + '************* testGoToPreviousRow0003 start *************');
S
smagicyun 已提交
957
        {
Y
yanglifeng 已提交
958
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
959 960 961 962 963 964 965 966
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToPreviousRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
967
            console.info(TAG + '************* testGoToPreviousRow0003 end *************');
S
smagicyun 已提交
968 969 970 971 972 973 974 975 976
        }
    })

    /**
     * @tc.name resultSet goToPreviousRow after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0133
     * @tc.desc resultSet goToPreviousRow after last row test
     */
    it('testGoToPreviousRow0004', 0, async function (done) {
L
liangzhenyu123 已提交
977
        console.info(TAG + '************* testGoToPreviousRow0004 start *************');
S
smagicyun 已提交
978
        {
Y
yanglifeng 已提交
979
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
980 981 982 983 984 985 986
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(true).assertEqual(resultSet.goToPreviousRow())
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
987
            console.info(TAG + '************* testGoToPreviousRow0004 end *************');
S
smagicyun 已提交
988 989 990 991 992 993 994 995 996
        }
    })

    /**
     * @tc.name resultSet goTo test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0140
     * @tc.desc resultSet goTo test
     */
    it('testGoTo0001', 0, async function (done) {
L
liangzhenyu123 已提交
997
        console.info(TAG + '************* testGoTo0001 start *************');
S
smagicyun 已提交
998
        {
Y
yanglifeng 已提交
999
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1000 1001 1002 1003 1004 1005 1006 1007
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                resultSet.goTo(1)
                expect(1).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1008
            console.info(TAG + '************* testGoTo0001 end *************');
S
smagicyun 已提交
1009 1010 1011 1012 1013 1014 1015 1016 1017
        }
    })

    /**
     * @tc.name resultSet goTo with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0141
     * @tc.desc resultSet goTo with no result test
     */
    it('testGoTo0002', 0, async function (done) {
L
liangzhenyu123 已提交
1018
        console.info(TAG + '************* testGoTo0002 start *************');
S
smagicyun 已提交
1019
        {
Y
yanglifeng 已提交
1020 1021
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1022 1023 1024 1025 1026 1027 1028
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(1)
                expect(-1).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1029
            console.info(TAG + '************* testGoTo0002 end *************');
S
smagicyun 已提交
1030 1031 1032 1033 1034 1035 1036 1037 1038
        }
    })

    /**
     * @tc.name resultSet goTo test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0142
     * @tc.desc resultSet goTo test
     */
    it('testGoTo0003', 0, async function (done) {
L
liangzhenyu123 已提交
1039
        console.info(TAG + '************* testGoTo0003 start *************');
S
smagicyun 已提交
1040
        {
Y
yanglifeng 已提交
1041
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1042 1043 1044 1045 1046 1047 1048 1049 1050
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                resultSet.goTo(1)
                expect(2).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1051
            console.info(TAG + '************* testGoTo0003 end *************');
S
smagicyun 已提交
1052 1053 1054 1055 1056 1057 1058 1059 1060
        }
    })

    /**
     * @tc.name resultSet goTo after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0143
     * @tc.desc resultSet goTo after last row test
     */
    it('testGoTo0004', 0, async function (done) {
L
liangzhenyu123 已提交
1061
        console.info(TAG + '************* testGoTo0004 start *************');
S
smagicyun 已提交
1062
        {
Y
yanglifeng 已提交
1063
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1064 1065 1066 1067 1068 1069 1070 1071
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                resultSet.goTo(5)
                expect(3).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1072
            console.info(TAG + '************* testGoTo0004 end *************');
S
smagicyun 已提交
1073 1074 1075 1076 1077 1078 1079 1080 1081
        }
    })

    /**
     * @tc.name resultSet goToRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0150
     * @tc.desc resultSet goToRow test
     */
    it('testGoToRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
1082
        console.info(TAG + '************* testGoToRow0001 start *************');
S
smagicyun 已提交
1083
        {
Y
yanglifeng 已提交
1084
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1085 1086 1087 1088 1089 1090 1091 1092
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                resultSet.goToRow(1)
                expect(1).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1093
            console.info(TAG + '************* testGoToRow0001 end *************');
S
smagicyun 已提交
1094 1095 1096 1097 1098 1099 1100 1101 1102
        }
    })

    /**
     * @tc.name resultSet goToRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0151
     * @tc.desc resultSet goToRow with no result test
     */
    it('testGoToRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
1103
        console.info(TAG + '************* testGoToRow0002 start *************');
S
smagicyun 已提交
1104
        {
Y
yanglifeng 已提交
1105 1106
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1107 1108 1109 1110 1111 1112 1113
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goToRow(1)
                expect(-1).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1114
            console.info(TAG + '************* testGoToRow0002 end *************');
S
smagicyun 已提交
1115 1116 1117 1118 1119 1120 1121 1122 1123
        }
    })

    /**
     * @tc.name resultSet goToRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0152
     * @tc.desc resultSet goToRow test
     */
    it('testGoToRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
1124
        console.info(TAG + '************* testGoToRow0003 start *************');
S
smagicyun 已提交
1125
        {
Y
yanglifeng 已提交
1126
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                resultSet.goToRow(1)
                expect(1).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1137
            console.info(TAG + '************* testGoToRow0003 end *************');
S
smagicyun 已提交
1138 1139 1140 1141 1142 1143 1144 1145 1146
        }
    })

    /**
     * @tc.name resultSet goToRow after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0153
     * @tc.desc resultSet goToRow after last row test
     */
    it('testGoToRow0004', 0, async function (done) {
L
liangzhenyu123 已提交
1147
        console.info(TAG + '************* testGoToRow0004 start *************');
S
smagicyun 已提交
1148
        {
Y
yanglifeng 已提交
1149
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1150 1151 1152 1153 1154 1155 1156 1157
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                resultSet.goToRow(5)
                expect(3).assertEqual(resultSet.rowIndex)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1158
            console.info(TAG + '************* testGoToRow0004 end *************');
S
smagicyun 已提交
1159 1160 1161 1162 1163 1164 1165 1166 1167
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0160
     * @tc.desc resultSet isAtFirstRow test
     */
    it('testIsAtFirstRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
1168
        console.info(TAG + '************* testIsAtFirstRow0001 start *************');
S
smagicyun 已提交
1169
        {
Y
yanglifeng 已提交
1170
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1171 1172 1173 1174 1175 1176 1177
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1178
            console.info(TAG + '************* testIsAtFirstRow0001 end *************');
S
smagicyun 已提交
1179 1180 1181 1182 1183 1184 1185 1186 1187
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0161
     * @tc.desc resultSet isAtFirstRow with no result test
     */
    it('testIsAtFirstRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
1188
        console.info(TAG + '************* testIsAtFirstRow0002 start *************');
S
smagicyun 已提交
1189
        {
Y
yanglifeng 已提交
1190 1191
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1192 1193 1194 1195 1196 1197
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1198
            console.info(TAG + '************* testIsAtFirstRow0002 end *************');
S
smagicyun 已提交
1199 1200 1201 1202 1203 1204 1205 1206 1207
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0162
     * @tc.desc resultSet isAtFirstRow test
     */
    it('testIsAtFirstRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
1208
        console.info(TAG + '************* testIsAtFirstRow0003 start *************');
S
smagicyun 已提交
1209
        {
Y
yanglifeng 已提交
1210
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1211 1212 1213 1214 1215 1216 1217 1218
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(false).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1219
            console.info(TAG + '************* testIsAtFirstRow0003 end *************');
S
smagicyun 已提交
1220 1221 1222 1223 1224 1225 1226 1227 1228
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0163
     * @tc.desc resultSet isAtFirstRow after last row test
     */
    it('testIsAtFirstRow0004', 0, async function (done) {
L
liangzhenyu123 已提交
1229
        console.info(TAG + '************* testIsAtFirstRow0004 start *************');
S
smagicyun 已提交
1230
        {
Y
yanglifeng 已提交
1231
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1232 1233 1234 1235 1236 1237 1238
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(false).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1239
            console.info(TAG + '************* testIsAtFirstRow0004 end *************');
S
smagicyun 已提交
1240 1241 1242 1243 1244 1245 1246 1247 1248
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0165
     * @tc.descresultSet isAtFirstRow test
     */
    it('testIsAtFirstRow0005', 0, async function (done) {
L
liangzhenyu123 已提交
1249
        console.info(TAG + '************* testIsAtFirstRow0005 start *************');
S
smagicyun 已提交
1250
        {
Y
yanglifeng 已提交
1251
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1252 1253 1254 1255 1256 1257 1258 1259
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(1)
                resultSet.goTo(0)
                expect(true).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1260
            console.info(TAG + '************* testIsAtFirstRow0005 end *************');
S
smagicyun 已提交
1261 1262 1263 1264 1265 1266 1267 1268 1269
        }
    })

    /**
     * @tc.name resultSet isAtFirstRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0166
     * @tc.descresultSet isAtFirstRow test
     */
    it('testIsAtFirstRow0006', 0, async function (done) {
L
liangzhenyu123 已提交
1270
        console.info(TAG + '************* testIsAtFirstRow0006 start *************');
S
smagicyun 已提交
1271
        {
Y
yanglifeng 已提交
1272
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1273 1274 1275 1276 1277 1278 1279 1280
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(1)
                expect(true).assertEqual(resultSet.isAtFirstRow)
                expect(true).assertEqual(resultSet.isAtFirstRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1281
            console.info(TAG + '************* testIsAtFirstRow0006 end *************');
S
smagicyun 已提交
1282 1283 1284 1285 1286 1287 1288 1289 1290
        }
    })

    /**
     * @tc.name resultSet isAtLastRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0170
     * @tc.desc resultSet isAtLastRow test
     */
    it('testIsAtLastRow0001', 0, async function (done) {
L
liangzhenyu123 已提交
1291
        console.info(TAG + '************* testIsAtLastRow0001 start *************');
S
smagicyun 已提交
1292
        {
Y
yanglifeng 已提交
1293
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1294 1295 1296 1297 1298 1299 1300
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(false).assertEqual(resultSet.isAtLastRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1301
            console.info(TAG + '************* testIsAtLastRow0001 end *************');
S
smagicyun 已提交
1302 1303 1304 1305 1306 1307 1308 1309 1310
        }
    })

    /**
     * @tc.name resultSet isAtLastRow with no result test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0171
     * @tc.desc resultSet isAtLastRow with no result test
     */
    it('testIsAtLastRow0002', 0, async function (done) {
L
liangzhenyu123 已提交
1311
        console.info(TAG + '************* testIsAtLastRow0002 start *************');
S
smagicyun 已提交
1312
        {
Y
yanglifeng 已提交
1313 1314
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1315 1316 1317 1318 1319 1320
            let resultSet = await rdbStore.query(predicates)
            {
                expect(false).assertEqual(resultSet.isAtLastRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1321
            console.info(TAG + '************* testIsAtLastRow0002 end *************');
S
smagicyun 已提交
1322 1323 1324 1325 1326 1327 1328 1329 1330
        }
    })

    /**
     * @tc.name resultSet isAtLastRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0172
     * @tc.desc resultSet isAtLastRow test
     */
    it('testIsAtLastRow0003', 0, async function (done) {
L
liangzhenyu123 已提交
1331
        console.info(TAG + '************* testIsAtLastRow0003 start *************');
S
smagicyun 已提交
1332
        {
Y
yanglifeng 已提交
1333
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1334 1335 1336 1337 1338 1339 1340 1341
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(false).assertEqual(resultSet.isAtLastRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1342
            console.info(TAG + '************* testIsAtLastRow0003 end *************');
S
smagicyun 已提交
1343 1344 1345 1346 1347 1348 1349 1350 1351
        }
    })

    /**
     * @tc.name resultSet isAtLastRow after last row test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0173
     * @tc.desc resultSet isAtLastRow after last row test
     */
    it('testIsAtLastRow0004', 0, async function (done) {
L
liangzhenyu123 已提交
1352
        console.info(TAG + '************* testIsAtLastRow0004 start *************');
S
smagicyun 已提交
1353
        {
Y
yanglifeng 已提交
1354
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1355 1356 1357 1358 1359 1360 1361
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToLastRow())
                expect(true).assertEqual(resultSet.isAtLastRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1362
            console.info(TAG + '************* testIsAtLastRow0004 end *************');
S
smagicyun 已提交
1363 1364 1365 1366 1367 1368 1369 1370 1371
        }
    })

    /**
     * @tc.name resultSet isAtLastRow test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0174
     * @tc.desc resultSet isAtLastRow test
     */
    it('testIsAtLastRow0005', 0, async function (done) {
L
liangzhenyu123 已提交
1372
        console.info(TAG + '************* testIsAtLastRow0005 start *************');
S
smagicyun 已提交
1373
        {
Y
yanglifeng 已提交
1374
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1375 1376 1377 1378 1379 1380 1381 1382
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goToRow(2)
                expect(true).assertEqual(resultSet.isAtLastRow)
                expect(true).assertEqual(resultSet.isAtLastRow)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1383
            console.info(TAG + '************* testIsAtLastRow0005 end *************');
S
smagicyun 已提交
1384 1385 1386 1387 1388 1389 1390 1391 1392
        }
    })

    /**
     * @tc.name resultSet getDouble test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0180
     * @tc.desc resultSet getDouble test
     */
    it('testGetDouble0001', 0, async function (done) {
L
liangzhenyu123 已提交
1393
        console.info(TAG + '************* testGetDouble0001 start *************');
S
smagicyun 已提交
1394
        {
Y
yanglifeng 已提交
1395
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1396 1397 1398
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(1)
Y
yanglifeng 已提交
1399
                const data3 = resultSet.getDouble(resultSet.getColumnIndex('data3'))
S
smagicyun 已提交
1400 1401 1402 1403
                expect(1.0).assertEqual(data3)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1404
            console.info(TAG + '************* testGetDouble0001 end *************');
S
smagicyun 已提交
1405 1406 1407 1408 1409 1410 1411 1412 1413
        }
    })

    /**
     * @tc.name resultSet getDouble test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0181
     * @tc.desc resultSet getDouble test
     */
    it('testGetDouble0002', 0, async function (done) {
L
liangzhenyu123 已提交
1414
        console.info(TAG + '************* testGetDouble0002 start *************');
S
smagicyun 已提交
1415
        {
Y
yanglifeng 已提交
1416
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1417 1418 1419
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(2)
Y
yanglifeng 已提交
1420
                const data3 = resultSet.getDouble(resultSet.getColumnIndex('data3'))
S
smagicyun 已提交
1421 1422 1423 1424
                expect(2.5).assertEqual(data3)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1425
            console.info(TAG + '************* testGetDouble0002 end *************');
S
smagicyun 已提交
1426 1427 1428 1429 1430 1431 1432 1433 1434
        }
    })

    /**
     * @tc.name resultSet getDouble test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0182
     * @tc.desc resultSet getDouble test
     */
    it('testGetDouble0003', 0, async function (done) {
L
liangzhenyu123 已提交
1435
        console.info(TAG + '************* testGetDouble0003 start *************');
S
smagicyun 已提交
1436
        {
Y
yanglifeng 已提交
1437
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1438 1439 1440
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(3)
Y
yanglifeng 已提交
1441
                const data3 = resultSet.getDouble(resultSet.getColumnIndex('data3'))
S
smagicyun 已提交
1442 1443 1444 1445
                expect(1.8).assertEqual(data3)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1446
            console.info(TAG + '************* testGetDouble0003 end *************');
S
smagicyun 已提交
1447 1448 1449 1450 1451 1452 1453 1454 1455
        }
    })

    /**
     * @tc.name resultSet getDouble test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0183
     * @tc.desc resultSet getDouble test
     */
    it('testGetDouble0004', 0, async function (done) {
L
liangzhenyu123 已提交
1456
        console.info(TAG + '************* testGetDouble0004 start *************');
S
smagicyun 已提交
1457
        {
Y
yanglifeng 已提交
1458
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1459 1460 1461
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goTo(1)
Y
yanglifeng 已提交
1462
                const data2 = resultSet.getDouble(resultSet.getColumnIndex('data2'))
S
smagicyun 已提交
1463 1464 1465 1466
                expect(10).assertEqual(data2)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1467
            console.info(TAG + '************* testGetDouble0004 end *************');
S
smagicyun 已提交
1468 1469 1470 1471 1472 1473 1474 1475 1476
        }
    })

    /**
     * @tc.name resultSet isColumnNull test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0190
     * @tc.desc resultSet isColumnNull test
     */
    it('testIsColumnNull0001', 0, async function (done) {
L
liangzhenyu123 已提交
1477
        console.info(TAG + '************* testIsColumnNull0001 start *************');
S
smagicyun 已提交
1478
        {
Y
yanglifeng 已提交
1479
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1480 1481 1482 1483 1484
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
1485
                const isColumnNull1 = resultSet.isColumnNull(resultSet.getColumnIndex('data1'))
S
smagicyun 已提交
1486 1487 1488 1489
                expect(false).assertEqual(isColumnNull1)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1490
            console.info(TAG + '************* testIsColumnNull0001 end *************');
S
smagicyun 已提交
1491 1492 1493 1494 1495 1496 1497 1498 1499
        }
    })

    /**
     * @tc.name resultSet isColumnNull test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0191
     * @tc.desc resultSet isColumnNull test
     */
    it('testIsColumnNull0002', 0, async function (done) {
L
liangzhenyu123 已提交
1500
        console.info(TAG + '************* testIsColumnNull0002 start *************');
S
smagicyun 已提交
1501
        {
Y
yanglifeng 已提交
1502
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1503 1504 1505 1506 1507
            let resultSet = await rdbStore.query(predicates)
            {
                expect(true).assertEqual(resultSet.goToFirstRow())
                expect(true).assertEqual(resultSet.goToNextRow())
                expect(true).assertEqual(resultSet.goToNextRow())
Y
yanglifeng 已提交
1508
                const isColumnNull4 = resultSet.isColumnNull(resultSet.getColumnIndex('data4'))
S
smagicyun 已提交
1509 1510 1511 1512
                expect(true).assertEqual(isColumnNull4)
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1513
            console.info(TAG + '************* testIsColumnNull0002 end *************');
S
smagicyun 已提交
1514 1515 1516 1517 1518 1519 1520 1521 1522
        }
    })

    /**
     * @tc.name resultSet isColumnNull test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0192
     * @tc.desc resultSet isColumnNull test
     */
    it('testIsColumnNull0003', 0, async function (done) {
L
liangzhenyu123 已提交
1523
        console.info(TAG + '************* testIsColumnNull0003 start *************');
S
smagicyun 已提交
1524
        {
Y
yanglifeng 已提交
1525
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1526 1527 1528
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goToRow(5)
M
Maowen 已提交
1529
                expect(false).assertEqual(resultSet.isColumnNull(2))
S
smagicyun 已提交
1530 1531 1532
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1533
            console.info(TAG + '************* testIsColumnNull0003 end *************');
S
smagicyun 已提交
1534 1535 1536 1537 1538 1539 1540 1541
        }
    })
    /**
     * @tc.name resultSet isColumnNull test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0193
     * @tc.desc resultSet isColumnNull test
     */
    it('testIsColumnNull0004', 0, async function (done) {
L
liangzhenyu123 已提交
1542
        console.info(TAG + '************* testIsColumnNull0004 start *************');
S
smagicyun 已提交
1543
        {
Y
yanglifeng 已提交
1544
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1545 1546 1547 1548 1549 1550 1551
            let resultSet = await rdbStore.query(predicates)
            {
                resultSet.goToRow(2)
                expect(false).assertEqual(resultSet.isColumnNull(1))
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1552
            console.info(TAG + '************* testIsColumnNull0004 end *************');
S
smagicyun 已提交
1553 1554 1555 1556 1557 1558 1559 1560 1561
        }
    })

    /**
     * @tc.name resultSet getColumnIndex test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0200
     * @tc.desc resultSet getColumnIndex test
     */
    it('testGetColumnIndex0001', 0, async function (done) {
L
liangzhenyu123 已提交
1562
        console.info(TAG + '************* testGetColumnIndex0001 start *************');
S
smagicyun 已提交
1563
        {
Y
yanglifeng 已提交
1564
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1565 1566
            let resultSet = await rdbStore.query(predicates)
            expect(true).assertEqual(resultSet.goToFirstRow())
Y
yanglifeng 已提交
1567
            expect(1).assertEqual(resultSet.getColumnIndex('data1'))
S
smagicyun 已提交
1568 1569 1570

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1571
            console.info(TAG + '************* testGetColumnIndex0001 end *************');
S
smagicyun 已提交
1572 1573 1574 1575 1576 1577 1578 1579 1580
        }
    })

    /**
     * @tc.name resultSet getColumnIndex test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0201
     * @tc.desc resultSet getColumnIndex test
     */
    it('testGetColumnIndex0002', 0, async function (done) {
L
liangzhenyu123 已提交
1581
        console.info(TAG + '************* testGetColumnIndex0002 start *************');
S
smagicyun 已提交
1582
        {
Y
yanglifeng 已提交
1583 1584
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1585
            let resultSet = await rdbStore.query(predicates)
Y
yanglifeng 已提交
1586
            expect(-1).assertEqual(resultSet.getColumnIndex('data1'))
S
smagicyun 已提交
1587 1588 1589

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1590
            console.info(TAG + '************* testGetColumnIndex0002 end *************');
S
smagicyun 已提交
1591 1592 1593 1594 1595 1596 1597 1598 1599
        }
    })

    /**
     * @tc.name resultSet getColumnIndex test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0202
     * @tc.desc resultSet getColumnIndex test
     */
    it('testGetColumnIndex0003', 0, async function (done) {
L
liangzhenyu123 已提交
1600
        console.info(TAG + '************* testGetColumnIndex0003 start *************');
S
smagicyun 已提交
1601
        {
Y
yanglifeng 已提交
1602
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1603
            let resultSet = await rdbStore.query(predicates)
Y
yanglifeng 已提交
1604
            expect(-1).assertEqual(resultSet.getColumnIndex('dataX'))
S
smagicyun 已提交
1605 1606 1607

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1608
            console.info(TAG + '************* testGetColumnIndex0003 end *************');
S
smagicyun 已提交
1609 1610 1611 1612 1613 1614 1615 1616 1617
        }
    })

    /**
     * @tc.name resultSet getColumnIndex test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0203
     * @tc.desc resultSet getColumnIndex test
     */
    it('testGetColumnIndex0004', 0, async function (done) {
L
liangzhenyu123 已提交
1618
        console.info(TAG + '************* testGetColumnIndex0004 start *************');
S
smagicyun 已提交
1619
        {
Y
yanglifeng 已提交
1620
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1621
            let resultSet = await rdbStore.query(predicates)
Y
yanglifeng 已提交
1622
            expect(-1).assertEqual(resultSet.getColumnIndex(''))
S
smagicyun 已提交
1623 1624 1625

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1626
            console.info(TAG + '************* testGetColumnIndex0004 end *************');
S
smagicyun 已提交
1627 1628 1629 1630 1631 1632 1633 1634 1635
        }
    })

    /**
     * @tc.name resultSet getColumnName test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0210
     * @tc.desc resultSet getColumnName test
     */
    it('testGetColumnName0001', 0, async function (done) {
L
liangzhenyu123 已提交
1636
        console.info(TAG + '************* testGetColumnIndex0001 start *************');
S
smagicyun 已提交
1637
        {
Y
yanglifeng 已提交
1638
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1639 1640
            let resultSet = await rdbStore.query(predicates)

Y
yanglifeng 已提交
1641 1642
            expect('data1').assertEqual(resultSet.getColumnName(1))
            expect('data4').assertEqual(resultSet.getColumnName(4))
S
smagicyun 已提交
1643 1644 1645

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1646
            console.info(TAG + '************* testGetColumnName0001 end *************');
S
smagicyun 已提交
1647 1648 1649 1650 1651 1652 1653 1654 1655
        }
    })

    /**
     * @tc.name resultSet getColumnName test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0211
     * @tc.desc resultSet getColumnName test
     */
    it('testGetColumnName0002', 0, async function (done) {
L
liangzhenyu123 已提交
1656
        console.info(TAG + '************* testGetColumnName0002 start *************');
S
smagicyun 已提交
1657
        {
Y
yanglifeng 已提交
1658 1659
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1660 1661
            let resultSet = await rdbStore.query(predicates)

Y
yanglifeng 已提交
1662 1663
            expect('').assertEqual(resultSet.getColumnName(1))
            expect('').assertEqual(resultSet.getColumnName(4))
S
smagicyun 已提交
1664 1665 1666

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1667
            console.info(TAG + '************* testGetColumnName0002 end *************');
S
smagicyun 已提交
1668 1669 1670 1671 1672 1673 1674 1675 1676
        }
    })

    /**
     * @tc.name resultSet getColumnName test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0212
     * @tc.desc resultSet getColumnName test
     */
    it('testGetColumnName0003', 0, async function (done) {
L
liangzhenyu123 已提交
1677
        console.info(TAG + '************* testGetColumnName0003 start *************');
S
smagicyun 已提交
1678
        {
Y
yanglifeng 已提交
1679
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1680 1681
            let resultSet = await rdbStore.query(predicates)

Y
yanglifeng 已提交
1682
            expect('').assertEqual(resultSet.getColumnName(10))
S
smagicyun 已提交
1683 1684 1685

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1686
            console.info(TAG + '************* testGetColumnName0003 end *************');
S
smagicyun 已提交
1687 1688 1689 1690 1691 1692 1693 1694 1695
        }
    })

    /**
     * @tc.name resultSet getColumnName test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0213
     * @tc.desc resultSet getColumnName test
     */
    it('testGetColumnName0004', 0, async function (done) {
L
liangzhenyu123 已提交
1696
        console.info(TAG + '************* testGetColumnName0004 start *************');
S
smagicyun 已提交
1697
        {
Y
yanglifeng 已提交
1698 1699
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1700 1701
            let resultSet = await rdbStore.query(predicates)

Y
yanglifeng 已提交
1702
            expect('').assertEqual(resultSet.getColumnName(10))
S
smagicyun 已提交
1703 1704 1705

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1706
            console.info(TAG + '************* testGetColumnName0004 end *************');
S
smagicyun 已提交
1707 1708 1709 1710 1711 1712 1713 1714 1715
        }
    })

    /**
     * @tc.name resultSet close test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0220
     * @tc.desc resultSet close test
     */
    it('testClose0001', 0, async function (done) {
L
liangzhenyu123 已提交
1716
        console.info(TAG + '************* testClose0001 start *************');
S
smagicyun 已提交
1717
        {
Y
yanglifeng 已提交
1718
            let predicates = await new dataRdb.RdbPredicates('test')
S
smagicyun 已提交
1719 1720 1721 1722 1723 1724 1725
            let resultSet = await rdbStore.query(predicates)
            resultSet.goToRow(1)
            resultSet.close()
            expect(true).assertEqual(resultSet.isClosed)

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1726
            console.info(TAG + '************* testClose0001 end *************');
S
smagicyun 已提交
1727 1728 1729 1730 1731 1732 1733 1734 1735
        }
    })

    /**
     * @tc.name resultSet close test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0221
     * @tc.desc resultSet close test
     */
    it('testClose0002', 0, async function (done) {
L
liangzhenyu123 已提交
1736
        console.info(TAG + '************* testClose0002 start *************');
S
smagicyun 已提交
1737
        {
Y
yanglifeng 已提交
1738 1739
            let predicates = await new dataRdb.RdbPredicates('test')
            predicates.equalTo('name', 'wangwu');
S
smagicyun 已提交
1740 1741 1742 1743 1744 1745
            let resultSet = await rdbStore.query(predicates)
            resultSet.close()
            expect(true).assertEqual(resultSet.isClosed)

            resultSet = null;
            done();
L
liangzhenyu123 已提交
1746
            console.info(TAG + '************* testClose0002 end *************');
S
smagicyun 已提交
1747 1748 1749
        }
    })

1
18834416147 已提交
1750 1751 1752 1753 1754 1755
    /**
     * @tc.name resultSet columnNames test
     * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0240
     * @tc.desc resultSet columnNames test
     */
     it('testcolumnNames0001', 0, async function (done) {
L
liangzhenyu123 已提交
1756
        console.info(TAG + '************* testcolumnNames0001 start *************');
1
18834416147 已提交
1757 1758 1759 1760 1761 1762 1763 1764 1765 1766
        {
            let predicates = await new dataRdb.RdbPredicates('test')
            let resultSet = await rdbStore.query(predicates)
            if (COLOUNM_NAMES == resultSet.columnNames){
                expect(1).assertEqual(0);
            }else{
                expect(0).assertEqual(0);
            }
            resultSet = null;
            done();
L
liangzhenyu123 已提交
1767
            console.info(TAG + '************* testcolumnNames0001 end *************');
1
18834416147 已提交
1768 1769 1770
        }
    })
    
L
liangzhenyu123 已提交
1771
    console.info(TAG + '*************Unit Test End*************');
1
18834416147 已提交
1772
})