Commit 8c94ff8b authored by Lachesis Chiang's avatar Lachesis Chiang

Check "username and name and namespace" for update or insert

parent 571596f1
...@@ -53,7 +53,7 @@ public class PrivateStorage extends BasicModule implements UserEventListener { ...@@ -53,7 +53,7 @@ public class PrivateStorage extends BasicModule implements UserEventListener {
private static final Logger Log = LoggerFactory.getLogger(PrivateStorage.class); private static final Logger Log = LoggerFactory.getLogger(PrivateStorage.class);
private static final String LOAD_PRIVATE = private static final String LOAD_PRIVATE =
"SELECT privateData FROM ofPrivate WHERE name=? AND namespace=?"; "SELECT privateData FROM ofPrivate WHERE username=? AND name=? AND namespace=?";
private static final String INSERT_PRIVATE = private static final String INSERT_PRIVATE =
"INSERT INTO ofPrivate (privateData, name, username, namespace) VALUES (?,?,?,?)"; "INSERT INTO ofPrivate (privateData, name, username, namespace) VALUES (?,?,?,?)";
private static final String UPDATE_PRIVATE = private static final String UPDATE_PRIVATE =
...@@ -118,8 +118,9 @@ public class PrivateStorage extends BasicModule implements UserEventListener { ...@@ -118,8 +118,9 @@ public class PrivateStorage extends BasicModule implements UserEventListener {
data.write(writer); data.write(writer);
con = DbConnectionManager.getConnection(); con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_PRIVATE); pstmt = con.prepareStatement(LOAD_PRIVATE);
pstmt.setString(1, data.getName()); pstmt.setString(1, username);
pstmt.setString(2, data.getNamespaceURI()); pstmt.setString(2, data.getName());
pstmt.setString(3, data.getNamespaceURI());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
boolean update = false; boolean update = false;
if (rs.next()) { if (rs.next()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment