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

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


import java.sql.SQLException;

public class ResultSetDataModelCell extends SortableDataModelCell {
    public ResultSetDataModelCell(ResultSetDataModelRow row, ResultSet resultSet, ResultSetColumnInfo columnInfo) throws SQLException {
        super(row, null, columnInfo.getColumnIndex());
        DBDataType dataType = columnInfo.getDataType();
        Object userValue = dataType.getValueFromResultSet(resultSet, columnInfo.getResultSetColumnIndex());
        setUserValue(userValue);
    }
View Full Code Here


        String dataTypeName = metaData.getColumnTypeName(resultSetColumnIndex);
        int precision = getPrecision(metaData);
        int scale = metaData.getScale(resultSetColumnIndex);
        DBNativeDataType nativeDataType = objectBundle.getNativeDataType(dataTypeName);
        dataType = new DBDataType(nativeDataType, precision, scale);
    }
View Full Code Here

    public ResultSetRecordViewerColumnForm(ResultSetRecordViewerForm parentForm, ResultSetDataModelCell cell) {
        this.parentForm = parentForm;
        Project project = cell.getRow().getModel().getProject();
        ColumnInfo columnInfo = cell.getColumnInfo();

        DBDataType dataType = columnInfo.getDataType();
        regionalSettings = RegionalSettings.getInstance(project);

        columnLabel.setIcon(Icons.DBO_COLUMN);
        columnLabel.setText(columnInfo.getName());
        dataTypeLabel.setText(dataType.getQualifiedName());
        dataTypeLabel.setForeground(UIUtil.getInactiveTextColor());

        valueTextField = new JTextField();
        valueTextField.setPreferredSize(new Dimension(200, -1));
        valueTextField.addKeyListener(keyAdapter);
View Full Code Here

        columnLabel.setPreferredSize(new Dimension(metrics[0], columnLabel.getHeight()));
        valueFieldPanel.setPreferredSize(new Dimension(metrics[1], valueFieldPanel.getHeight()));
    }

    public Object getEditorValue() throws ParseException {
        DBDataType dataType = cell.getColumnInfo().getDataType();
        Class clazz = dataType.getTypeClass();
        String textValue = valueTextField.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

        this.parentForm = parentForm;
        this.record = record;
        this.column = column;
        Project project = record.getDataset().getProject();

        DBDataType dataType = column.getDataType();
        regionalSettings = RegionalSettings.getInstance(project);

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

        valueTextField = new ColumnValueTextField(record, column);
        valueTextField.setPreferredSize(new Dimension(200, -1));
        valueTextField.addKeyListener(keyAdapter);
View Full Code Here

        this.argument = argument;
        this.executionComponent = executionComponent;
        argumentLabel.setText(argument.getName());
        argumentLabel.setIcon(argument.getIcon());

        DBDataType dataType = argument.getDataType();

        argumentTypeLabel.setForeground(UIUtil.getInactiveTextColor());
        if (dataType.isDeclared()) {
            DBType declaredType = dataType.getDeclaredType();
            argumentTypeLabel.setIcon(declaredType.getIcon());
            argumentTypeLabel.setText(declaredType.getName());

            typeAttributesPanel.setLayout(new BoxLayout(typeAttributesPanel, BoxLayout.Y_AXIS));
            List<DBTypeAttribute> attributes = declaredType.getAttributes();
            for (DBTypeAttribute attribute : attributes) {
                addAttributePanel(attribute);
            }

        } else {
            argumentTypeLabel.setText(dataType.getQualifiedName());
            typeAttributesPanel.setVisible(false);
        }


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

            if (genericDataType == GenericDataType.DATE_TIME) {
                TextFieldWithPopup inputField = new TextFieldWithPopup(argument.getProject());
View Full Code Here

                conditionOperator.getValuePrefix() != null &&
                conditionOperator.getValuePostfix() != null) {
            value = conditionOperator.getValuePrefix() + value + conditionOperator.getValuePostfix();
        }
        else if (StringUtil.isNotEmptyOrSpaces(value)) {
            DBDataType dataType = column == null ? null : column.getDataType();
            if (dataType != null && dataType.isNative()) {
                ConnectionHandler connectionHandler = dataset.getConnectionHandler();
                RegionalSettings regionalSettings = RegionalSettings.getInstance(connectionHandler.getProject());
                GenericDataType genericDataType = dataType.getNativeDataType().getBasicDataType();
                if (genericDataType == GenericDataType.LITERAL) {
                    value = com.intellij.openapi.util.text.StringUtil.replace(value, "'", "''");
                    value = "'" + value + "'";
                } else if (genericDataType == GenericDataType.DATE_TIME) {
                    DatabaseMetadataInterface metadataInterface = connectionHandler.getInterfaceProvider().getMetadataInterface();
View Full Code Here

            if (variable == null) {
                variable = new StatementExecutionVariable(variablePsiElement);
            }

            if (variable.getDataType() == null) {
                DBDataType dataType = lookupDataType(variablePsiElement);
                if (dataType != null && dataType.isNative()) {
                    variable.setDataType(dataType.getNativeDataType().getBasicDataType());
                } else {
                    variable.setDataType(GenericDataType.LITERAL);
                }
            }
            newVariables.add(variable);
View Full Code Here

            } catch (Exception e) {
                e.printStackTrace();
                MessageUtil.showErrorDialog("Could not update cell value for " + getColumnInfo().getName() + ".", e);
                return;
            }
            DBDataType dataType = getColumnInfo().getDataType();

            boolean isLargeObject = dataType.getNativeDataType().isLOB();
            try {
                clearError();
                int columnIndex = getColumnInfo().getColumnIndex() + 1;
                if (isLargeObject) {
                    LazyLoadedValue lazyLoadedValue = (LazyLoadedValue) getUserValue();
                    lazyLoadedValue.updateValue(resultSet, columnIndex, (String) userValue);
                } else {
                    dataType.setValueToResultSet(resultSet, columnIndex, userValue);
                }

                if (!row.isInsert()) resultSet.updateRow();
            } catch (Exception e) {
                DatasetEditorError error = new DatasetEditorError(getConnectionHandler(), e);
View Full Code Here

    @Override
    public void prepareEditor(final DatasetEditorModelCell cell) {
        getEditorComponent().setUserValueHolder(cell);
        setCell(cell);
        ColumnInfo columnInfo = cell.getColumnInfo();
        DBDataType dataType = columnInfo.getDataType();
        if (dataType.isNative()) {
            highlight(cell.hasError() ? HIGHLIGHT_TYPE_ERROR : HIGHLIGHT_TYPE_NONE);
            if (dataType.getNativeDataType().isLOB()) {
                setEditable(false);
            } else {
                String userValue = (String) cell.getUserValue();
                setEditable(userValue == null || (userValue.length() < 1000 && userValue.indexOf('\n') == -1));
            }
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.