Opened 10 years ago

Closed 9 years ago

#1996 closed defect (fixed)

ReadNext method loops when using SqLite database

Reported by: zhanga Owned by:
Priority: medium Milestone: 2.3
Component: Feature Service Version: 2.1.0
Severity: trivial Keywords: ReadNext Sqlite
Cc: External ID: 1456425


The code below works fine using Oracle Database but it loops using SQLite database. .... MgReader? sqlReader = _featureService.ExecuteSqlQuery?(_resourceIdentifier, strSQL);

int cpt = 0; while (sqlReader.ReadNext?()) { cpt++; } ....

Attachments (2)

ticket1996.patch (4.2 KB) - added by zhanga 10 years ago.
DE22116.patch (2.1 KB) - added by christinebao 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by zhanga

Attachment: ticket1996.patch added

comment:1 Changed 10 years ago by zhanga

When call ReadNext?() in from web-tier side, it actually doesn’t send a ReadNext?() operation request to Map Server. Instead, it sends a GetRows? operation request to get a lot of records, then cache the records. If the GetRows? operation returns an empty collection, then we think we have reached the end of the reader. But there is no specification in the FDO API about what we should do in case an application calls again ReadNext? after reader is depleted. In SQLite the sqlite engine resets the statement automatically and start it over again. Therefore, the GetRows? method will never return an empty collection for Sqlite database. Then the ReadNext?() method in the web app would be an endless loop. This submission fixes ServerDataReader? and ServerSqlDataReader? to make IM Server runs correctly when using SQLite database.

MG Open Source: Server/src/Services/Feature/ServerDataReader.cpp Server/src/Services/Feature/ServerDataReader.h Server/src/Services/Feature/ServerSqlDataReader.cpp Server/src/Services/Feature/ServerSqlDataReader.h

comment:2 Changed 9 years ago by jng

Resolution: fixed
Status: newclosed

Changed 7 years ago by christinebao

Attachment: DE22116.patch added
Note: See TracTickets for help on using tickets.