mithrandyr / SimplySql

PowerShell module for querying various SQL databases
MIT License
197 stars 31 forks source link

DELIMITER causes error! #104

Closed luceat-lux-vestra closed 1 year ago

luceat-lux-vestra commented 1 year ago

It says Invoke-SqlUpdate : "0"개의 인수가 있는 "ExecuteNonQuery"을(를) 호출하는 동안 예외가 발생했습니다. "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER ;;

Sorry for the Korean text in the sentence, I'm currently working on a remote machine that is not mine. I guess it would be An exception occurred while calling "ExecuteNonQuery" with "0" arguments.

I tried to automate my job using SimplySql,
I'm using MariaDB 10.6.11, and dumps my database using mysqldump, which is generates DELIMITER thing, and restore them to another machine using SqmplySql Invoke-SqlUpdate.

I can solve this problem by doing hand work, deleting the delimiter's starting point and the delimiter's endpoint.

It's acceptable but..., hopefully, without hand work, it will give me more pleasure.

mithrandyr commented 1 year ago

@luceat-lux-vestra -- the Invoke-SqlUpdate expects that the SQL Statement and you are sending is properly formatted. This may be related to a variety of providers that do specific things that are not true SQL, but rather depend on their tooling. For Instance, in MS Sql Server -- if you are using SSMS, you can use "GO" to separate batches of statements and even use "GO ##" where ## is a number that will cause the preceding statements to be executed that many times. However, these are functions of the tooling and not native to the database engine itself (for instance. System.Data.SqlClient does not support "GO").

So it would be helpful to determine, if this case is like that. Often tooling that dumps a database is doesn't create pure SQL statements that can be executed without using that specific tool. If you can reproduce the issue in english, then I can see if there is a gap in the implementation of the MySQL provider or not -- thanks.