Examples of XResultSet


Examples of com.sun.star.sdbc.XResultSet

                throw new StatusException("couldn't convert Any",iae);
            }

            oInterface = oRowSet ;

            XResultSet xRes = (XResultSet) UnoRuntime.queryInterface
                (XResultSet.class, oRowSet) ;

            xRes.first() ;

            if (oInterface == null) {
                log.println("Service wasn't created") ;
                throw new StatusException("Service wasn't created",
                    new NullPointerException()) ;
            }

            oObj = (XInterface) oInterface;

            log.println( "    creating a new environment for object" );
            TestEnvironment tEnv = new TestEnvironment( oObj );

            // Adding relations for disposing object
            tEnv.addObjRelation("ORowSet.Connection", connection) ;
            this.conn = (XConnection) tEnv.getObjRelation("ORowSet.Connection");


            // Adding obj relation for XRowSetApproveBroadcaster test
            {
                final XResultSet xResSet = (XResultSet)
                    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) ;
                        }

                        public int currentRow() throws SQLException {
                            return xResSet.getRow() ;
                        }
                    }) ;
            }

            envCreatedOK = true ;
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

        return sColValues;
    }

    public String[] getCatalogNames(){
        try {
            XResultSet xResultSet = xDBMetaData.getCatalogs();
            return StringsFromResultSet(xResultSet, 1);
        } catch (SQLException e) {
            e.printStackTrace(System.out);
            return null;
        }
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

    }


    public String[] getSchemaNames(){
        try {
            XResultSet xResultSet = xDBMetaData.getSchemas();
            return StringsFromResultSet(xResultSet, 1);
        } catch (SQLException e) {
            e.printStackTrace(System.out);
            return null;
        }
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

        if (resSet == null) {
            log.println("!!! Method returned null !!!") ;
            result = false ;
        } else {
            try {
                XResultSet resSetS = resSet.getStaticResultSet() ;
                XResultSet resSetStubS = resSetStub.getStaticResultSet() ;

                resSetStubS.last() ;
                int stubRowNum = resSetStubS.getRow() ;

                resSetS.last() ;
                int setRowNum = resSetS.getRow() ;

                result = stubRowNum == setRowNum && setRowNum > 0 ;
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

    public void checkStatementQiQSupport()
    {
        try
        {
            XStatement statement = m_database.getConnection().createStatement();
            XResultSet resultSet = statement.executeQuery( "SELECT * FROM \"query products\"" );
        }
        catch( SQLException e )
        {
            assure( "SDB level statements do not allow for queries in queries", false );
        }
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

        XDynamicResultSet sortedSet = oObj.createSortedDynamicResultSet
            (dynResSet, new NumberedSortingInfo[0], null) ;

        int rowCount = -1 ;
        if (sortedSet != null) {
            XResultSet set = null ;
            try {
                set = sortedSet.getStaticResultSet() ;
            } catch (com.sun.star.ucb.ListenerAlreadySetException e) {
                e.printStackTrace(log);
            }

            try {
                set.last() ;
                rowCount = set.getRow();
                log.println("Number of rows in result set: " + rowCount);
            } catch (com.sun.star.sdbc.SQLException e) {
                log.println("Exception occured while accessing "+
                    "sorted result set :");
                e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

    xSet =
      (XDynamicResultSet) UnoRuntime.queryInterface(
        XDynamicResultSet.class,
        executeCommand(xContent, "open", aArg));

    XResultSet xResultSet = xSet.getStaticResultSet();

    List files = new Vector();

    if (xResultSet.first()) {
      // obtain XContentAccess interface for child content access and XRow for properties
      XContentAccess xContentAccess =
        (XContentAccess) UnoRuntime.queryInterface(
          XContentAccess.class,
          xResultSet);
      XRow xRow =
        (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
      do {
        // Obtain URL of child.
        String aId = xContentAccess.queryContentIdentifierString();
        // First column: Title (column numbers are 1-based!)
        String aTitle = xRow.getString(1);
        if (aTitle.length() == 0 && xRow.wasNull());
        //ignore
        else
          files.add(aTitle);
      } while (xResultSet.next()); // next child
    }

    if (verifier != null)
      for (int i = 0; i < files.size(); i++)
        if (!verifier.verify(files.get(i)))
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

    /**
     * Returns the string representation of content passed as parameter.
     */
    protected String getContentList(XContent content) {
        XResultSet statRes = getStatResultSet(content);
        String ret = "";
        try {
            statRes.first();
            XRow row = (XRow)UnoRuntime.queryInterface(XRow.class, statRes);
            while(! statRes.isAfterLast()) {
                ret += "\n    " + row.getString(1);
                statRes.next();
            }
        } catch (com.sun.star.sdbc.SQLException e) {
            log.println("Exception occured:" + e);
        }

View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

        return ret;
    }

    protected XResultSet getStatResultSet(XContent content) {
        XResultSet statResSet = null;
        try {
            statResSet = getDynaResultSet(content).getStaticResultSet();
        } catch(com.sun.star.ucb.ListenerAlreadySetException e) {
            log.println("Exception occured:" + e);
        }
View Full Code Here

Examples of com.sun.star.sdbc.XResultSet

        return DynResSet;
    }

    protected XContent getSubContent(XContent content, String subName) {
        XResultSet statRes = getStatResultSet(content);
        XRow row = (XRow)UnoRuntime.queryInterface(XRow.class, statRes);
        XContentAccess contAcc = (XContentAccess)
            UnoRuntime.queryInterface(XContentAccess.class, statRes);
        XContent subContent = null;
        try {
            statRes.first();
            while(!statRes.isAfterLast()) {
                if ( subName.equals(row.getString(1)) ) {
                    subContent = contAcc.queryContent();
                }
                statRes.next();
            }
        } catch(com.sun.star.sdbc.SQLException e) {
            log.println("Exception occured:" + e);
        }
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.