Skip to content

Commit b0436e6

Browse files
committed
Throw from Prepare if CommandText isn't set.
1 parent 2f8b671 commit b0436e6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/MySqlConnector/MySql.Data.MySqlClient/MySqlCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public override void Prepare()
7676
throw new InvalidOperationException("Connection property must be non-null.");
7777
if (Connection.State != ConnectionState.Open)
7878
throw new InvalidOperationException("Connection must be Open; current state is {0}".FormatInvariant(Connection.State));
79+
if (string.IsNullOrWhiteSpace(CommandText))
80+
throw new InvalidOperationException("CommandText must be specified");
7981

8082
// NOTE: Prepared statements in MySQL are not currently supported.
8183
// 1) Only a subset of statements are actually preparable by the server: http://dev.mysql.com/worklog/task/?id=2871

0 commit comments

Comments
 (0)