When I try to insert short portions of my data by copying over the relevant SQL statements into a String
variable containing the SQL statements that SQLiteOpenHelper
must run, everything works fine. Here is my query:
String POPULATE_TABLE =
"INSERT INTO `en_sahih` (`indexID`, `chapterNo`, `verseNo`, `verseText`) VALUES\n" +
"(1, 1, 1, 'This is verse 1'),\n" +
"(2, 1, 2, 'This is verse 2'),\n" +
"(3, 1, 3, 'This is verse 3'),\n" +
"(4, 1, 4, 'This is verse 4'),\n" +
"(5, 1, 5, 'This is verse 5'),\n" +
"(6, 1, 6, 'This is verse 6'),\n" +
"(7, 1, 7, 'This is verse 7');";
db.execSQL(POPULATE_TABLE);
But when I copy over the entire 6k records into the string, which is probably not the ideal way to go about this, Android studio tells me the String
is too long. How can I easily take the data that I already have in the form of SQL statements and put it into an .sql
file and execute them in the new database that I've set up in my app. Any suggestions on how to do this?