我播種了這些查詢:查詢在同一行上。如何使用Java拆分sql查詢
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');
我想分開它們。在這個階段,用下面的方法來劃分他們:
String[] parts = sql.split("(?<=\\);)");
db.beginTransaction();
for (String entry : parts) {
SQLiteStatement stmt = db.compileStatement(entry);
stmt.execute();
stmt.clearBindings();
}
db.setTransactionSuccessful();
db.endTransaction();
的問題是,在過去的查詢數據具有以下...safda(dsa);...
它被接受,併成爲無效的查詢。有沒有辦法分裂聰明不接受這樣的問題?
我固定的報價。 – Krasimir 2014-09-30 11:58:44