Fix spurious line wrapping.

This commit is contained in:
akwizgran
2019-04-17 17:20:08 +01:00
parent 3aadcc17dd
commit e9a3685bfd

View File

@@ -2630,9 +2630,8 @@ abstract class JdbcDatabase implements Database<Connection> {
g.getBytes(), meta, "groupMetadata", "groupId"); g.getBytes(), meta, "groupMetadata", "groupId");
if (added.isEmpty()) return; if (added.isEmpty()) return;
// Insert any keys that don't already exist // Insert any keys that don't already exist
String sql = String sql = "INSERT INTO groupMetadata (groupId, metaKey, value)"
"INSERT INTO groupMetadata (groupId, metaKey, value)" + " VALUES (?, ?, ?)";
+ " VALUES (?, ?, ?)";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setBytes(1, g.getBytes()); ps.setBytes(1, g.getBytes());
for (Entry<String, byte[]> e : added.entrySet()) { for (Entry<String, byte[]> e : added.entrySet()) {
@@ -2780,8 +2779,7 @@ abstract class JdbcDatabase implements Database<Connection> {
ps.addBatch(); ps.addBatch();
} }
int[] batchAffected = ps.executeBatch(); int[] batchAffected = ps.executeBatch();
if (batchAffected.length != s.size()) if (batchAffected.length != s.size()) throw new DbStateException();
throw new DbStateException();
for (int rows : batchAffected) { for (int rows : batchAffected) {
if (rows < 0) throw new DbStateException(); if (rows < 0) throw new DbStateException();
if (rows > 1) throw new DbStateException(); if (rows > 1) throw new DbStateException();
@@ -2802,8 +2800,7 @@ abstract class JdbcDatabase implements Database<Connection> {
updateIndex++; updateIndex++;
} }
batchAffected = ps.executeBatch(); batchAffected = ps.executeBatch();
if (batchAffected.length != inserted) if (batchAffected.length != inserted) throw new DbStateException();
throw new DbStateException();
for (int rows : batchAffected) for (int rows : batchAffected)
if (rows != 1) throw new DbStateException(); if (rows != 1) throw new DbStateException();
ps.close(); ps.close();
@@ -2904,8 +2901,7 @@ abstract class JdbcDatabase implements Database<Connection> {
} }
@Override @Override
public void removeGroupVisibility(Connection txn, ContactId c, GroupId public void removeGroupVisibility(Connection txn, ContactId c, GroupId g)
g)
throws DbException { throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
@@ -2971,8 +2967,7 @@ abstract class JdbcDatabase implements Database<Connection> {
} }
@Override @Override
public void removeMessage(Connection txn, MessageId m) throws public void removeMessage(Connection txn, MessageId m) throws DbException {
DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
String sql = "DELETE FROM messages WHERE messageId = ?"; String sql = "DELETE FROM messages WHERE messageId = ?";
@@ -3111,8 +3106,7 @@ abstract class JdbcDatabase implements Database<Connection> {
throws DbException { throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
String sql = String sql = "UPDATE contacts SET verified = ? WHERE contactId = ?";
"UPDATE contacts SET verified = ? WHERE contactId = ?";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setBoolean(1, true); ps.setBoolean(1, true);
ps.setInt(2, c.getInt()); ps.setInt(2, c.getInt());
@@ -3130,8 +3124,7 @@ abstract class JdbcDatabase implements Database<Connection> {
throws DbException { throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
String sql = String sql = "UPDATE contacts SET active = ? WHERE contactId = ?";
"UPDATE contacts SET active = ? WHERE contactId = ?";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setBoolean(1, active); ps.setBoolean(1, active);
ps.setInt(2, c.getInt()); ps.setInt(2, c.getInt());
@@ -3149,8 +3142,7 @@ abstract class JdbcDatabase implements Database<Connection> {
@Nullable String alias) throws DbException { @Nullable String alias) throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
String sql = String sql = "UPDATE contacts SET alias = ? WHERE contactId = ?";
"UPDATE contacts SET alias = ? WHERE contactId = ?";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
if (alias == null) ps.setNull(1, VARCHAR); if (alias == null) ps.setNull(1, VARCHAR);
else ps.setString(1, alias); else ps.setString(1, alias);
@@ -3221,13 +3213,11 @@ abstract class JdbcDatabase implements Database<Connection> {
} }
@Override @Override
public void setMessageState(Connection txn, MessageId m, MessageState public void setMessageState(Connection txn, MessageId m, MessageState state)
state)
throws DbException { throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
String sql = String sql = "UPDATE messages SET state = ? WHERE messageId = ?";
"UPDATE messages SET state = ? WHERE messageId = ?";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setInt(1, state.getValue()); ps.setInt(1, state.getValue());
ps.setBytes(2, m.getBytes()); ps.setBytes(2, m.getBytes());
@@ -3235,8 +3225,7 @@ abstract class JdbcDatabase implements Database<Connection> {
if (affected < 0 || affected > 1) throw new DbStateException(); if (affected < 0 || affected > 1) throw new DbStateException();
ps.close(); ps.close();
// Update denormalised column in messageMetadata // Update denormalised column in messageMetadata
sql = sql = "UPDATE messageMetadata SET state = ? WHERE messageId = ?";
"UPDATE messageMetadata SET state = ? WHERE messageId = ?";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setInt(1, state.getValue()); ps.setInt(1, state.getValue());
ps.setBytes(2, m.getBytes()); ps.setBytes(2, m.getBytes());
@@ -3263,8 +3252,7 @@ abstract class JdbcDatabase implements Database<Connection> {
// Update denormalised column in messageDependencies if dependency // Update denormalised column in messageDependencies if dependency
// is present and in same group as dependent // is present and in same group as dependent
sql = "UPDATE messageDependencies SET dependencyState = ?" sql = "UPDATE messageDependencies SET dependencyState = ?"
+ + " WHERE dependencyId = ? AND dependencyState IS NOT NULL";
" WHERE dependencyId = ? AND dependencyState IS NOT NULL";
ps = txn.prepareStatement(sql); ps = txn.prepareStatement(sql);
ps.setInt(1, state.getValue()); ps.setInt(1, state.getValue());
ps.setBytes(2, m.getBytes()); ps.setBytes(2, m.getBytes());
@@ -3364,8 +3352,7 @@ abstract class JdbcDatabase implements Database<Connection> {
} }
@Override @Override
public void updateExpiryTimeAndEta(Connection txn, ContactId public void updateExpiryTimeAndEta(Connection txn, ContactId c, MessageId m,
c, MessageId m,
int maxLatency) throws DbException { int maxLatency) throws DbException {
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;