Examples of XRowUpdate


Examples of com.sun.star.sdbc.XRowUpdate

                    UnoRuntime.queryInterface(XResultSet.class, oObj) ;
                final XResultSetUpdate xResSetUpdate = (XResultSetUpdate)
                    UnoRuntime.queryInterface(XResultSetUpdate.class, oObj) ;
                final XRowSet xRowSet = (XRowSet) UnoRuntime.queryInterface
                    (XRowSet.class, oObj) ;
                final XRowUpdate xRowUpdate = (XRowUpdate)
                    UnoRuntime.queryInterface(XRowUpdate.class, oObj) ;
                final PrintWriter logF = log ;
                tEnv.addObjRelation("XRowSetApproveBroadcaster.ApproveChecker",
                    new ifc.sdb._XRowSetApproveBroadcaster.RowSetApproveChecker() {
                        public void moveCursor() {
                            try {
                                xResSet.beforeFirst() ;
                                xResSet.afterLast() ;
                                xResSet.first() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster." +
                                    "RowSetApproveChecker.moveCursor() :") ;
                                e.printStackTrace(logF) ;
                            }
                        }
                        public RowChangeEvent changeRow() {
                            try {
                                xResSet.first() ;
                                xRowUpdate.updateString(1, "ORowSetTest2") ;
                                xResSetUpdate.updateRow() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster." +
                                    "RowSetApproveChecker.changeRow() :") ;
                                e.printStackTrace(logF) ;
                            }
                            RowChangeEvent ev = new RowChangeEvent() ;
                            ev.Action = com.sun.star.sdb.RowChangeAction.UPDATE ;
                            ev.Rows = 1 ;

                            return ev ;
                        }
                        public void changeRowSet() {
                            try {
                                xRowSet.execute() ;
                                xResSet.first() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster."+
                                    "RowSetApproveChecker.changeRowSet() :") ;
                                e.printStackTrace(logF) ;
                            }
                        }
                    }) ;
            }
            // Adding relations for XRow as a Vector with all data
            // of current row of RowSet.

            Vector rowData = new Vector() ;

            for (int i = 0; i < DBTools.TST_TABLE_VALUES[0].length; i++) {
                rowData.add(DBTools.TST_TABLE_VALUES[0][i]) ;
            }

            // here XRef must be added
            // here XBlob must be added
            // here XClob must be added
            // here XArray must be added

            tEnv.addObjRelation("CurrentRowData", rowData) ;

            // Adding relation for XColumnLocate ifc test
            tEnv.addObjRelation("XColumnLocate.ColumnName",
                DBTools.TST_STRING_F) ;

            // Adding relation for XCompletedExecution
            tEnv.addObjRelation("InteractionHandlerChecker", new InteractionHandlerImpl());
            XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oObj) ;
            try {
                xProp.setPropertyValue("DataSourceName", dbSourceName) ;
                if(isMySQLDB) {
                    xProp.setPropertyValue("Command", "SELECT Column0  FROM soffice_test_table  WHERE ( (  Column0 = :param1 ) )");
                }
                else {
                    xProp.setPropertyValue("Command", "SELECT \"_TEXT\" FROM \"ORowSet_tmp" + uniqueSuffix + "\" WHERE ( ( \"_TEXT\" = :param1 ) )");
                }

                xProp.setPropertyValue("CommandType", new Integer(CommandType.COMMAND)) ;
            }
            catch(Exception e) {
            }

           
           
           
           
            // Adding relation for XParameters ifc test
            Vector params = new Vector() ;


            tEnv.addObjRelation("XParameters.ParamValues", params) ;

            // Adding relation for XRowUpdate
            XRow row = (XRow) UnoRuntime.queryInterface (XRow.class, oObj) ;
            tEnv.addObjRelation("XRowUpdate.XRow", row) ;

            // Adding relation for XResultSetUpdate
            {
                final XResultSet xResSet = (XResultSet)
                    UnoRuntime.queryInterface(XResultSet.class, oObj) ;
                final XRowUpdate xRowUpdate = (XRowUpdate)
                    UnoRuntime.queryInterface(XRowUpdate.class, oObj) ;
                final XRow xRow = (XRow) UnoRuntime.queryInterface
                    (XRow.class, oObj) ;

                tEnv.addObjRelation("XResultSetUpdate.UpdateTester",
                    new ifc.sdbc._XResultSetUpdate.UpdateTester() {
                        String lastUpdate = null ;

                        public int rowCount() throws SQLException {
                            int prevPos = xResSet.getRow() ;
                            xResSet.last() ;
                            int count = xResSet.getRow() ;
                            xResSet.absolute(prevPos) ;

                            return count ;
                        }

                        public void update() throws SQLException {
                            lastUpdate = xRow.getString(1) ;
                            lastUpdate += "_" ;
                            xRowUpdate.updateString(1, lastUpdate) ;
                        }

                        public boolean wasUpdated() throws SQLException {
                            String getStr = xRow.getString(1) ;
                            return lastUpdate.equals(getStr) ;
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

    * else: just calls method.<p>
    * Has <b>OK</b> status if no exceptions were thrown and value after
    * refreshRow() equals to saved value.
    */
    public void _refreshRow() {
        XRowUpdate xRowUpdate = (XRowUpdate)
            UnoRuntime.queryInterface(XRowUpdate.class, oObj);
        XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, oObj);

        if (xRowUpdate == null || xRow == null) {
            log.println("Test must be modified because XRow or XRowUpdate is't supported");
            log.println("Only call method");
            try {
                oObj.refreshRow() ;
                tRes.tested("refreshRow()", true) ;
            } catch (SQLException e) {
                log.println("Exception occured :") ;
                e.printStackTrace(log) ;
                tRes.tested("refreshRow()", false) ;
            }
        } else {
            log.println("Testing of refreshRow()...");
            try {
                String oldValue = xRow.getString(util.DBTools.TST_STRING);
                log.println("Old value: " + oldValue);
                xRowUpdate.updateString(util.DBTools.TST_STRING,
                    "Test method refreshRow");
                log.println("New value: "
                    + xRow.getString(util.DBTools.TST_STRING));
                oObj.refreshRow();
                String valAfterRefresh =
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

        XResultSet set = stat.executeQuery("SELECT * FROM " + table) ;

        XResultSetUpdate updt = (XResultSetUpdate) UnoRuntime.queryInterface
            (XResultSetUpdate.class, set) ;

        XRowUpdate rowUpdt = (XRowUpdate) UnoRuntime.queryInterface
            (XRowUpdate.class, set) ;

        updt.moveToInsertRow() ;

        for (int i = 0; i < values.length; i++) {
            if (values[i] instanceof String) {
                rowUpdt.updateString(TST_STRING, (String) values[i]) ;
            } else
            if (values[i] instanceof Integer) {
                rowUpdt.updateInt(TST_INT, ((Integer) values[i]).intValue()) ;
            } else
            if (values[i] instanceof Double) {
                rowUpdt.updateDouble(TST_DOUBLE, ((Double) values[i]).doubleValue()) ;
            } else
            if (values[i] instanceof Date) {
                rowUpdt.updateDate(TST_DATE, (Date) values[i]) ;
            } else
            if (values[i] instanceof Boolean) {
                rowUpdt.updateBoolean(TST_BOOLEAN, ((Boolean) values[i]).booleanValue()) ;
            } else
            if (values[i] instanceof XTextInputStream) {
                rowUpdt.updateCharacterStream(TST_CHARACTER_STREAM, (XInputStream) values[i],
                    streamLength) ;
            } else
            if (values[i] instanceof XDataInputStream) {
                rowUpdt.updateBinaryStream(TST_BINARY_STREAM, (XInputStream) values[i],
                    streamLength) ;
            }
        }

        updt.insertRow() ;
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

        boolean result = true ;
        try {
            oObj.moveToCurrentRow();
            int rowsBefore = tester.rowCount() ;
            oObj.moveToInsertRow() ;
            XRowUpdate rowU = (XRowUpdate)
                            UnoRuntime.queryInterface(XRowUpdate.class, oObj);
            rowU.updateString(1,"open");
            rowU.updateInt(2,5);
            rowU.updateDouble(5,3.4);
            rowU.updateBoolean(10,true);
            oObj.insertRow() ;
            oObj.moveToCurrentRow();
            int rowsAfter = tester.rowCount() ;
            result = rowsBefore + 1 == rowsAfter ;
        } catch (SQLException e) {
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

    * Updates value of int column by value '9999999999999999'.
    * Calls method and checks returned value. <p>
    * Has OK status if the method return not empty value.
    */
    public void _getWarnings() {
        final XRowUpdate xRowUpdate = (XRowUpdate)
            UnoRuntime.queryInterface(XRowUpdate.class, oObj);
        final XResultSetUpdate xResSetUpdate = (XResultSetUpdate)
            UnoRuntime.queryInterface(XResultSetUpdate.class, oObj);
        final XRow xRow = (XRow)
            UnoRuntime.queryInterface(XRow.class, oObj);
        if (xRowUpdate == null || xResSetUpdate == null || xRow == null) {
            throw new StatusException(Status.failed("Test must be modified"));
        }
        int oldVal = 0, newVal = 0;
        String valToSet = "9999999999999999";
        try {
            oldVal = xRow.getInt(DBTools.TST_INT);
            xRowUpdate.updateString(DBTools.TST_INT, valToSet);
            xResSetUpdate.updateRow();
            newVal = xRow.getInt(DBTools.TST_INT);
        } catch(com.sun.star.sdbc.SQLException e) {
            log.println("Unexpected SQL exception");
            e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

            public RowChangeEvent changeRow() {
                try {
                    xResSet.first();

                    XRowUpdate row = (XRowUpdate) UnoRuntime.queryInterface(
                                             XRowUpdate.class, xResSet);
                    row.updateString(1, "1");
                    xResSetUpdate.updateRow();
                } catch (com.sun.star.sdbc.SQLException e) {
                    logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRow() :");
                    e.printStackTrace(logF);
                }

                RowChangeEvent ev = new RowChangeEvent();
                ev.Action = com.sun.star.sdb.RowChangeAction.UPDATE;
                ev.Rows = 1;

                return ev;
            }

            public void changeRowSet() {
                try {
                    xRowSet.execute();
                } catch (com.sun.star.sdbc.SQLException e) {
                    logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRowSet() :");
                    e.printStackTrace(logF);
                }
            }
        });


        // Adding relation for XColumnLocate test
        tEnv.addObjRelation("XColumnLocate.ColumnName", DBTools.TST_STRING_F);

        // Adding relation for XParameters ifc test
        Vector params = new Vector();


        /*****  statement parameter types and their initial
                values must be added here as relation. */
        params.add(new String("SAU99")) ;
        params.add(new Boolean(false)) ;
        params.add(new Byte((byte) 123)) ;
        params.add(new Short((short) 234)) ;
        params.add(new Integer(12345)) ;
        params.add(new Long(23456)) ;
        params.add(new Float(1.234)) ;
        params.add(new Double(2.345)) ;
        params.add(new byte[] {1, 2, 3}) ;
        Date d = new Date();
        d.Day = 26; d.Month = 1; d.Year = 2001;
        params.add(d) ;
        Time t = new Time();
        t.Hours = 1; t.HundredthSeconds = 12; t.Minutes = 25; t.Seconds = 14;
        params.add(t) ;
        DateTime dt = new DateTime();
        dt.Day = 26; dt.Month = 1; dt.Year = 2001; dt.Hours = 1;
        dt.HundredthSeconds = 12; dt.Minutes = 25; dt.Seconds = 14;
        params.add(dt) ;
        tEnv.addObjRelation("XParameters.ParamValues", params);

        // Adding relation for XCompletedExecution
        tEnv.addObjRelation("InteractionHandlerChecker", new InteractionHandlerImpl());
       
        // Adding for XWarningSupplier
        tEnv.addObjRelation("CheckWarningsSupplier", new Boolean(isMySQLDB));

        // Adding relation for XDatabaseParameterBroadcaster
        tEnv.addObjRelation("ParameterListenerChecker", new ODatabaseForm.ParameterListenerImpl());  
        XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface
            (XPropertySet.class, oObj) ;
        try {
            xSetProp.setPropertyValue("DataSourceName", dbSourceName) ;
            if(isMySQLDB) {
                xSetProp.setPropertyValue("Command", "SELECT Column0  FROM soffice_test_table  WHERE ( (  Column0 = :param1 ) )");
            }
            else {
                xSetProp.setPropertyValue("Command", "SELECT \"_TEXT\" FROM \"ODatabaseForm_tmp0\" WHERE ( ( \"_TEXT\" = :param1 ) )");
            }
               
            xSetProp.setPropertyValue("CommandType",
                new Integer(CommandType.COMMAND)) ;
        }
        catch(Exception e) {
        }

        // Adding relation for XResultSetUpdate
        final XRowUpdate xRowUpdate = (XRowUpdate) UnoRuntime.queryInterface(
                                              XRowUpdate.class, oObj);
        final XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oObj);

        tEnv.addObjRelation("XResultSetUpdate.UpdateTester",
                            new ifc.sdbc._XResultSetUpdate.UpdateTester() {
            String lastUpdate = null;

            public int rowCount() throws SQLException {
                int prevPos = xResSet.getRow();
                xResSet.last();

                int count = xResSet.getRow();
                xResSet.absolute(prevPos);

                return count;
            }

            public void update() throws SQLException {
                lastUpdate = xRow.getString(1);
                lastUpdate += "_";
                xRowUpdate.updateString(1, lastUpdate);
            }

            public boolean wasUpdated() throws SQLException {
                String getStr = xRow.getString(1);

View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

        testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
        testCursorMove(m_resultSet, cResSet.getMethod("first", (Class[]) null), pRow, moves, null);
        testCursorMove(m_resultSet, cResSet.getMethod("previous", (Class[]) null), pRow, moves, null);
        testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
        moves[RowSetEventListener.IS_MODIFIED] = true;
        final XRowUpdate updRow = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
        updRow.updateString(2, TEST21);
        testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);

        moves[RowSetEventListener.IS_MODIFIED] = false;
        final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
        final XResultSetUpdate upd = (XResultSetUpdate) UnoRuntime.queryInterface(XResultSetUpdate.class, m_resultSet);
        testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);

        updRow.updateInt(1, MAX_TABLE_ROWS + 2);
        updRow.updateString(2, "HHHH");
        moves[RowSetEventListener.APPROVE_CURSOR_MOVE] = false;
        moves[RowSetEventListener.CURSOR_MOVED] = false;
        moves[RowSetEventListener.IS_MODIFIED] = true;
        moves[RowSetEventListener.IS_NEW] = true;
        moves[RowSetEventListener.ROW_COUNT] = true;
        moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
        moves[RowSetEventListener.ROW_CHANGED] = true;
        testCursorMove(upd, cupd.getMethod("insertRow", (Class[]) null), pRow, moves, null);

        moves[RowSetEventListener.IS_NEW] = false;
        moves[RowSetEventListener.ROW_COUNT] = false;
        m_resultSet.first();
        updRow.updateInt(1, MAX_TABLE_ROWS + 3);
        updRow.updateString(2, "__");
        testCursorMove(upd, cupd.getMethod("updateRow", (Class[]) null), pRow, moves, null);

        moves[RowSetEventListener.IS_NEW] = true;
        moves[RowSetEventListener.ROW_COUNT] = true;
        m_resultSet.first();
        testCursorMove(upd, cupd.getMethod("deleteRow", (Class[]) null), pRow, moves, null);

        moves[RowSetEventListener.IS_NEW] = false;
        moves[RowSetEventListener.COLUMN_VALUE] = true;
        moves[RowSetEventListener.ROW_COUNT] = false;
        m_resultSet.first();
        updRow.updateString(2, TEST21);
        testCursorMove(m_resultSet, cResSet.getMethod("refreshRow", (Class[]) null), pRow, moves, null);

        m_resultSet.first();
        updRow.updateString(2, TEST21);
        testCursorMove(upd, cupd.getMethod("cancelRowUpdates", (Class[]) null), pRow, moves, null);

        for (int i = 0; i < moves.length; ++i)
        {
            moves[i] = false;
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

        assure("rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted());

        // .....................................................................................................
        // updating values in a deleted row should fail
        deleteRandom();
        final XRowUpdate rowUpdated = (XRowUpdate) UnoRuntime.queryInterface(XRowUpdate.class, m_resultSet);
        caughtException = false;
        try
        {
            rowUpdated.updateString(2, TEST21);
        }
        catch (SQLException e)
        {
            caughtException = true;
        }
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

                    UnoRuntime.queryInterface(XResultSet.class, oObj) ;
                final XResultSetUpdate xResSetUpdate = (XResultSetUpdate)
                    UnoRuntime.queryInterface(XResultSetUpdate.class, oObj) ;
                final XRowSet xRowSet = (XRowSet) UnoRuntime.queryInterface
                    (XRowSet.class, oObj) ;
                final XRowUpdate xRowUpdate = (XRowUpdate)
                    UnoRuntime.queryInterface(XRowUpdate.class, oObj) ;
                final PrintWriter logF = log ;
                tEnv.addObjRelation("XRowSetApproveBroadcaster.ApproveChecker",
                    new ifc.sdb._XRowSetApproveBroadcaster.RowSetApproveChecker() {
                        public void moveCursor() {
                            try {
                                xResSet.beforeFirst() ;
                                xResSet.afterLast() ;
                                xResSet.first() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster." +
                                    "RowSetApproveChecker.moveCursor() :") ;
                                e.printStackTrace(logF) ;
                            }
                        }
                        public RowChangeEvent changeRow() {
                            try {
                                xResSet.first() ;
                                xRowUpdate.updateString(1, "ORowSetTest2") ;
                                xResSetUpdate.updateRow() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster." +
                                    "RowSetApproveChecker.changeRow() :") ;
                                e.printStackTrace(logF) ;
                            }
                            RowChangeEvent ev = new RowChangeEvent() ;
                            ev.Action = com.sun.star.sdb.RowChangeAction.UPDATE ;
                            ev.Rows = 1 ;

                            return ev ;
                        }
                        public void changeRowSet() {
                            try {
                                xRowSet.execute() ;
                                xResSet.first() ;
                            } catch (com.sun.star.sdbc.SQLException e) {
                                logF.println("### _XRowSetApproveBroadcaster."+
                                    "RowSetApproveChecker.changeRowSet() :") ;
                                e.printStackTrace(logF) ;
                            }
                        }
                    }) ;
            }
            // Adding relations for XRow as a Vector with all data
            // of current row of RowSet.

            Vector rowData = new Vector() ;

            for (int i = 0; i < DBTools.TST_TABLE_VALUES[0].length; i++) {
                rowData.add(DBTools.TST_TABLE_VALUES[0][i]) ;
            }

            // here XRef must be added
            // here XBlob must be added
            // here XClob must be added
            // here XArray must be added

            tEnv.addObjRelation("CurrentRowData", rowData) ;

            // Adding relation for XColumnLocate ifc test
            tEnv.addObjRelation("XColumnLocate.ColumnName",
                DBTools.TST_STRING_F) ;

            // Adding relation for XCompletedExecution
            tEnv.addObjRelation("InteractionHandlerChecker", new InteractionHandlerImpl());
            XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oObj) ;
            try {
                xProp.setPropertyValue("DataSourceName", dbSourceName) ;
                if(isMySQLDB) {
                    xProp.setPropertyValue("Command", "SELECT Column0  FROM soffice_test_table  WHERE ( (  Column0 = :param1 ) )");
                }
                else {
                    xProp.setPropertyValue("Command", "SELECT \"_TEXT\" FROM \"ORowSet_tmp" + uniqueSuffix + "\" WHERE ( ( \"_TEXT\" = :param1 ) )");
                }

                xProp.setPropertyValue("CommandType", new Integer(CommandType.COMMAND)) ;
            }
            catch(Exception e) {
            }

           
           
           
           
            // Adding relation for XParameters ifc test
            Vector params = new Vector() ;


            tEnv.addObjRelation("XParameters.ParamValues", params) ;

            // Adding relation for XRowUpdate
            XRow row = (XRow) UnoRuntime.queryInterface (XRow.class, oObj) ;
            tEnv.addObjRelation("XRowUpdate.XRow", row) ;

            // Adding relation for XResultSetUpdate
            {
                final XResultSet xResSet = (XResultSet)
                    UnoRuntime.queryInterface(XResultSet.class, oObj) ;
                final XRowUpdate xRowUpdate = (XRowUpdate)
                    UnoRuntime.queryInterface(XRowUpdate.class, oObj) ;
                final XRow xRow = (XRow) UnoRuntime.queryInterface
                    (XRow.class, oObj) ;

                tEnv.addObjRelation("XResultSetUpdate.UpdateTester",
                    new ifc.sdbc._XResultSetUpdate.UpdateTester() {
                        String lastUpdate = null ;

                        public int rowCount() throws SQLException {
                            int prevPos = xResSet.getRow() ;
                            xResSet.last() ;
                            int count = xResSet.getRow() ;
                            xResSet.absolute(prevPos) ;

                            return count ;
                        }

                        public void update() throws SQLException {
                            lastUpdate = xRow.getString(1) ;
                            lastUpdate += "_" ;
                            xRowUpdate.updateString(1, lastUpdate) ;
                        }

                        public boolean wasUpdated() throws SQLException {
                            String getStr = xRow.getString(1) ;
                            return lastUpdate.equals(getStr) ;
View Full Code Here

Examples of com.sun.star.sdbc.XRowUpdate

            public RowChangeEvent changeRow() {
                try {
                    xResSet.first();

                    XRowUpdate row = (XRowUpdate) UnoRuntime.queryInterface(
                                             XRowUpdate.class, xResSet);
                    row.updateString(1, "1");
                    xResSetUpdate.updateRow();
                } catch (com.sun.star.sdbc.SQLException e) {
                    logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRow() :");
                    e.printStackTrace(logF);
                }

                RowChangeEvent ev = new RowChangeEvent();
                ev.Action = com.sun.star.sdb.RowChangeAction.UPDATE;
                ev.Rows = 1;

                return ev;
            }

            public void changeRowSet() {
                try {
                    xRowSet.execute();
                } catch (com.sun.star.sdbc.SQLException e) {
                    logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRowSet() :");
                    e.printStackTrace(logF);
                }
            }
        });


        // Adding relation for XColumnLocate test
        tEnv.addObjRelation("XColumnLocate.ColumnName", DBTools.TST_STRING_F);

        // Adding relation for XParameters ifc test
        Vector params = new Vector();


        /*****  statement parameter types and their initial
                values must be added here as relation. */
        params.add(new String("SAU99")) ;
        params.add(new Boolean(false)) ;
        params.add(new Byte((byte) 123)) ;
        params.add(new Short((short) 234)) ;
        params.add(new Integer(12345)) ;
        params.add(new Long(23456)) ;
        params.add(new Float(1.234)) ;
        params.add(new Double(2.345)) ;
        params.add(new byte[] {1, 2, 3}) ;
        Date d = new Date();
        d.Day = 26; d.Month = 1; d.Year = 2001;
        params.add(d) ;
        Time t = new Time();
        t.Hours = 1; t.HundredthSeconds = 12; t.Minutes = 25; t.Seconds = 14;
        params.add(t) ;
        DateTime dt = new DateTime();
        dt.Day = 26; dt.Month = 1; dt.Year = 2001; dt.Hours = 1;
        dt.HundredthSeconds = 12; dt.Minutes = 25; dt.Seconds = 14;
        params.add(dt) ;
        tEnv.addObjRelation("XParameters.ParamValues", params);

        // Adding relation for XCompletedExecution
        tEnv.addObjRelation("InteractionHandlerChecker", new InteractionHandlerImpl());
       
        // Adding for XWarningSupplier
        tEnv.addObjRelation("CheckWarningsSupplier", new Boolean(isMySQLDB));

        // Adding relation for XDatabaseParameterBroadcaster
        tEnv.addObjRelation("ParameterListenerChecker", new ODatabaseForm.ParameterListenerImpl());  
        XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface
            (XPropertySet.class, oObj) ;
        try {
            xSetProp.setPropertyValue("DataSourceName", dbSourceName) ;
            if(isMySQLDB) {
                xSetProp.setPropertyValue("Command", "SELECT Column0  FROM soffice_test_table  WHERE ( (  Column0 = :param1 ) )");
            }
            else {
                xSetProp.setPropertyValue("Command", "SELECT \"_TEXT\" FROM \"ODatabaseForm_tmp0\" WHERE ( ( \"_TEXT\" = :param1 ) )");
            }
               
            xSetProp.setPropertyValue("CommandType",
                new Integer(CommandType.COMMAND)) ;
        }
        catch(Exception e) {
        }

        // Adding relation for XResultSetUpdate
        final XRowUpdate xRowUpdate = (XRowUpdate) UnoRuntime.queryInterface(
                                              XRowUpdate.class, oObj);
        final XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oObj);

        tEnv.addObjRelation("XResultSetUpdate.UpdateTester",
                            new ifc.sdbc._XResultSetUpdate.UpdateTester() {
            String lastUpdate = null;

            public int rowCount() throws SQLException {
                int prevPos = xResSet.getRow();
                xResSet.last();

                int count = xResSet.getRow();
                xResSet.absolute(prevPos);

                return count;
            }

            public void update() throws SQLException {
                lastUpdate = xRow.getString(1);
                lastUpdate += "_";
                xRowUpdate.updateString(1, lastUpdate);
            }

            public boolean wasUpdated() throws SQLException {
                String getStr = xRow.getString(1);

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.