Package com.dci.intellij.dbn.data.type

Examples of com.dci.intellij.dbn.data.type.DBDataType


        filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER_NEW);
        //filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER);
        filterActionGroup.add(new CreateFilterAction(false));
        filterActionGroup.addSeparator();
        if (columnValue != null ) filterActionGroup.add(new CreateFilterAction(true));
        DBDataType dataType = columnInfo.getDataType();
        String text = getClipboardContent((int) dataType.getLength());
        if (text != null) {
            filterActionGroup.add(new CreateClipboardFilterAction(text, false));
            if (dataType.isNative() && dataType.getNativeDataType().getBasicDataType() == GenericDataType.LITERAL) {
                filterActionGroup.add(new CreateClipboardFilterAction(text, true));
            }
        }

        // show the create additional condition action in case the filter is basic,
View Full Code Here


        buffer.append("declare\n");

        // variable declarations
        List<DBArgument> arguments = getArguments();
        for (DBArgument argument : arguments) {
            DBDataType dataType = argument.getDataType();
            if (dataType.isDeclared()) {
                buffer.append("    ");
                appendVariableName(buffer, argument);
                buffer.append(" ").append(dataType.getDeclaredType().getQualifiedName()).append(";\n");
            } else if (isBoolean(dataType)) {
                appendVariableName(buffer, argument);
                buffer.append(" boolean;\n");
            }
        }

        buffer.append("begin\n");

        preHookExecutionCommand(buffer);

        // input variable initialization
        for (DBArgument argument : arguments) {
            DBDataType dataType = argument.getDataType();

            if (argument.isInput()) {
                if (dataType.isDeclared()) {
                    List<DBTypeAttribute> attributes = dataType.getDeclaredType().getAttributes();
                    for (DBTypeAttribute attribute : attributes) {
                        buffer.append("    ");
                        appendVariableName(buffer, argument);
                        buffer.append(".").append(attribute.getName()).append(" := ?;\n");
                    }
                } else if(isBoolean(dataType)) {
                    String stringValue = parseBoolean(argument.getName(), executionInput.getInputValue(argument));

                    buffer.append("    ");
                    appendVariableName(buffer, argument);
                    buffer.append(" := ").append(stringValue).append(";\n");
                }
            }
        }

        // method call
        buffer.append("\n    ");
        if (returnArgument != null) {
            DBDataType dataType = returnArgument.getDataType();
            if (dataType.isDeclared() || isBoolean(dataType))
                appendVariableName(buffer, returnArgument); else
                buffer.append("?");

            buffer.append(" := ");
        }

        // method parameters
        buffer.append(getMethod().getQualifiedName()).append("(");
        for (DBArgument argument : arguments) {
            if (argument != returnArgument) {
                DBDataType dataType = argument.getDataType();
                if (dataType.isDeclared() || isBoolean(dataType))
                    appendVariableName(buffer, argument); else
                    buffer.append("?");
                boolean isLast = arguments.indexOf(argument) == arguments.size() - 1;
                if (!isLast) buffer.append(", ");
            }
        }
        buffer.append(");\n\n");


        // output variable initialization
        for (DBArgument argument : arguments) {
            if (argument.isOutput()) {
                DBDataType dataType = argument.getDataType();
                if (dataType.isDeclared()) {
                    List<DBTypeAttribute> attributes = dataType.getDeclaredType().getAttributes();
                    for (DBTypeAttribute attribute : attributes) {
                        buffer.append("    ? := ");
                        appendVariableName(buffer, argument);
                        buffer.append(".").append(attribute.getName()).append(";\n");
                    }
View Full Code Here

        // bind input variables
        int parameterIndex = 1;
        for (DBArgument argument : getArguments()) {
            if (argument.isInput()) {
                DBDataType dataType = argument.getDataType();
                DBType type = dataType.getDeclaredType();
                if (dataType.isDeclared()) {
                    List<DBTypeAttribute> attributes = type.getAttributes();
                    for (DBTypeAttribute attribute : attributes) {
                        String stringValue = executionInput.getInputValue(argument, attribute);
                        setParameterValue(callableStatement, parameterIndex, attribute.getDataType(), stringValue);
                        parameterIndex++;
                    }
                }
            }
        }

        // bind return variable (functions only)
        if (returnArgument != null) {
            DBDataType dataType = returnArgument.getDataType();
            if(!dataType.isDeclared() && !isBoolean(dataType)) {
                callableStatement.registerOutParameter(parameterIndex, returnArgument.getDataType().getSqlType());
                parameterIndex++;
            }
        }

        // bind input/output parameters
        for (DBArgument argument : getArguments()) {
            DBDataType dataType = argument.getDataType();
            if (!argument.equals(returnArgument) && dataType.isNative() && !isBoolean(dataType)) {
                if (argument.isInput()) {
                    String stringValue = executionInput.getInputValue(argument);
                    setParameterValue(callableStatement, parameterIndex, dataType, stringValue);
                }
                if (argument.isOutput()){
                    callableStatement.registerOutParameter(parameterIndex, dataType.getSqlType());
                }
                parameterIndex++;
            }
        }

        // bind output variables
        for (DBArgument argument : getArguments()) {
            DBDataType dataType = argument.getDataType();
            if (argument.isOutput()) {
                if (dataType.isDeclared()) {
                    List<DBTypeAttribute> attributes = dataType.getDeclaredType().getAttributes();
                    for (DBTypeAttribute attribute : attributes) {
                        callableStatement.registerOutParameter(parameterIndex, attribute.getDataType().getSqlType());
                        parameterIndex++;
                    }
                } else if (isBoolean(dataType)){
                    callableStatement.registerOutParameter(parameterIndex, dataType.getSqlType());
                    parameterIndex++;
                }
            }
        }
    }
View Full Code Here

        DBArgument returnArgument = getReturnArgument();

        // increment parameter index for input variables
        int parameterIndex = 1;
        for (DBArgument argument : getArguments()) {
            DBDataType dataType = argument.getDataType();
            if (dataType.isDeclared()) {
                if (argument.isInput()) {
                    parameterIndex = parameterIndex + dataType.getDeclaredType().getAttributes().size();
                }
            }
        }

        // get return value (functions only)
        if (returnArgument != null) {
            DBDataType dataType = returnArgument.getDataType();
            if (!dataType.isDeclared() && !isBoolean(dataType)) {
                Object result = callableStatement.getObject(parameterIndex);
                executionResult.addArgumentValue(returnArgument, result);
                parameterIndex++;

            }
        }

        // get output parameter values
        for (DBArgument argument : getArguments()) {
            if (!argument.equals(returnArgument)) {
                DBDataType dataType = argument.getDataType();
                if (dataType.isNative() && !isBoolean(dataType)) {
                    if (argument.isOutput()){
                        Object result = callableStatement.getObject(parameterIndex);
                        executionResult.addArgumentValue(argument, result);
                    }
                    parameterIndex++;
                }
            }
        }

        // get output variable values
        for (DBArgument argument : getArguments()) {
            DBDataType dataType = argument.getDataType();
            if (argument.isOutput()) {
                if (dataType.isDeclared()) {
                    executionResult.addArgumentValue(argument, null);
                    List<DBTypeAttribute> attributes = dataType.getDeclaredType().getAttributes();
                    for (DBTypeAttribute attribute : attributes) {
                        Object result = callableStatement.getObject(parameterIndex);
                        executionResult.addArgumentValue(argument, attribute, result);
                        parameterIndex++;
                    }
View Full Code Here

    public DatasetRecordEditorColumnForm(DatasetRecordEditorForm parentForm, DatasetEditorModelCell cell) {
        this.parentForm = parentForm;
        final DatasetEditorColumnInfo columnInfo = cell.getColumnInfo();
        DBColumn column = columnInfo.getColumn();
        DBDataType dataType = column.getDataType();
        Project project = column.getProject();
        regionalSettings = RegionalSettings.getInstance(project);

        columnLabel.setIcon(column.getIcon());
        columnLabel.setText(column.getName());
        dataTypeLabel.setText(dataType.getQualifiedName());
        dataTypeLabel.setForeground(UIUtil.getInactiveTextColor());

        DBNativeDataType nativeDataType = dataType.getNativeDataType();
        if (nativeDataType != null) {
            DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
            GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();

            DataEditorSettings dataEditorSettings = DataEditorSettings.getInstance(project);

            long dataLength = dataType.getLength();

            if (genericDataType.is(GenericDataType.DATE_TIME, GenericDataType.LITERAL)) {
                TextFieldWithPopup textFieldWithPopup = new TextFieldWithPopup(project);

                textFieldWithPopup.setPreferredSize(new Dimension(200, -1));
View Full Code Here

        return editorComponent.getTextField();
    }


    public Object getEditorValue() throws ParseException {
        DBDataType dataType = cell.getColumnInfo().getDataType();
        Class clazz = dataType.getTypeClass();
        String textValue = editorComponent.getText().trim();
        if (textValue.length() > 0) {
            Object value = getFormatter().parseObject(clazz, textValue);
            return dataType.getNativeDataType().getDataTypeDefinition().convert(value);
        } else {
            return null;
        }
    }
View Full Code Here

        attributeLabel.setText(typeAttribute.getName());
        attributeLabel.setIcon(typeAttribute.getIcon());
        attributeTypeLabel.setForeground(UIUtil.getInactiveTextColor());
        attributeTypeLabel.setText(typeAttribute.getDataType().getQualifiedName());

        DBDataType dataType = typeAttribute.getDataType();
        DBNativeDataType nativeDataType = dataType.getNativeDataType();
        DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
        GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();


        if (genericDataType == GenericDataType.DATE_TIME) {
View Full Code Here

                if (attribute == null) {
                    setIcon(argument.getIcon());
                    append(argument.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    append(" = ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    DBDataType dataType = argument.getDataType();
                    if (dataType != null) {
                        append("{" + dataType.getName().toLowerCase() + "} " , SimpleTextAttributes.GRAY_ATTRIBUTES);
                    }

                    append(displayValue, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
                } else {
                    setIcon(attribute.getIcon());
                    append(attribute.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    append(" = ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
                    DBDataType dataType = attribute.getDataType();
                    if (dataType != null) {
                        append("{" + dataType.getName() + "}" , SimpleTextAttributes.GRAY_ATTRIBUTES);
                    }
                    append(displayValue, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
                }
            }
View Full Code Here

        return triggers.getObject(name);
    }

    public boolean hasLobColumns() {
        for (DBColumn column : getColumns()) {
            DBDataType dataType = column.getDataType();
            if (dataType.isNative()) {
                if (dataType.getNativeDataType().isLOB()) {
                    return true;
                }
            }

        }
View Full Code Here

    @Override
    protected void initObject(ResultSet resultSet) throws SQLException {
        name = resultSet.getString("ATTRIBUTE_NAME");
        position = resultSet.getInt("POSITION");
        dataType = new DBDataType(this, resultSet);    }
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.data.type.DBDataType

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.