Skip to content
Snippets Groups Projects
Commit 59c57b7e authored by Léo Banno-Cloutier's avatar Léo Banno-Cloutier
Browse files

datastore: fix a few queries

Change-Id: I81247cffdd81fbe407a09008817c4940b5cd97c4
parent 01889b04
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,11 @@ public class ContactDao extends AbstractDao<Contact> {
}
public boolean storeContactList(List<Contact> contactList) {
if (contactList.isEmpty()) {
log.error("Cannot store empty contact list");
return false;
}
SQLConnection connection = DataStore.connectionPool.getConnection();
try {
String delete = "DELETE FROM contacts WHERE owner = ?";
......
......@@ -50,8 +50,7 @@ public class SystemDao extends AbstractDao<SystemAccount> {
@Override
public boolean storeObject(SystemAccount object) {
String query =
"INSERT INTO system " + "(entity,certificate,privatekey)" + "VALUES " + "(?, ?, ?)";
String query = "INSERT INTO system (entity,certificate,privatekey) VALUES (?, ?, ?)";
return executeInsert(query, object);
}
}
......@@ -78,7 +78,7 @@ public class UserProfileDao extends AbstractDao<UserProfile> {
}
public List<UserProfile> searchFullName(String name) {
String query = "SELECT * FROM local_directory WHERE firstName LIKE ? OR lastName ?";
String query = "SELECT * FROM local_directory WHERE firstName LIKE ? OR lastName LIKE ?";
name = name + "%";
ResultSet rs = executeQuery(query, List.of(name, name));
return getObjectsFromResultSet(rs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment