I’m Dalsam from Korean. 24old
I’m using Eclipse java tools, and develop android.
I have question.
This query is successed.
SQLite>.mode list
SQLite>.separator ","
SQLite>.output WordDB.csv
SQLite>selete * from WordDB;
SQLite>.exit
As result, the file ‘WordDB.csv’ will be created. In Eclipse, but this command does not run.
class WordDBManager extends SQLiteOpenHelper
{
...
}
WordDBManager mgr = new WordDBManager();
String sql = ".mode list";
mgr.getWritableDatabase().execSQL(sql);
sql = ".separator \",\"";
mgr.getWritableDatabase().execSQL(sql);
sql = ".output WordDB.csv";
mgr.getWritableDatabase().execSQL(sql);
sql = selete * from WordDB;
mgr.getWritableDatabase().execSQL(sql);
sql = ".exit";
<Error message>
02-23 05:16:40.095: I/Database(27383): sqlite returned: error code = 1, msg = near ".":
syntax error
02-23 05:16:40.095: E/Database(27383): Failure 1 (near ".": syntax error) on 0x30d3a0 when
preparing '.mode list'.
What should I do?
“.” (dot) commands are not part of the SQL language but control commands for the sqlite interpreter, that’s why you are receiving syntax errors trying to interpret them as SQL.
You can find the available SQL syntax at http://www.sqlite.org/syntaxdiagrams.html.