Examples of HsqlDatabase


Examples of connectivity.tools.HsqlDatabase

    /* ------------------------------------------------------------------ */
    /** checks if master-detail relationships including multiple keys work
     */
    public void checkMultipleKeys() throws com.sun.star.uno.Exception, java.lang.Exception
    {
        HsqlDatabase databaseDocument = null;
        try
        {
            databaseDocument = new HsqlDatabase( m_orb );
            impl_createTableStructure( databaseDocument );
            impl_createForms( databaseDocument );

            m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID1", "ID2" } );
            m_detailForm.setPropertyValue( "DetailFields", new String[] { "FK_ID1", "FK_ID2" } );

            XLoadable loadMaster = UnoRuntime.queryInterface( XLoadable.class, m_masterForm );
            XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm );
            loadDetail.addLoadListener( this );

            // wait until the detail form is loaded
            operateMasterAndWaitForDetailForm( loadMaster.getClass().getMethod( "load", new Class[] {} ), loadMaster, new Object[] { } );

            // okay, now the master form should be on the first record
            assure( "wrong form state after loading (ID1)", m_masterResult.getInt(1) == 1 );
            assure( "wrong form state after loading (ID2)", m_masterResult.getInt(2) == 1 );
            assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) );

            // the "XResultSet.next" method
            Method methodNext = m_masterResult.getClass().getMethod( "next" , new Class[] {} );

            // the values in the linked fields should be identical
            int expectedDetailRowCounts[] = { 2, 1 };
            do
            {
                verifyColumnValueIdentity( "ID1", "FK_ID1" );
                verifyColumnValueIdentity( "ID2", "FK_ID2" );

                m_detailResult.last();
                int masterPos = m_masterResult.getRow();
                assure( "wrong number of records in detail form, for master form at pos " + masterPos,
                        ((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] );

                operateMasterAndWaitForDetailForm( methodNext, m_masterResult, new Object[] {} );
            }
            while ( !m_masterResult.isAfterLast() );
            assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() );
        }
        finally
        {
            if ( databaseDocument != null )
                databaseDocument.closeAndDelete();
            impl_cleanUpStep();
        }
    }
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

    /* ------------------------------------------------------------------ */
    private void impl_createDatabase() throws java.lang.Exception
    {
        try
        {
            m_database = new HsqlDatabase( m_orb );
            Connection connection = m_database.defaultConnection();
            System.out.println( m_database.getDocumentURL() );

            final String[][] fieldDefinitions = impl_getFieldTypeDefinitions();
            final String[] keyTypes = fieldDefinitions[0];
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

    public void test(){
        XDataSource ds = null;
        System.gc();
        try {
            HsqlDatabase database = new HsqlDatabase( (XMultiServiceFactory)param.getMSF() );
            ds = database.getDataSource().getXDataSource();
        } catch(Exception ex) {
            throw new RuntimeException("factory: unable to construct data source" );
        }
       
        try{
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

     */
    public CRMDatabase( XMultiServiceFactory _orb ) throws Exception
    {
        m_orb = _orb;

        m_database = new HsqlDatabase( m_orb );
        m_dataSource = m_database.getDataSource();
        m_connection = m_database.defaultConnection();
        createTables();
        createQueries();
    }
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

        // close previous database document
        impl_closeDocument();

        // create/load the new database document
        m_database = (_documentURL == null)
                ? new HsqlDatabase(getORB())
                : new HsqlDatabase(getORB(), _documentURL);
        m_databaseDocument = m_database.getDatabaseDocument();

        // load it into a frame
        final Object object = getORB().createInstance("com.sun.star.frame.Desktop");
        final XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, object);
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

        // revoke the data source, if it previously existed
        if ( databaseContext.hasByName( m_dataSourceName ) )
            namingService.revokeObject( m_dataSourceName );

        // // create a new ODB file, and register it with its URL
        m_databaseDocument = new HsqlDatabase( m_orb );
        String documentURL = m_databaseDocument.getDocumentURL();
        namingService.registerObject( m_dataSourceName, databaseContext.getByName( documentURL ) );

        m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class,
            databaseContext.getByName( m_dataSourceName ) );
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

        // close previous database document
        impl_closeDocument();

        // create/load the new database document
        m_database = ( _documentURL == null )
                ?   new HsqlDatabase( getORB() )
                :   new HsqlDatabase( getORB(), _documentURL );
        m_databaseDocument = m_database.getDatabaseDocument();

        // load it into a frame
        Object object = getORB().createInstance( "com.sun.star.frame.Desktop" );
        XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, object );
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

     */
    public CRMDatabase( XMultiServiceFactory _orb ) throws Exception
    {
        m_orb = _orb;

        m_database = new HsqlDatabase( m_orb );
        m_dataSource = m_database.getDataSource();
        m_connection = m_database.defaultConnection();
        createTables();
        createQueries();
    }
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

     */
    public CRMDatabase( XMultiServiceFactory _orb ) throws Exception
    {
        m_orb = _orb;

        m_database = new HsqlDatabase( m_orb );
        m_dataSource = m_database.getDataSource();
        m_connection = m_database.defaultConnection();
        createTables();
        createQueries();
    }
View Full Code Here

Examples of connectivity.tools.HsqlDatabase

        // revoke the data source, if it previously existed
        if ( databaseContext.hasByName( m_dataSourceName ) )
            namingService.revokeObject( m_dataSourceName );

        // // create a new ODB file, and register it with its URL
        m_databaseDocument = new HsqlDatabase( m_orb );
        String documentURL = m_databaseDocument.getDocumentURL();
        namingService.registerObject( m_dataSourceName, databaseContext.getByName( documentURL ) );

        m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class,
            databaseContext.getByName( m_dataSourceName ) );
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.