- db.execSQL(line);
- }
-
- db.setTransactionSuccessful();
- }
- catch (IOException e) {
- Log.e("db", String.format("Error opening raw resource for revision %d", rev_no));
- e.printStackTrace();
- }
- finally {
- db.endTransaction();
- }
- }
- public int get_option_value(String name, int default_value) {
- String s = get_option_value(name, String.valueOf(default_value));
- try {
- return Integer.parseInt(s);
- }
- catch (Exception e) {
- return default_value;
- }
- }
-
- public long get_option_value(String name, long default_value) {
- String s = get_option_value(name, String.valueOf(default_value));
- try {
- return Long.parseLong(s);
- }
- catch (Exception e) {
- Log.d("db", "returning default long value of "+name, e);
- return default_value;
- }
- }
-
- public String get_option_value(String name, String default_value) {
- Log.d("db", "about to fetch option "+name);
- try(SQLiteDatabase db = getReadableDatabase()) {
- try (Cursor cursor = db
- .rawQuery("select value from options where name=?", new String[]{name}))
- {
- if (cursor.moveToFirst()) {
- String result = cursor.getString(0);
-
- if (result == null) result = default_value;
+ if (line.startsWith("--")) {
+ line_no++;
+ continue;
+ }
+ if (line.isEmpty()) {
+ line_no++;
+ continue;
+ }
+ if (sqlStatement == null)
+ sqlStatement = line;
+ else
+ sqlStatement = sqlStatement.concat(line);
+
+ Matcher m = continuation.matcher(line);
+ if (m.matches()) {
+ line_no++;
+ continue;
+ }