- if (last_account_name == null) continue;
-
- m = value_re.matcher(line);
- while (m.find()) {
- String value = m.group(1);
- String currency = m.group(2);
- if(currency == null) currency="";
- value = value.replace(',', '.');
- Log.d("db", "curr="+currency+", value="+value);
- db.execSQL("insert or replace into account_values(account, currency, value, keep) values(?, ?, ?, 1);",
- new Object[]{last_account_name, currency, Float.valueOf(value)});
+ if (last_account_name != null) {
+ m = value_re.matcher(line);
+ boolean match_found = false;
+ while (m.find()) {
+ match_found = true;
+ String value = m.group(1);
+ String currency = m.group(2);
+ if (currency == null) currency = "";
+ value = value.replace(',', '.');
+ Log.d("db", "curr=" + currency + ", value=" + value);
+ db.execSQL("insert or replace into account_values(account, currency, value, keep) values(?, ?, ?, 1);",
+ new Object[]{last_account_name, currency, Float.valueOf(value)});
+ }
+
+ if (match_found) continue;
+ }
+
+ m = descriptions_line_re.matcher(line);
+ if (m.find()) {
+ db.execSQL("update description_history set keep=0;");
+ m = description_items_re.matcher(line);
+ while(m.find()) {
+ String description = m.group(1);
+ if (description.isEmpty()) continue;
+
+ Log.d("db", String.format("Stored description: %s", description));
+ db.execSQL("insert or replace into description_history(description, keep) values(?, 1);", new Object[]{description});
+ }