SQLite Forum

Существует ли справочник синтетических ошибок?Где искать исправления error near?
Login

Существует ли справочник синтетических ошибок?Где искать исправления error near?

(1.1) By Alvina on 2021-11-27 05:04:04 edited from 1.0 [link] [source]

sqlite> c:/sqlite/my1st.sql; Error: near "c": syntax error sqlite>

(2) By Larry Brasfield (larrybr) on 2021-11-26 21:12:17 in reply to 1.0 [link] [source]

If you want help with that error, you will need to provide the sqlite3 shell input which induced the error.

And please edit the thread title so that it might prove useful someday to a larger set of readers.

(3) By Harald Hanche-Olsen (hanche) on 2021-11-26 21:20:49 in reply to 2 [link] [source]

I think that is what he was showing: He tried to execute sql code from a file simply by entering the filename from the interactive prompt.

To the OP: You might try .read c:/sqlite/my1st.sql instead.

(4) By John Dennis (jdennis) on 2021-11-27 07:51:53 in reply to 3 [link] [source]

The google "detect language" translation suggests "Is there a manual for synthetic errors? Where to look for fixes". Convert synthetic to syntax and it makes sense. But seeing the query which was being executed would be useful.

(5) By anonymous on 2021-11-27 11:25:07 in reply to 1.1 [source]

SQLite's syntax error reporting is, unfortunately, a bit limited: when an error is detected, it reports the current token, but cannot tell you much more than that. In this case, the error is literally near the "c":

sqlite> c:/sqlite/my1st.sql
        ^--- the error is here

As others helpfully pointed out, if you want to run SQL commands from a file, use the .read command. Typing the file name into the SQLite command line is a syntax error.

To help us help you more effectively, consider consulting this guide. I'm not aware of any Russian-speaking SQLite user communities, but if you need to ask questions in Russian, check out RSDN or Russian StackOverflow.


К сожалению, когда SQLite находит синтаксическую ошибку, он может только показать токен, рядом с которым ошибка находится, но не сообщает никаких подробностей (например, в какой части, возможно, большого запроса располагался этот токен). В данном случае, ошибка находится буквально рядом с "c":

sqlite> c:/sqlite/my1st.sql
        ^--- вот здесь

Как уже написали другие люди в этой теме, для выполнения SQL-команд из файла необходимо использовать команду .read. Впечатывать путь к файлу в командную строку SQLite просто так - это ошибка, так делать нельзя.

Пожалуйста, ознакомьтесь с этой инструкцией, чтобы задавать вопросы более эффективно. К сожалению, я не знаю русскоязычных форумов по SQLite, но можно попробовать RSDN или StackOverflow на русском.