From 9a8539699c88f5d4bf40a65501038cefddc014be Mon Sep 17 00:00:00 2001 From: Ippolitov A. Igor Date: Tue, 27 Oct 2015 10:46:13 +0300 Subject: insert null instead of '' for tags --- src/com/juick/server/MessagesQueries.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/com/juick/server') 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