- public Currency(MobileLedgerProfile profile, String name, Position position, boolean hasGap) {
- SQLiteDatabase db = App.getDatabase();
-
- try (Cursor c = db.rawQuery("select max(rowid) from currencies", null)) {
- c.moveToNext();
- this.id = c.getInt(0) + 1;
- }
- db.execSQL("insert into currencies(id, name, position, has_gap) values(?, ?, ?, ?)",
- new Object[]{this.id, name, position.toString(), hasGap});
-
- this.name = name;
- this.position = position;
- this.hasGap = hasGap;
- }
- public static Currency loadByName(String name) {
- MobileLedgerProfile profile = Data.getProfile();
- return profile.loadCurrencyByName(name);
- }