Getting error when pipe sql into sqlite3 utility
(1) By anonymous on 2021-04-24 09:59:08 [link] [source]
I'm getting the following error on Windows when I pipe a SQL file into the sqlite3.exe prebuilt command line utility and the SQL file contains a UTF-8 BOM (as create by Notepad.exe in Windows).
> SQLITE3.EXE test.db < cleanup.sql Error: near line 1: near "": syntax error
I believe there was a similar error reported a while ago, but that was from loading the SQL file from inside the utility which is not an option for me.
Currently I place a comment in the beginning of the file to avoid it skipping the first SQL command.
Any thoughts on how to avoid this?
(2.1) By Larry Brasfield (larrybr) on 2021-04-24 12:29:34 edited from 2.0 in reply to 1 [link] [source]
''' type cleanup.sql | sqlite3.exe '''
(3) By anonymous on 2021-04-24 13:42:27 in reply to 2.1 [link] [source]
Thanks, but this gives the exact same error.
If you just do "type file.sql" on Windows 10, the UTF-8 BOM remain visible in the output. Then sqlite3.exe will still complain about it.
This problem is sqlite3.exe not filtering the 2 UTF-8 BOM bytes in the beginning of the file.
(4) By Richard Hipp (drh) on 2021-04-24 13:48:19 in reply to 3 [link] [source]
Please rebuild using the latest SQLite source code from trunk and let us know if that clears your problem.
(5) By Larry Brasfield (larrybr) on 2021-04-24 14:41:12 in reply to 3 [source]
(6) By anonymous on 2021-04-24 16:04:21 in reply to 4 [link] [source]
After a struggle to build it, I now have a nice sqlite3.exe (with a file-icon) which no longer complains about Syntax Errors.
Thanks for the effort.