Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,17 @@ private HostAddress newHostAddress(HostAddress.HostAddressType type, String addr

long objId = db.addObject(parentObjId, objTypeId, connection);

String hostAddressInsertSQL = "INSERT INTO tsk_host_addresses(id, address_type, address) VALUES (?, ?, ?)"; // NON-NLS
/*
* A conflict clause is used improve performance related to
* exception handling in the database.
*/
String hostAddressInsertSQL;
if (db.getDatabaseType() == TskData.DbType.POSTGRESQL) {
hostAddressInsertSQL = "INSERT INTO tsk_host_addresses(id, address_type, address) VALUES (?, ?, ?) ON CONFLICT DO NOTHING"; //NON-NLS
} else {
hostAddressInsertSQL = "INSERT OR IGNORE INTO tsk_host_addresses(id, address_type, address) VALUES (?, ?, ?)"; //NON-NLS
}

PreparedStatement preparedStatement = connection.getPreparedStatement(hostAddressInsertSQL, Statement.RETURN_GENERATED_KEYS);

preparedStatement.clearParameters();
Expand Down