Skip to content

Commit 5b970fb

Browse files
committed
Faster code.
1 parent d4b4ec7 commit 5b970fb

File tree

1 file changed

+14
-12
lines changed
  • Provider/src/FirebirdSql.Data.FirebirdClient/Client/Managed/Version13

1 file changed

+14
-12
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient/Client/Managed/Version13/GdsStatement.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,29 @@ protected override DbValue[] ReadRow()
9191
var row = new DbValue[_fields.Count];
9292
try
9393
{
94-
var nullBytes = _database.Xdr.ReadOpaque((int)Math.Ceiling(_fields.Count / 8d));
95-
var nullBits = new BitArray(nullBytes);
96-
for (var i = 0; i < _fields.Count; i++)
94+
if (_fields.Count > 0)
9795
{
98-
if (nullBits.Get(i))
96+
var nullBytes = _database.Xdr.ReadOpaque((int)Math.Ceiling(_fields.Count / 8d));
97+
var nullBits = new BitArray(nullBytes);
98+
for (var i = 0; i < _fields.Count; i++)
9999
{
100-
row[i] = new DbValue(this, _fields[i], null);
101-
}
102-
else
103-
{
104-
var value = ReadRawValue(_fields[i]);
105-
row[i] = new DbValue(this, _fields[i], value);
100+
if (nullBits.Get(i))
101+
{
102+
row[i] = new DbValue(this, _fields[i], null);
103+
}
104+
else
105+
{
106+
var value = ReadRawValue(_fields[i]);
107+
row[i] = new DbValue(this, _fields[i], value);
108+
}
106109
}
107110
}
108-
109-
return row;
110111
}
111112
catch (IOException ex)
112113
{
113114
throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
114115
}
116+
return row;
115117
}
116118

117119
#endregion

0 commit comments

Comments
 (0)