Examples of PSQLException


Examples of org.postgresql.util.PSQLException

    /** power to pow translation */
    public static String sqlpower(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("pow(");
        if (parsedArgs.size()!=2){
            throw new PSQLException(GT.tr("{0} function takes two and only two arguments.","power"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0)).append(',').append(parsedArgs.get(1));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** truncate to trunc translation */
    public static String sqltruncate(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("trunc(");
        if (parsedArgs.size()!=2){
            throw new PSQLException(GT.tr("{0} function takes two and only two arguments.","truncate"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0)).append(',').append(parsedArgs.get(1));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** char to chr translation */
    public static String sqlchar(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("chr(");
        if (parsedArgs.size()!=1){
            throw new PSQLException(GT.tr("{0} function takes one and only one argument.","char"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** insert to overlay translation */
    public static String sqlinsert(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("overlay(");
        if (parsedArgs.size()!=4){
            throw new PSQLException(GT.tr("{0} function takes four and only four argument.","insert"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0)).append(" placing ").append(parsedArgs.get(3));
        buf.append(" from ").append(parsedArgs.get(1)).append(" for ").append(parsedArgs.get(2));
        return buf.append(')').toString();
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** lcase to lower translation */
    public static String sqllcase(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("lower(");
        if (parsedArgs.size()!=1){
            throw new PSQLException(GT.tr("{0} function takes one and only one argument.","lcase"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** left to substring translation */
    public static String sqlleft(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("substring(");
        if (parsedArgs.size()!=2){
            throw new PSQLException(GT.tr("{0} function takes two and only two arguments.","left"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0)).append(" for ").append(parsedArgs.get(1));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** length translation */
    public static String sqllength(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("length(trim(trailing from ");
        if (parsedArgs.size()!=1){
            throw new PSQLException(GT.tr("{0} function takes one and only one argument.","length"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0));
        return buf.append("))").toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

            return "position("+parsedArgs.get(0)+" in "+parsedArgs.get(1)+")";
        }else if (parsedArgs.size()==3){
            String tmp = "position("+parsedArgs.get(0)+" in substring("+parsedArgs.get(1)+" from "+parsedArgs.get(2)+"))";
            return "("+parsedArgs.get(2)+"*sign("+tmp+")+"+tmp+")";
        }else{
            throw new PSQLException(GT.tr("{0} function takes two or three arguments.","locate"),
                                    PSQLState.SYNTAX_ERROR);
        }
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** ltrim translation */
    public static String sqlltrim(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("trim(leading from ");
        if (parsedArgs.size()!=1){
            throw new PSQLException(GT.tr("{0} function takes one and only one argument.","ltrim"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0));
        return buf.append(')').toString();
    }
View Full Code Here

Examples of org.postgresql.util.PSQLException

    /** right to substring translation */
    public static String sqlright(List parsedArgs) throws SQLException{
        StringBuffer buf = new StringBuffer();
        buf.append("substring(");
        if (parsedArgs.size()!=2){
            throw new PSQLException(GT.tr("{0} function takes two and only two arguments.","right"),
                                    PSQLState.SYNTAX_ERROR);
        }
        buf.append(parsedArgs.get(0)).append(" from (length(").append(parsedArgs.get(0)).append(")+1-").append(parsedArgs.get(1));
        return buf.append("))").toString();
    }
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.