Examples of Postgres9StatementAndResultSet


Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return indexDao.count((Postgres9Connection) con, "receiverId", receiverId);
    }

    @Override
    public List<UserReceivedMessage> findByReceiverId(PartakeConnection con, String receiverId, int offset, int limit) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE receiverId = ? ORDER BY createdAt DESC OFFSET ? LIMIT ?",
                new Object[] { receiverId, offset, limit });

        try {
            Postgres9IdMapper<UserReceivedMessage> idMapper = new Postgres9IdMapper<UserReceivedMessage>((Postgres9Connection) con, mapper, entityDao);
            DataIterator<UserReceivedMessage> it = new Postgres9DataIterator<UserReceivedMessage>(idMapper, psars);
            return DAOUtil.convertToList(it);
        } finally {
            psars.close();
        }
    }
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return entityDao.getFreshId((Postgres9Connection) con);
    }

    @Override
    public DataIterator<EventComment> getCommentsByEvent(PartakeConnection con, String eventId) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE eventId = ? ORDER BY createdAt ASC",
                new Object[] { eventId });

        Postgres9IdMapper<EventComment> idMapper = new Postgres9IdMapper<EventComment>((Postgres9Connection) con, mapper, entityDao);
        return new Postgres9DataIterator<EventComment>(idMapper, psars);
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

    // TODO: Why not DataIterator?
    // TODO: Why not List<OpenIdLinkage>?
    @Override
    public List<UserOpenIDLink> findByUserId(PartakeConnection con, String userId) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE userId = ?",
                new Object[] { userId });

        Postgres9IdMapper<UserOpenIDLink> idMapper = new Postgres9IdMapper<UserOpenIDLink>((Postgres9Connection) con, mapper, entityDao);
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return new MapperDataIterator<Postgres9Entity, UserThumbnail>(mapper, entityDao.getIterator((Postgres9Connection) con));
    }

    @Override
    public List<String> findIdsByUserId(PartakeConnection con, String userId, int offset, int limit) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + USER_INDEX_TABLE_NAME + " WHERE userId = ?  ORDER BY createdAt DESC OFFSET ? LIMIT ?",
                new Object[] { userId, offset, limit });

        ArrayList<String> result = new ArrayList<String>();
        try {
            ResultSet rs = psars.getResultSet();
            while (rs.next())
                result.add(rs.getString(1));
        } catch (SQLException e) {
            throw new DAOException(e);
        } finally {
            psars.close();
        }

        return result;
    }
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return entityDao.getFreshId((Postgres9Connection) con);
    }

    @Override
    public List<EventMessage> findByEventId(PartakeConnection con, String eventId, int offset, int limit) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE eventId = ? ORDER BY createdAt DESC OFFSET ? LIMIT ?",
                new Object[] { eventId, offset, limit });

        Postgres9IdMapper<EventMessage> idMapper = new Postgres9IdMapper<EventMessage>((Postgres9Connection) con, mapper, entityDao);
        return DAOUtil.convertToList(new Postgres9DataIterator<EventMessage>(idMapper, psars));
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return UUID.fromString(entityDao.getFreshId((Postgres9Connection) con));
    }

    @Override
    public List<EventTicket> findEventTicketsByEventId(PartakeConnection con, String eventId) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE eventId = ? ORDER BY (seq, id) ASC",
                new Object[] { eventId });

        Postgres9IdMapper<EventTicket> idMapper = new Postgres9IdMapper<EventTicket>((Postgres9Connection) con, mapper, entityDao);
        return DAOUtil.convertToList(new Postgres9DataIterator<EventTicket>(idMapper, psars));
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return DAOUtil.convertToList(new Postgres9DataIterator<EventTicket>(idMapper, psars));
    }

    @Override
    public void removeByEventId(PartakeConnection con, String eventId) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE eventId = ? ORDER BY (seq, id) ASC",
                new Object[] { eventId });

        try {
            ResultSet rs = psars.getResultSet();
            while (rs.next()) {
                String id = rs.getString("id");
                if (id == null)
                    continue;

                remove(con, UUID.fromString(id));
            }
        } catch (SQLException e) {
            throw new DAOException(e);
        } finally {
            psars.close();
        }
    }
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        return mapper.map(entityDao.find((Postgres9Connection) con, id));
    }

    @Override
    public List<UserNotification> findByUserId(PartakeConnection con, String userId, int offset, int limit) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE userId = ? OFFSET ? LIMIT ?",
                new Object[] { userId, offset, limit });

        Postgres9IdMapper<UserNotification> idMapper = new Postgres9IdMapper<UserNotification>((Postgres9Connection) con, mapper, entityDao);
        DataIterator<UserNotification> it = new Postgres9DataIterator<UserNotification>(idMapper, psars);
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

    }

    @Override
    public List<UserTwitterLink> findByScreenNamePrefix(PartakeConnection con, String screenNamePrefix, int limit) throws DAOException {
        // What happends if '%' is included in the screenNamePrefix?
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE screenName LIKE ? LIMIT ?",
                new Object[] { escapeForLike(screenNamePrefix) + "%", limit });

        try {
            Postgres9IdMapper<UserTwitterLink> idMapper = new Postgres9IdMapper<UserTwitterLink>((Postgres9Connection) con, mapper, entityDao);
            DataIterator<UserTwitterLink> it = new Postgres9DataIterator<UserTwitterLink>(idMapper, psars);
            return DAOUtil.convertToList(it);
        } finally {
            psars.close();
        }


    }
View Full Code Here

Examples of in.partake.model.dao.postgres9.Postgres9StatementAndResultSet

        remove(con, id);
    }

    @Override
    public List<UserTicket> findByTicketId(PartakeConnection con, UUID eventTicketId, int offset, int limit) throws DAOException {
        Postgres9StatementAndResultSet psars = indexDao.select((Postgres9Connection) con,
                "SELECT id FROM " + INDEX_TABLE_NAME + " WHERE ticketId = ? ORDER BY appliedAt DESC OFFSET ? LIMIT ?",
                new Object[] { eventTicketId.toString(), offset, limit });

        Postgres9IdMapper<UserTicket> idMapper = new Postgres9IdMapper<UserTicket>((Postgres9Connection) con, mapper, entityDao);
        DataIterator<UserTicket> it = new Postgres9DataIterator<UserTicket>(idMapper, psars);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.