Skip to content

Commit

Permalink
Correct nullability annotation for IDataRecord (#44938)
Browse files Browse the repository at this point in the history
Fixes #44886
  • Loading branch information
roji authored Nov 21, 2020
1 parent 6c80a3d commit 2f8959a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/libraries/System.Data.Common/ref/System.Data.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,9 +1259,9 @@ public partial interface IDataRecord
object this[string name] { get; }
bool GetBoolean(int i);
byte GetByte(int i);
long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length);
long GetBytes(int i, long fieldOffset, byte[]? buffer, int bufferoffset, int length);
char GetChar(int i);
long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length);
long GetChars(int i, long fieldoffset, char[]? buffer, int bufferoffset, int length);
System.Data.IDataReader GetData(int i);
string GetDataTypeName(int i);
System.DateTime GetDateTime(int i);
Expand Down Expand Up @@ -2202,9 +2202,9 @@ protected DbDataRecord() { }
public abstract object this[string name] { get; }
public abstract bool GetBoolean(int i);
public abstract byte GetByte(int i);
public abstract long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length);
public abstract long GetBytes(int i, long dataIndex, byte[]? buffer, int bufferIndex, int length);
public abstract char GetChar(int i);
public abstract long GetChars(int i, long dataIndex, char[] buffer, int bufferIndex, int length);
public abstract long GetChars(int i, long dataIndex, char[]? buffer, int bufferIndex, int length);
public System.Data.IDataReader GetData(int i) { throw null; }
public abstract string GetDataTypeName(int i);
public abstract System.DateTime GetDateTime(int i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public override byte GetByte(int i)
return ((byte)_values[i]);
}

public override long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
public override long GetBytes(int i, long dataIndex, byte[]? buffer, int bufferIndex, int length)
{
int cbytes = 0;
int ndataIndex;
Expand Down Expand Up @@ -170,7 +170,7 @@ public override long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIn

public override char GetChar(int i) => ((string)_values[i])[0];

public override long GetChars(int i, long dataIndex, char[] buffer, int bufferIndex, int length)
public override long GetChars(int i, long dataIndex, char[]? buffer, int bufferIndex, int length)
{
// if the object doesn't contain a char[] then the user will get an exception
string s = (string)_values[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ protected DbDataRecord() : base() { }

public abstract byte GetByte(int i);

public abstract long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length);
public abstract long GetBytes(int i, long dataIndex, byte[]? buffer, int bufferIndex, int length);

public abstract char GetChar(int i);

public abstract long GetChars(int i, long dataIndex, char[] buffer, int bufferIndex, int length);
public abstract long GetChars(int i, long dataIndex, char[]? buffer, int bufferIndex, int length);

public IDataReader GetData(int i) => GetDbDataReader(i);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public interface IDataRecord
int GetOrdinal(string name);
bool GetBoolean(int i);
byte GetByte(int i);
long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length);
long GetBytes(int i, long fieldOffset, byte[]? buffer, int bufferoffset, int length);
char GetChar(int i);
long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length);
long GetChars(int i, long fieldoffset, char[]? buffer, int bufferoffset, int length);
Guid GetGuid(int i);
short GetInt16(int i);
int GetInt32(int i);
Expand Down

0 comments on commit 2f8959a

Please sign in to comment.