Examples of JDBCFunctionMappingMetaData


Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTLCase node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.LCASE);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0)),
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTUCase node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.UCASE);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0)),
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTLength node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.LENGTH);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0)),
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

     * Type-mapping function translation
     */
    public Object visit(ASTLocate node, Object data) {
        StringBuffer buf = (StringBuffer) data;

        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.LOCATE);
        Object[] args = new Object[3];
        args[0] = new NodeStringWrapper(node.jjtGetChild(0));
        args[1] = new NodeStringWrapper(node.jjtGetChild(1));
        if (node.jjtGetNumChildren() == 3) {
            args[2] = new NodeStringWrapper(node.jjtGetChild(2));
        } else {
            args[2] = "1";
        }

        // add the sql to the current buffer
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTAbs node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.ABS);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0)),
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTMod node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.MOD);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0)),
                new NodeStringWrapper(node.jjtGetChild(1)),
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

    /**
     * Type-mapping function translation
     */
    public Object visit(ASTSqrt node, Object data) {
        StringBuffer buf = (StringBuffer) data;
        JDBCFunctionMappingMetaData function = typeMapping.getFunctionMapping(JDBCTypeMappingMetaData.SQRT);
        Object[] args = new Object[]{
                new NodeStringWrapper(node.jjtGetChild(0))
        };
        function.getFunctionSql(args, buf);
        return buf;
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

                .append(SQLUtil.getCreateTableColumnsClause(fieldsArr));

        // add a pk constraint
        final JDBCRelationMetaData relationMetaData = cmrField.getMetaData().getRelationMetaData();
        if (relationMetaData.hasPrimaryKeyConstraint()) {
            JDBCFunctionMappingMetaData pkConstraint =
                    manager.getMetaData().getTypeMapping().getPkConstraintTemplate();
            if (pkConstraint == null) {
                throw new IllegalStateException("Primary key constraint is not allowed for this type of data store");
            }

            String name = "pk_" + relationMetaData.getDefaultTableName();
            name = SQLUtil.fixConstraintName(name, dataSource);
            String[] args = new String[]{
                    name,
                    SQLUtil.getColumnNamesClause(fieldsArr, new StringBuffer(100).toString(), new StringBuffer()).toString()
            };
            sql.append(SQLUtil.COMMA);
            pkConstraint.getFunctionSql(args, sql);
        }
        sql.append(')');
        return sql.toString();
    }
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

        // can only alter tables we created
        if (!manager.hasCreateTable(tableName)) {
            return;
        }

        JDBCFunctionMappingMetaData fkConstraint = manager.getMetaData().getTypeMapping().getFkConstraintTemplate();
        if (fkConstraint == null) {
            throw new IllegalStateException("Foreign key constraint is not allowed for this type of datastore");
        }
        String a = SQLUtil.getColumnNamesClause(fields, new StringBuffer(50)).toString();
        String b = SQLUtil.getColumnNamesClause(referencesFields, new StringBuffer(50)).toString();

        String[] args = new String[]{
                tableName,
                SQLUtil.fixConstraintName("fk_" + tableName + "_" + cmrFieldName, dataSource),
                a,
                referencesTableName,
                b};

        String sql = fkConstraint.getFunctionSql(args, new StringBuffer(100)).toString();

        // since we use the pools, we have to do this within a transaction
        // suspend the current transaction
        TransactionManager tm = manager.getComponent().getTransactionManager();
        Transaction oldTransaction;
View Full Code Here

Examples of org.jboss.as.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

        selectDistinct = ((ASTSelect) selectNode).distinct || returnType == Set.class || forceDistinct;

        // assemble sql
        StringBuffer sql = (StringBuffer) data;
        if (selectManager.getMetaData().hasRowLocking() && !(selectObject instanceof SelectFunction)) {
            JDBCFunctionMappingMetaData rowLockingTemplate = typeMapping.getRowLockingTemplate();
            if (rowLockingTemplate == null) {
                throw new IllegalStateException("Row locking template is not defined for given mapping: " + typeMapping.getName());
            }

            boolean distinct = selectDistinct;

            Object[] args = new Object[]{
                    distinct ? SQLUtil.DISTINCT + selectClause : selectClause.toString(),
                    fromClause,
                    whereClause == null || whereClause.length() == 0 ? null : whereClause,
                    orderByClause == null || orderByClause.length() == 0 ? null : orderByClause
            };
            rowLockingTemplate.getFunctionSql(args, sql);
        } else {
            sql.append(SQLUtil.SELECT);
            if (selectDistinct) {
                sql.append(SQLUtil.DISTINCT);
            }
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.