I sowed these queries:Queries are on the same line.
INSERT INTO data_location ( `latitude`, `updated`, `id`, `longitude`, `created`)
VALUES( '213.2000000', '2014-08-25 11:07:42+00:00', '1', '321.0000000',
'2014-08-25 11:07:42+00:00');
INSERT INTO data_location ( `latitude`, `updated`, `id`, `longitude`, `created`)
VALUES( '42.7191000', '2014-09-17 12:53:49+00:00', '2', '23.0834000',
'2014-09-17 12:53:49+00:00');
INSERT INTO data_news (`id`, `title`, `date`, `short_content`, `content`,
`created`, `updated`)
VALUES(10, 'fdsafsda.', 'fdsafafa>', '2014-09-26 08:10:55', '2014-09-26 08:10:55');
INSERT INTO data_news (`id`, `title`, `date`, `short_content`, `content`,
`created`, `updated`)
VALUES(11, 'fdsafdsafd „THE THROWAWAYS”', '2014-09-26 11:22:00',
'fdsafdsafdsafda(dsa);', '2014-09-26 09:05:09', '2014-09-26 09:05:09');
I want to separate them. At this stage, use the following method to divide them:
String[] parts = sql.split("(?<=\\);)");
db.beginTransaction();
for (String entry : parts) {
SQLiteStatement stmt = db.compileStatement(entry);
stmt.execute();
stmt.clearBindings();
}
db.setTransactionSuccessful();
db.endTransaction();
The problem is that in the last query data has the following ...safda(dsa);... It is accepted and becomes invalid query. Is there a way to split smart not to receive such problems ?