Drupal: vyhození zbytečností.
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.Group;
22 import org.sonews.storage.Storage;
25 * A specialized JDBCDatabase supporting HSQLDB.
26 * @author Christian Lins
29 public class HSQLDB extends JDBCDatabase implements Storage {
32 protected void prepareAddGroupStatement() throws SQLException {
33 this.pstmtAddGroup0 = conn.prepareStatement(
34 "INSERT INTO groups (name, flags, group_id) VALUES (?, ?, IDENTITY())");
38 protected void prepareCountGroupsStatement() throws SQLException {
39 this.pstmtCountGroups = conn.prepareStatement(
40 "SELECT Count(group_id) FROM groups WHERE "
41 + "BITAND(flags, " + Group.DELETED + ") = 0");
45 protected void prepareGetPostingsCountStatement() throws SQLException {
46 this.pstmtGetPostingsCount = conn.prepareStatement(
47 "SELECT Count(*) FROM postings JOIN groups "
48 + "ON groups.name = ? GROUP BY groups.name");
52 protected void prepareGetSubscriptionsStatement() throws SQLException {
53 this.pstmtGetSubscriptions = conn.prepareStatement(
54 "SELECT * FROM (SELECT feedtype, host, port, peer_id FROM peers JOIN "
55 + "peer_subscriptions ON peers.peer_id = peer_subscriptions.peer_id) "
56 + "JOIN groups ON group_id = groups.group_id WHERE feedtype = ?");