コード例 #1
0
        public bool removeDbTest(
			string	sDbName,
			DbSystem	dbSystem)
        {
            beginTest( "Remove Database Test (" + sDbName + ")");
            try
            {
                dbSystem.dbRemove( sDbName, null, null, true);
            }
            catch (XFlaimException ex)
            {
                endTest( false, ex, "removing database");
                return( false);
            }
            endTest( false, true);
            return( true);
        }
コード例 #2
0
        public bool createDbTest(
			string	sDbName,
			DbSystem	dbSystem)
        {
            Db			db = null;
            RCODE	rc;

            beginTest( "Create Database Test (" + sDbName + ")");

            for (;;)
            {
                rc = RCODE.NE_XFLM_OK;
                try
                {
                    XFLM_CREATE_OPTS	createOpts = new XFLM_CREATE_OPTS();

                    createOpts.uiBlockSize = 8192;
                    createOpts.uiVersionNum = (uint)DBVersions.XFLM_CURRENT_VERSION_NUM;
                    createOpts.uiMinRflFileSize = 2000000;
                    createOpts.uiMaxRflFileSize = 20000000;
                    createOpts.bKeepRflFiles = 1;
                    createOpts.bLogAbortedTransToRfl = 1;
                    createOpts.eDefaultLanguage = Languages.FLM_DE_LANG;
                    db = dbSystem.dbCreate( sDbName, null, null, null, null, createOpts);
                }
                catch (XFlaimException ex)
                {
                    rc = ex.getRCode();

                    if (rc != RCODE.NE_XFLM_FILE_EXISTS)
                    {
                        endTest( false, ex, "creating database");
                        return( false);
                    }
                }
                if (rc == RCODE.NE_XFLM_OK)
                {
                    break;
                }

                // rc better be NE_XFLM_FILE_EXISTS - try to delete the file

                try
                {
                    dbSystem.dbRemove( sDbName, null, null, true);
                }
                catch (XFlaimException ex)
                {
                    endTest( false, ex, "removing database");
                    return( false);
                }
            }
            if (db != null)
            {
                db.close();
                db = null;
            }
            endTest( false, true);
            return( true);
        }
コード例 #3
0
        public bool domNodesTest(
            string	sDbName,
            DbSystem	dbSystem)
        {
            bool	bOk = false;
            Db		db = null;
            bool	bStartedTrans = false;
            RCODE	rc;

            // Create the database

            beginTest( "Create database \"" + sDbName + "\"");

            for (;;)
            {
                rc = RCODE.NE_XFLM_OK;
                try
                {
                    XFLM_CREATE_OPTS	createOpts = new XFLM_CREATE_OPTS();

                    createOpts.uiBlockSize = 8192;
                    createOpts.uiVersionNum = (uint)DBVersions.XFLM_CURRENT_VERSION_NUM;
                    createOpts.uiMinRflFileSize = 2000000;
                    createOpts.uiMaxRflFileSize = 20000000;
                    createOpts.bKeepRflFiles = 1;
                    createOpts.bLogAbortedTransToRfl = 1;
                    createOpts.eDefaultLanguage = Languages.FLM_DE_LANG;
                    db = dbSystem.dbCreate( sDbName, null, null, null, null, createOpts);
                }
                catch (XFlaimException ex)
                {
                    rc = ex.getRCode();

                    if (rc != RCODE.NE_XFLM_FILE_EXISTS)
                    {
                        endTest( false, ex, "creating database");
                        return( false);
                    }
                }
                if (rc == RCODE.NE_XFLM_OK)
                {
                    break;
                }

                // rc better be NE_XFLM_FILE_EXISTS - try to delete the file

                try
                {
                    dbSystem.dbRemove( sDbName, null, null, true);
                }
                catch (XFlaimException ex)
                {
                    endTest( false, ex, "removing database");
                    return( false);
                }
            }
            endTest( false, true);

            // Start a transaction

            beginTest( "Start Update Transaction Test");
            try
            {
                db.transBegin( eDbTransType.XFLM_UPDATE_TRANS, 255, 0);
            }
            catch (XFlaimException ex)
            {
                endTest( false, ex, "starting update transaction");
                goto Exit;
            }
            endTest( false, true);
            bStartedTrans = true;

            // Create a document

            if (!createDocumentTest( db))
            {
                goto Exit;
            }

            // Commit the transaction

            beginTest( "Commit Update Transaction Test");
            try
            {
                bStartedTrans = false;
                db.transCommit();
            }
            catch (XFlaimException ex)
            {
                endTest( false, ex, "committing update transaction");
                goto Exit;
            }
            endTest( false, true);

            bOk = true;

            Exit:
            if (bStartedTrans)
            {
                db.transAbort();
            }
            if (db != null)
            {
                db.close();
                db = null;
            }
            return( bOk);
        }