Skip to content

Commit

Permalink
Microsoft.Data.Sqlite: Default CommandText to an empty string
Browse files Browse the repository at this point in the history
Fixes #19162
  • Loading branch information
bricelam committed Mar 3, 2020
1 parent fcc17e8 commit 350e26c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SqliteCommand : DbCommand

private readonly List<sqlite3_stmt> _preparedStatements = new List<sqlite3_stmt>();
private SqliteConnection _connection;
private string _commandText;
private string _commandText = string.Empty;
private bool _prepared;

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions test/Microsoft.Data.Sqlite.Tests/SqliteCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public void Ctor_sets_values()
}
}

[Fact]
public void CommandText_defaults_to_empty()
{
var command = new SqliteCommand();

Assert.Empty(command.CommandText);
}

[Fact]
public void CommandText_throws_when_set_when_open_reader()
{
Expand Down

0 comments on commit 350e26c

Please sign in to comment.