Package org.postgresql.util

Examples of org.postgresql.util.PSQLException


        // Interpret results.
        if (!resultType || returnValue == null)
            return returnValue;

        if (returnValue.length != 4)
            throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", new Integer(fnId)),
                                    PSQLState.NO_DATA);

        return new Integer((returnValue[3] & 255) |
                           ((returnValue[2] & 255) << 8) |
                           ((returnValue[1] & 255) << 16) |
View Full Code Here


     */
    public int getInteger(String name, FastpathArg[] args) throws SQLException
    {
        Integer i = (Integer)fastpath(name, true, args);
        if (i == null)
            throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", name),
                                    PSQLState.NO_DATA);
        return i.intValue();
    }
View Full Code Here

        // unaffected, otherwise we could break user code.
        //
        // so, until we know we can do this (needs testing, on the TODO list)
        // for now, we throw the exception and do no lookups.
        if (id == null)
            throw new PSQLException(GT.tr("The fastpath function {0} is unknown.", name), PSQLState.UNEXPECTED_ERROR);

        return id.intValue();
    }
View Full Code Here

     */
    public synchronized void truncate(long len) throws SQLException
    {
        checkFreed();
        if (!conn.haveMinimumServerVersion("8.3"))
            throw new PSQLException(GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."), PSQLState.NOT_IMPLEMENTED);

        assertPosition(len);
        lo.truncate((int)len);
    }
View Full Code Here

    protected void assertPosition(long pos, long len) throws SQLException
    {
        checkFreed();
        if (pos < 1)
        {
            throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE);
        }
        if (pos + len - 1 > Integer.MAX_VALUE)
        {
            throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", new Integer(Integer.MAX_VALUE)), PSQLState.INVALID_PARAMETER_VALUE);
        }
    }
View Full Code Here

     * @throws SQLException if LOB has been freed.
     */
    protected void checkFreed() throws SQLException
    {
        if (lo == null)
            throw new PSQLException(GT.tr("free() was called on this LOB previously"), PSQLState.OBJECT_NOT_IN_STATE);
    }
View Full Code Here

     */
    public void setValue(String s) throws SQLException
    {
        PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ',');
        if (t.getSize() != 2)
            throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH);

        point[0] = new PGpoint(t.getToken(0));
        point[1] = new PGpoint(t.getToken(1));
    }
View Full Code Here

        return null;
    }
   
    public void setIntParameter(int index, int value) throws SQLException {
        if (index < 1 || index > paramValues.length)
            throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );

        byte[] data = new byte[4];
        data[3] = (byte)value;
        data[2] = (byte)(value >> 8);
        data[1] = (byte)(value >> 16);
View Full Code Here

        paramValues[index - 1] = value;
    }

    public void setBytea(int index, byte[] data, int offset, int length) throws SQLException {
        if (index < 1 || index > paramValues.length)
            throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );

        paramValues[index - 1] = new StreamWrapper(data, offset, length);
    }
View Full Code Here

        paramValues[index - 1] = new StreamWrapper(data, offset, length);
    }

    public void setBytea(int index, final InputStream stream, final int length) throws SQLException {
        if (index < 1 || index > paramValues.length)
            throw new PSQLException(GT.tr("The column index is out of range: {0}, number of columns: {1}.", new Object[]{new Integer(index), new Integer(paramValues.length)}), PSQLState.INVALID_PARAMETER_VALUE );

        paramValues[index - 1] = new StreamWrapper(stream, length);
    }
View Full Code Here

TOP

Related Classes of org.postgresql.util.PSQLException

Copyright © 2018 www.massapicom. 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.