I can certainly continue on, but it's really just diminishing returns when really the answer is to just fix up the edge cases by implementing it exactly how MySQL implements it. I was thinking nested delimeters, but was curious if there was SP, trigger or something that would would need to be implemented in some odd way. I haven't seen that, but not sure if that's even a thing. That's probably why the best answer is just to implement it exactly how the MySQL client is doing it : Then we don't have to guess, haha.
The protocol was just implemented from the MySQL protocol documentation, but I'm not familiar with any documentation around the delimiter and how it works, exactly. It presents maintenance and compatibility issues. There is a solution already. It was mainly a proof of concept that works well for my use case. Maybe others will find it useful. Unfortunately for the OP, mysql doesn't have this feature.
He needs it because he wants to execute. In most cases you can just run the queries one at a time with multipleStatements set to false. I have handled all edge cases pointed out by dougwilson. It is not a full MySQL language parser but it should be able to complete the work on most of our daily usage scenario.
Anyone who are looking for a solution may give a try! Any news on this? If the delimiter lines are removed, somehow it works fine even though it does not work via a SQL client.
So, for example:. Skip to content. INTO OUTFILE normally is unsuitable because there is no way to write a path to the file relative to the server host file system, unless the location of the file on the remote host can be accessed using a network-mapped path on the server host file system. If no such clause is present, values are dumped using the binary character set. In effect, there is no character set conversion. If a result set contains columns in several character sets, so is the output data file, and it may not be possible to reload the file correctly.
The resulting file need not conform to SQL syntax, so nothing else need be escaped. It is probably not a good idea to specify an empty escape character, particularly if field values in your data contain any of the characters in the list just given.
An example of such a statement is shown here:. An example is shown here:. You must use a table alias; column aliases are also supported, and can optionally be used to write values only from desired columns. Here is an example that produces a file in the comma-separated values CSV format used by many programs:. This is useful for selecting a BLOB value and storing it in a file. If the table contains more than one row, you must also use LIMIT 1 to limit the output to a single row.
See Section You should never run mysqld as root for this and other reasons. As of MySQL 8. Prior to MySQL 8. INTO statements that occur as part of events executed by the Event Scheduler, diagnostics messages not only errors, but also warnings are written to the error log, and, on Windows, to the application event log. For additional information, see Section For more information, see the descriptions of these system variables.
Data Definition Statements. Atomic Data Definition Statement Support. LIKE Statement. INTO OUTFILE normally is unsuitable because there is no way to write a path to the file relative to the server host file system, unless the location of the file on the remote host can be accessed using a network-mapped path on the server host file system.
If no such clause is present, values are dumped using the binary character set. In effect, there is no character set conversion. If a result set contains columns in several character sets, so does the output data file and it may not be possible to reload the file correctly. The resulting file need not conform to SQL syntax, so nothing else need be escaped. It is probably not a good idea to specify an empty escape character, particularly if field values in your data contain any of the characters in the list just given.
Here is an example that produces a file in the comma-separated values CSV format used by many programs:. This is useful for selecting a BLOB value and storing it in a file.
0コメント