mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
6624: Incorrect SQL for inserting accounts in SQLite CentralRepo
This commit is contained in:
parent
21f10a479e
commit
a662eab22d
@ -1085,8 +1085,19 @@ abstract class RdbmsCentralRepo implements CentralRepository {
|
|||||||
// Get the account fom the accounts table
|
// Get the account fom the accounts table
|
||||||
String normalizedAccountID = CentralRepoAccount.normalizeAccountIdentifier(crAccountType, accountUniqueID);
|
String normalizedAccountID = CentralRepoAccount.normalizeAccountIdentifier(crAccountType, accountUniqueID);
|
||||||
|
|
||||||
String insertSQL = "INSERT INTO accounts (account_type_id, account_unique_identifier) "
|
// insert the account. If there is a conflict, ignore it.
|
||||||
+ "VALUES (?, ?) " + getConflictClause();
|
String insertSQL;
|
||||||
|
switch (CentralRepoDbManager.getSavedDbChoice().getDbPlatform()) {
|
||||||
|
case POSTGRESQL:
|
||||||
|
insertSQL = "INSERT INTO accounts (account_type_id, account_unique_identifier) VALUES (?, ?) " + getConflictClause(); //NON-NLS
|
||||||
|
break;
|
||||||
|
case SQLITE:
|
||||||
|
insertSQL = "INSERT OR IGNORE INTO accounts (account_type_id, account_unique_identifier) VALUES (?, ?) "; //NON-NLS
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new CentralRepoException(String.format("Cannot add account to currently selected CR database platform %s", CentralRepoDbManager.getSavedDbChoice().getDbPlatform())); //NON-NLS
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try (Connection connection = connect();
|
try (Connection connection = connect();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(insertSQL);) {
|
PreparedStatement preparedStatement = connection.prepareStatement(insertSQL);) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user