@Override protected PreparedInsertCache initialValue() { return new PreparedInsertCache(openStatementTracking); } };
ISQLitePreparedStatement getPreparedInsert(SquidDatabase db, Table table, TableStatement.ConflictAlgorithm conflictAlgorithm) { Class<? extends TableModel> modelClass = table.getModelClass(); ISQLitePreparedStatement[] preparedStatements = preparedStatementCache.get(modelClass); if (preparedStatements == null) { preparedStatements = new ISQLitePreparedStatement[TableStatement.ConflictAlgorithm.values().length]; preparedStatementCache.put(modelClass, preparedStatements); } if (conflictAlgorithm == null) { conflictAlgorithm = TableStatement.ConflictAlgorithm.NONE; } ISQLitePreparedStatement toReturn = preparedStatements[conflictAlgorithm.ordinal()]; if (toReturn == null) { toReturn = prepareInsert(db, table, conflictAlgorithm); preparedStatements[conflictAlgorithm.ordinal()] = toReturn; } return toReturn; }
PreparedInsertCache insertCache = preparedInsertCache.get(); ISQLitePreparedStatement preparedStatement = insertCache.getPreparedInsert(this, table, conflictAlgorithm); item.bindValuesForInsert(table, preparedStatement); newRow = preparedStatement.executeInsert();
PreparedInsertCache insertCache = preparedInsertCache.get(); ISQLitePreparedStatement preparedStatement = insertCache.getPreparedInsert(this, table, conflictAlgorithm); item.bindValuesForInsert(table, preparedStatement); newRow = preparedStatement.executeInsert();
@Override protected PreparedInsertCache initialValue() { return new PreparedInsertCache(openStatementTracking); } };
ISQLitePreparedStatement getPreparedInsert(SquidDatabase db, Table table, TableStatement.ConflictAlgorithm conflictAlgorithm) { Class<? extends TableModel> modelClass = table.getModelClass(); ISQLitePreparedStatement[] preparedStatements = preparedStatementCache.get(modelClass); if (preparedStatements == null) { preparedStatements = new ISQLitePreparedStatement[TableStatement.ConflictAlgorithm.values().length]; preparedStatementCache.put(modelClass, preparedStatements); } if (conflictAlgorithm == null) { conflictAlgorithm = TableStatement.ConflictAlgorithm.NONE; } ISQLitePreparedStatement toReturn = preparedStatements[conflictAlgorithm.ordinal()]; if (toReturn == null) { toReturn = prepareInsert(db, table, conflictAlgorithm); preparedStatements[conflictAlgorithm.ordinal()] = toReturn; } return toReturn; }