Skip to content

Commit 25dc9ea

Browse files
committed
adapted to IoTDBDataReader
1 parent 9a4260c commit 25dc9ea

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Apache.IoTDB.Data/IoTDBDataReader.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class IoTDBDataReader : DbDataReader
4545
private bool _closeConnection;
4646

4747
private int _fieldCount;
48-
48+
4949
RowRecord rowdata = null;
5050

5151

@@ -56,6 +56,9 @@ internal IoTDBDataReader(IoTDBCommand IoTDBCommand, SessionDataSet dataSet, bool
5656
_command = IoTDBCommand;
5757
_closeConnection = closeConnection;
5858
_fieldCount = dataSet.GetColumnNames().Count;
59+
_hasRows = dataSet.RowCount() > 0;
60+
_recordsAffected = dataSet.RowCount();
61+
5962
_closed = _closeConnection;
6063
_metas = dataSet.GetColumnNames();
6164
_dataSet = dataSet;
@@ -134,7 +137,7 @@ public override bool Read()
134137
{
135138
throw new InvalidOperationException($"DataReaderClosed{nameof(Read)}");
136139
}
137-
if (_dataSet.HasNext())
140+
if (_dataSet.Next())
138141
{
139142
rowdata = _dataSet.GetRow();
140143
}
@@ -452,7 +455,7 @@ public override int GetValues(object[] values)
452455
/// <returns>A System.Data.DataTable that describes the column metadata.</returns>
453456
public override DataTable GetSchemaTable()
454457
{
455-
if (_dataSet.HasNext())
458+
if (_dataSet.Next())
456459
{
457460
rowdata = _dataSet.GetRow();
458461
}

src/Apache.IoTDB/DataStructure/RpcDataSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class RpcDataSet : System.IDisposable
3838
private TsBlock _curTsBlock;
3939
private int _queryResultSize;
4040
private int _queryResultIndex;
41-
private int _tsBlockSize;
41+
public int _tsBlockSize;
4242
private int _tsBlockIndex;
4343
private TimeZoneInfo _zoneId;
4444
private int _timeFactor;

src/Apache.IoTDB/DataStructure/SessionDataSet.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public bool HasNext()
120120
public IReadOnlyList<string> GetColumnTypes() => _rpcDataSet._columnTypeList;
121121

122122
public RowRecord GetRow() => _rpcDataSet.GetRow();
123+
public int RowCount() => _rpcDataSet._tsBlockSize;
123124

124125
public void ShowTableNames()
125126
{

0 commit comments

Comments
 (0)