Package com.sun.star.wizards.db

Examples of com.sun.star.wizards.db.SQLQueryComposer


                    if (bgetConnection)
                    {

                        if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
                        {
                            getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
                            DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
                            if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet))
                            {
                                getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command");
                                getRecordParser().oSQLQueryComposer.xQueryAnalyzer.setQuery(getRecordParser().Command);
View Full Code Here


                if (bgetConnection)
                {

                    if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
                    {
                        getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
                        DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
                        if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
                        {
                            getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command");
                            getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command);
View Full Code Here

    private boolean executeQuery()
    {
        boolean bQueryCreated = false;
        final RecordParser recordParser = m_reportDocument.getRecordParser();
        final SQLQueryComposer sqlQueryComposer = recordParser.getSQLQueryComposer();
        if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
        {
            if (m_reportDocument instanceof ReportTextImplementation)
            {
                bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false);
                m_reportDocument.setCommandType(CommandType.COMMAND);
                String sQuery = sqlQueryComposer.getQuery();
                m_reportDocument.setCommand(sQuery);
            }
            else
            {
                bQueryCreated = true;
            }
        }
        else
        {
            try
            {
                String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
                DBMetaData.CommandObject oCommand = recordParser.getQueryByName(sQueryName);
                bHasEscapeProcessing = recordParser.hasEscapeProcessing(oCommand.getPropertySet());
                String sCommand = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND);
                if (bHasEscapeProcessing)
                {
                    // String sCommand = (String) oCommand.xPropertySet.getPropertyValue(PropertyNames.COMMAND);
                    bQueryCreated = (!sCommand.equals(PropertyNames.EMPTY_STRING));
                    if (m_reportDocument instanceof ReportTextImplementation)
                    {
                        sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
                        sqlQueryComposer.prependSortingCriteria();
                        m_reportDocument.setCommandType(CommandType.COMMAND);
                        m_reportDocument.setCommand(sqlQueryComposer.getQuery());
                    }
                }
                else
                {
                    m_reportDocument.setCommandType(CommandType.COMMAND);
View Full Code Here

        // ControlRow CurControlRow;
        // getfilterstate();
        int nFilterCount = getFilterCount();
        if (nFilterCount > 0)
        {
            final SQLQueryComposer composer = oQueryMetaData.getSQLQueryComposer();
            try
            {
                final String serviceName = "com.sun.star.beans.PropertyBag";
                final XPropertyContainer column = UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));

                column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR);
                column.addProperty(PropertyNames.PROPERTY_NAME, PropertyAttribute.BOUND, PropertyNames.EMPTY_STRING);
                column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), null);
                final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column);

                if (composer.getQuery().length() == 0)
                {
                    StringBuilder sql = new StringBuilder();
                    sql.append(composer.getSelectClause(true));
                    sql.append(' ');
                    sql.append(composer.getFromClause());
                    composer.getQueryComposer().setElementaryQuery(sql.toString());
                }
                composer.getQueryComposer().setStructuredFilter(new PropertyValue[][]
                        {
                        });
                for (int i = 0; i < RowCount; i++)
                {
                    ControlRow currentControlRow = oControlRows[i];
                    if (currentControlRow.isEnabled() && currentControlRow.isConditionComplete())
                    {
                        String sFieldName = currentControlRow.getSelectedFieldName();
                        int nOperator = (int) currentControlRow.getSelectedOperator();
                        FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
                        columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName());
                        columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
                        Object value = currentControlRow.getValue();
                        switch (aFieldColumn.getFieldType())
                        {
                            case DataType.TIMESTAMP:
                            case DataType.DATE:
                                value = ((Double) value) - oQueryMetaData.getNullDateCorrection();
                                break;
                        }
                        column.removeProperty("Value");
                        final short operator = currentControlRow.getSelectedOperator();
                        if ((operator == SQLFilterOperator.SQLNULL)
                                || (operator == SQLFilterOperator.NOT_SQLNULL)
                                || AnyConverter.isVoid(value))
                        {
                            column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), "");
                            value = new Any(new Type(TypeClass.VOID), null);
                        }
                        else
                        {
                            column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), value);
                        }
                        columnSet.setPropertyValue("Value", value);
                        composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator);
                    }
                }
                filterconditions = composer.getNormalizedStructuredFilter();
                int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
                if (iduplicate[0] != -1)
                {
                    PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]];
                    String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null);
View Full Code Here

                if (bgetConnection)
                {

                    if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
                    {
                        getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
                        DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
                        if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
                        {
                            getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command");
                            getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command);
View Full Code Here

        // ControlRow CurControlRow;
        // getfilterstate();
        int nFilterCount = getFilterCount();
        if (nFilterCount > 0)
        {
            final SQLQueryComposer composer = oQueryMetaData.getSQLQueryComposer();
            try
            {
                final String serviceName = "com.sun.star.beans.PropertyBag";
                final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));
               
                column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR);
                column.addProperty("Name", PropertyAttribute.BOUND, "");
                column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), null );
                final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column);

                if ( composer.getQuery().length() == 0)
                {
                    final String fromClause = composer.getFromClause();
                    StringBuilder sql = new StringBuilder();
                    sql.append(composer.getSelectClause(true));
                    sql.append(' ');
                    sql.append(fromClause);
                    composer.getQueryComposer().setElementaryQuery(sql.toString());
                }
                composer.getQueryComposer().setStructuredFilter( new PropertyValue[][] {} );
                for (int i = 0; i < RowCount; i++)
                {
                    ControlRow currentControlRow = oControlRows[i];
                    if (currentControlRow.isEnabled())
                    {
                        if (currentControlRow.isConditionComplete())
                        {
                            String sFieldName = currentControlRow.getSelectedFieldName();
                            int nOperator = (int) currentControlRow.getSelectedOperator();
                            FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
                            columnSet.setPropertyValue("Name", aFieldColumn.getFieldName());
                            columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
                            Object value = currentControlRow.getValue();
                            switch(aFieldColumn.getFieldType())
                            {
                                case DataType.TIMESTAMP:
                                case DataType.DATE:
                                    value = ((Double)value) - oQueryMetaData.getNullDateCorrection();
                                    break;
                            }
                            column.removeProperty( "Value" );
                            final short operator = currentControlRow.getSelectedOperator();
                            if  (   ( operator == SQLFilterOperator.SQLNULL )
                                ||  ( operator == SQLFilterOperator.NOT_SQLNULL )
                                ||  AnyConverter.isVoid( value )
                                )
                            {
                                column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), new String() );
                                value = new Any( new Type( TypeClass.VOID ), null );
                            }
                            else
                                column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), value );
                            columnSet.setPropertyValue("Value", value);
                            composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator);
                        }
                    }
                }
                filterconditions = composer.getNormalizedStructuredFilter();
                int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
                if (iduplicate[0] != -1)
                {
                    PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]];
                    String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null);
View Full Code Here

                if (bgetConnection)
                {

                    if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
                    {
                        getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
                        DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
                        if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet))
                        {
                            getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command");
                            getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command);
View Full Code Here

TOP

Related Classes of com.sun.star.wizards.db.SQLQueryComposer

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.