Complete XDAEMON GROUPFLAG subcommand.
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package org.sonews.storage.impl;
20 import java.sql.SQLException;
21 import org.sonews.storage.Channel;
22 import org.sonews.storage.Storage;
23 import org.sonews.storage.StorageBackendException;
26 * A specialized JDBCDatabase supporting HSQLDB.
27 * @author Christian Lins
30 public class HSQLDB extends JDBCDatabase implements Storage {
33 protected void prepareAddGroupStatement() throws SQLException {
34 this.pstmtAddGroup0 = conn.prepareStatement(
35 "INSERT INTO groups (name, flags, group_id) VALUES (?, ?, IDENTITY())");
39 protected void prepareCountGroupsStatement() throws SQLException {
40 this.pstmtCountGroups = conn.prepareStatement(
41 "SELECT Count(group_id) FROM groups WHERE "
42 + "BITAND(flags, " + Channel.DELETED + ") = 0");
46 protected void prepareGetPostingsCountStatement() throws SQLException {
47 this.pstmtGetPostingsCount = conn.prepareStatement(
48 "SELECT Count(*) FROM postings JOIN groups "
49 + "ON groups.name = ? GROUP BY groups.name");
53 protected void prepareGetSubscriptionsStatement() throws SQLException {
54 this.pstmtGetSubscriptions = conn.prepareStatement(
55 "SELECT * FROM (SELECT feedtype, host, port, peer_id FROM peers JOIN "
56 + "peer_subscriptions ON peers.peer_id = peer_subscriptions.peer_id) "
57 + "JOIN groups ON group_id = groups.group_id WHERE feedtype = ?");