Code example for SQLiteStatement

Methods: bindNull, clearBindings, executeInsert

0
            throws SQLException { 
        Account account = (Account) entity;
 
        SQLiteStatement stmt = database.compileStatement(getInsertSql());
 
        stmt.clearBindings();
 
        stmt.bindNull(1);
        safeBindInt(stmt, 2, account.getAccountType());
        safeBindInt(stmt, 3, account.getAccountParentType());
        safeBindInt(stmt, 4, account.getStatus());
        safeBindString(stmt, 5, account.getAccountName());
        safeBindString(stmt, 6, account.getAccountNumber());
        safeBindString(stmt, 7, account.getAccountNotes());
        safeBindLong(stmt, 8, account.getStartDate());
        safeBindBigDecimal(stmt, 9, account.getStartingBalance());
        safeBindBigDecimal(stmt, 10, account.getCurrentBalance());
        safeBindLong(stmt, 11, account.getCategoryId());
 
        Long id = stmt.executeInsert();
 
        account.setAccountId(id);
 
        return id;
    }