You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MySQL Workbench, it's common to use `DELIMITER $$` (or similar) when defining stored procedures or using other compound statements that include an embedded semicolon (`;`).
14
+
15
+
This is not required by MySQL Server, but is a workaround for [limitations in the mysql client](https://dev.mysql.com/doc/refman/8.0/en/stored-programs-defining.html):
16
+
17
+
> By default, mysql itself recognizes the semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server.
18
+
19
+
This limitation does not exist in MySqlConnector, so using `DELIMITER` is unnecessary and it must be removed (to avoid sending invalid SQL to the server).
20
+
21
+
## Incorrect Code
22
+
23
+
```csharp
24
+
usingvarcommand=connection.CreateCommand();
25
+
command.CommandText=@"
26
+
DELIMITER $$
27
+
CREATE FUNCTION echo(
28
+
name VARCHAR(63)
29
+
) RETURNS VARCHAR(63)
30
+
BEGIN
31
+
RETURN name;
32
+
END
33
+
$$";
34
+
command.ExecuteNonQuery();
35
+
```
36
+
37
+
## Fixed Code
38
+
39
+
To fix the problem, remove the `DELIMITER` declaration and any trailing instances of the delimiter:
thrownewMySqlException(MySqlErrorCode.DelimiterNotSupported,"'DELIMITER' should not be used with MySqlConnector. See https://fl.vu/mysql-delimiter",exception);
940
+
}
941
+
}
942
+
921
943
internalvoidHandleTimeout()
922
944
{
923
945
if(OwningConnectionis not null&&OwningConnection.TryGetTarget(outvarconnection))
0 commit comments