Examples of XParameters


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

                final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
                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

                StringBuffer sql = new StringBuffer();
                sql.append( "INSERT INTO \"" );
                sql.append( tableName );
                sql.append( "\" VALUES (?, ?)");
                XPreparedStatement statement = connection.prepareStatement( sql.toString() );
                XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );

                final String[] keyValues = impl_getTypedValue( keyTypes[i], 0 );

                for ( int row=0; row<displayValues.length; ++row )
                {
                    statementParameters.setString( 1, keyValues[row] );
                    statementParameters.setString( 2, displayValues[row] );
                    statement.execute();
                }

                // remember a column descriptor for later creation of the table with the foreign keys
                foreignKeyColumns.addnew HsqlColumnDescriptor( columnFKName, columnType, HsqlColumnDescriptor.REQUIRED,
                    tableName, columnPKName ) );

                // remember the data to fill into this table
                foreignKeyValues.add( keyValues );
                foreignKeyInsertSQL.append( ", ?" );
            }

            // create the table taking all those foreign keys
            m_database.createTable( new HsqlTableDescriptor( m_foreignKeyTableName, foreignKeyColumns.toArray( new HsqlColumnDescriptor[0] ) ) );
            // fill in some data
            foreignKeyInsertSQL.append( ")" );
            XPreparedStatement statement = connection.prepareStatement( foreignKeyInsertSQL.toString() );
            XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );
            for ( int row=0; row<2; ++row )
            {
                statementParameters.setInt( 1, row );
                for ( int i=0; i<keyTypes.length; ++i )
                {
                    statementParameters.setString( i+2, foreignKeyValues.get(i)[row] );
                }
                statement.execute();
            }

            m_database.defaultConnection().refreshTables();
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

        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)
        {
            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 = 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");

            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
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.