diff options
author | Ippolitov A. Igor | 2015-10-27 10:46:13 +0300 |
---|---|---|
committer | Ippolitov A. Igor | 2015-10-27 10:46:13 +0300 |
commit | 9a8539699c88f5d4bf40a65501038cefddc014be (patch) | |
tree | 090a0e99bbfacb06c05524b1c683abc6cf39722b /src/com/juick | |
parent | b5df0e1c2664a8a1a0f9042745dd608773fedce3 (diff) |
insert null instead of '' for tags
Diffstat (limited to 'src/com/juick')
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index 8bef9018..17e9f832 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -81,7 +81,11 @@ public class MessagesQueries { try { stmt = sql.prepareStatement("INSERT INTO messages_txt(message_id,tags,txt) VALUES (?,?,?)"); stmt.setInt(1, mid); - stmt.setString(2, tagsNames); + if (tagsNames == "") { + stmt.setNull(2, Types.VARCHAR); + } else { + stmt.setString(2, tagsNames); + } stmt.setString(3, txt); stmt.executeUpdate(); } catch (SQLException e) { @@ -733,6 +737,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { + if (before > 0) { stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE MATCH(?) AND id<? ORDER BY id DESC LIMIT 25"); stmt.setString(1, search); |