Examples of XParameters


Examples of com.sun.star.sdbc.XParameters

                final String sQuery = composer.getQuery();
                rowSetProp.setPropertyValue(UNO_COMMAND, sQuery);
                rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,
                                            new Integer(CommandType.COMMAND));

                final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);

                for (int i = 0;
                        i < masterValues.size();
                        i++)
                {
                    Object object = masterValues.get(i);
                    if ( object instanceof BigDecimal )
                    {
                        object = ((BigDecimal) object).toString();
                    }
                    para.setObject(oldParameterCount + i + 1, object);
                }
            }
        }

        return oldParameterCount;
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

        m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
        m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");

        final XConnection connection = m_database.defaultConnection();
        final XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
        final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, prep);
        for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
        {
            para.setInt(1, i);
            para.setString(2, "Test" + i);
            prep.executeUpdate();
        }

        final XTablesSupplier suppTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
        final XRefreshable refresh = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, suppTables.getTables());
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

    {
        try
        {
            createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true);
            m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
            final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
                    m_rowSet);
            rowsetParams.setString(1, "London");
            m_rowSet.execute();
        }
        catch (Exception e)
        {
            assure("testing the parameters of a table failed" + e.getMessage(), false);
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

        try
        {
            createRowSet("products like", CommandType.QUERY, false);

            // let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container
            final XParameters rowsetParams = (XParameters) UnoRuntime.queryInterface(XParameters.class,
                    m_rowSet);
            rowsetParams.setString(1, "Apples");

            XIndexAccess params = m_paramsSupplier.getParameters();
            XPropertySet firstParam = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(0));
            Object firstParamValue = firstParam.getPropertyValue("Value");

            assure("XParameters and the parameters container do not properly interact",
                    "Apples".equals(firstParamValue));

            // let's see whether this also survices an execute of the row set
            rowsetParams.setString(1, "Oranges");
            m_rowSet.execute();
            {
                // TODO: the following would not be necessary if the parameters container would *survive*
                // the execution of the row set. It currently doesn't (though the values it represents do).
                // It would be nice, but not strictly necessary, if it would.
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

            WrappedTargetException
    {
        final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
        if (masterValues != null && !masterValues.isEmpty())
        {
            final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);

            for (int i = 0;
                    i < masterValues.size();
                    i++)
            {
                Object object = masterValues.get(i);
                if (object instanceof BigDecimal)
                {
                    object = ((BigDecimal) object).toString();
                }
                final Integer pos = (Integer)paramDef.parameterIndex.get(i);
                para.setObject(pos + 1, object);
            }
        }
    }
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

                            try
                            {
                                // since we gave the row set a parametrized statement, we need to ensure the
                                // parameter is actually filled, otherwise we would get an empty result set,
                                // which would imply some further tests failing
                                XParameters rowSetParams = UnoRuntime.queryInterface( XParameters.class, resultSet );
                                rowSetParams.setString( 1, "String2" );
                                rowSet.execute();
                                resultSet.first();
                            }
                            catch (com.sun.star.sdbc.SQLException e)
                            {
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

            WrappedTargetException
    {
        final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
        if (masterValues != null && !masterValues.isEmpty())
        {
            final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);

            for (int i = 0;
                    i < masterValues.size();
                    i++)
            {
                Object object = masterValues.get(i);
                if (object instanceof BigDecimal)
                {
                    object = ((BigDecimal) object).toString();
                }
                final Integer pos = (Integer) paramDef.parameterIndex.get(i);
                para.setObject(pos + 1, object);
            }
        }
    }
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

        m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS");
        m_database.executeSQL("CREATE TABLE \"TEST1\" (\"ID\" integer not null primary key, \"col2\" varchar(50) )");

        final Connection connection = m_database.defaultConnection();
        final XPreparedStatement prep = connection.prepareStatement("INSERT INTO \"TEST1\" values (?,?)");
        final XParameters para = UnoRuntime.queryInterface( XParameters.class, prep );
        for (int i = 1; i <= MAX_TABLE_ROWS; ++i)
        {
            para.setInt(1, i);
            para.setString(2, "Test" + i);
            prep.executeUpdate();
        }

        connection.refreshTables();
    }
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

    {
        try
        {
            createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true);
            m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city");
            final XParameters rowsetParams = UnoRuntime.queryInterface( XParameters.class, m_rowSet );
            rowsetParams.setString(1, "London");
            m_rowSet.execute();
        }
        catch (Exception e)
        {
            fail("testing the parameters of a table failed" + e.getMessage());
View Full Code Here

Examples of com.sun.star.sdbc.XParameters

        try
        {
            createRowSet("products like", CommandType.QUERY, false);

            // let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container
            final XParameters rowsetParams = UnoRuntime.queryInterface(XParameters.class, m_rowSet);
            rowsetParams.setString(1, "Apples");

            XIndexAccess params = m_paramsSupplier.getParameters();
            XPropertySet firstParam = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( 0 ) );
            Object firstParamValue = firstParam.getPropertyValue("Value");

            assertTrue("XParameters and the parameters container do not properly interact",
                    "Apples".equals(firstParamValue));

            // let's see whether this also survices an execute of the row set
            rowsetParams.setString(1, "Oranges");
            m_rowSet.execute();
            {
                // TODO: the following would not be necessary if the parameters container would *survive*
                // the execution of the row set. It currently doesn't (though the values it represents do).
                // It would be nice, but not strictly necessary, if it would.
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.