示例#1
0
int   LG::Main (int na, char** arg) /* Display program information. */
{
		if (Start (na, arg)) 
		{
			if (Parse())
			{
				if (CheckGrammar())
				{
					if (BuildStates())
					{
						int rc;
						rc  = AddExtra();
						rc += ComputeLA();
						PrintStates (1);
						if (rc == 2)
						{
							if (OptimizeStates())
							{
								PrintStates (2);
								if (!optn[LG_ANALYZEONLY])
								{
									CreateTables();
									LG::Terminate (1);
									return 1;
								}
							}
						}
					}
				}
			}
		}
		LG::Terminate (0);
		return 0;
}
示例#2
0
SmpLibDatabase::SmpLibDatabase(QString dbPath, QString Engine)
{
    static QMap<QString, QString> DbEngines;
    DbEngines["1"] = "QSQLITE";
    DbEngines["0"] = "QMYSQL";

    if(Engine=="0")//QMYSQL
    {
        QString strThread = QString("%1").arg((long)QThread::currentThread());
        db = QSqlDatabase::addDatabase(DbEngines[Engine],strThread);
        db.setDatabaseName("smplib");
        db.setUserName("smplib");
        db.setPassword("smplib");
        db.open();
        //prepare database if first run
        CreateTables(false);/*if not exist*/
    }
    else if(Engine=="1")//QSQLITE
    {
        QString strThread = QString("%1").arg((long)QThread::currentThread());
        db = QSqlDatabase::addDatabase(DbEngines[Engine],strThread);
        db.setDatabaseName(dbPath);
        db.setUserName("smplib");
        db.setPassword("smplib");
        db.open();
        //prepare database if first run
        CreateTablesSqlite(false);/*if not exist*/
    }    
}
示例#3
0
int   PG::Main (int na, char** arg)
{
      if (Start (na, arg))
		{
			PGParser::initialize (optn[MAX_SYM]);
			if (PGParser::parse (input_start) > 0)
			{
				PrintGrammar();
				PrintHtml();
				if (CheckGrammar())
				{
					OutputLexicalSymbols();
					if (BuildLR1())  
					{
						if (ComputeLA())
						{
							if (OptimizeStates())
							{
								PrintStates();
								CreateTables();
								PG::Terminate (0);
								return 1;
							} 
						}
			      }
				}
			}
		}
		return 0;
}
示例#4
0
static void Initialize( struct state *st )
{
	XGCValues gcValues;
	XWindowAttributes XWinAttribs;
	/*int iBitsPerPixel;*/

	/* Create the Image for drawing */
	XGetWindowAttributes( st->dpy, st->window, &XWinAttribs );

#if 0
  /* Find the preferred bits-per-pixel. (jwz) */
	{
		int i, pfvc = 0;
		XPixmapFormatValues *pfv = XListPixmapFormats( st->dpy, &pfvc );
		for( i=0; i<pfvc; i++ )
			if( pfv[ i ].depth == XWinAttribs.depth )
			{
				iBitsPerPixel = pfv[ i ].bits_per_pixel;
				break;
			}
		if( pfv )
			XFree (pfv);
	}
#endif

	/*  Create the GC. */
	st->gc = XCreateGC( st->dpy, st->window, 0, &gcValues );

	st->pImage = XCreateImage( st->dpy, XWinAttribs.visual, XWinAttribs.depth, ZPixmap, 0, NULL,
							  XWinAttribs.width, XWinAttribs.height, 8 /*BitmapPad( st->dpy )*/, 0 );
	st->pImage->data = calloc((st->pImage)->bytes_per_line, (st->pImage)->height);

	st->iWinWidth = XWinAttribs.width;
	st->iWinHeight = XWinAttribs.height;

	/*  These are precalculations used in Execute(). */
	st->iBobDiameter = ( ( st->iWinWidth < st->iWinHeight ) ? st->iWinWidth : st->iWinHeight ) / 25;
	st->iBobRadius = st->iBobDiameter / 2;
#ifdef VERBOSE
	printf( "%s: Bob Diameter = %d\n", progname, st->iBobDiameter );
#endif

	st->iWinCenterX = ( XWinAttribs.width / 2 ) - st->iBobRadius;
	st->iWinCenterY = ( XWinAttribs.height / 2 ) - st->iBobRadius;

	st->iVelocity = ( ( st->iWinWidth < st->iWinHeight ) ? st->iWinWidth : st->iWinHeight ) / 150;
	
	/*  Create the Sin and Cosine lookup tables. */
	st->iDegreeCount = get_integer_resource(st->dpy,  "degrees", "Integer" );
	if(      st->iDegreeCount == 0   ) st->iDegreeCount = ( XWinAttribs.width / 6 ) + 400;
	else if( st->iDegreeCount < 90   ) st->iDegreeCount = 90;
	else if( st->iDegreeCount > 5400 ) st->iDegreeCount = 5400;
	CreateTables( st, st->iDegreeCount );
#ifdef VERBOSE
	printf( "%s: Using a %d degree circle.\n", progname, st->iDegreeCount );
#endif /* VERBOSE */
  
	/*  Get the base color. */
	st->sColor = get_string_resource(st->dpy,  "color", "Color" );
}
示例#5
0
文件: Test.cpp 项目: 6e6f36/DarunGrim
	void TestOneIDAClientManagerDB()
	{
		DBWrapper InputDB(Filename);
		CreateTables(InputDB);
		OneIDAClientManager *pOneClientManagerTheTarget=new OneIDAClientManager();
		//pOneClientManagerTheTarget->Retrieve(InputDB);
		InputDB.CloseDatabase();
	}
示例#6
0
文件: Test.cpp 项目: 6e6f36/DarunGrim
	void TestReadingDiffMachineDB()
	{
		DBWrapper InputDB(Filename);
		CreateTables(InputDB);
		DiffMachine *pDiffMachine=new DiffMachine();
		pDiffMachine->Retrieve(InputDB);
		InputDB.CloseDatabase();
	}
示例#7
0
	void ODThumbInfo::InitDB(const std::string& databaseDir )
	{
		mDatabasePath = databaseDir + "/thumb.cache";
		int err_code = sqlite3_open_v2(mDatabasePath.c_str(), &mDBHandle,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_FULLMUTEX,NULL);
		if (err_code != SQLITE_OK)
		{
			std::string err = sqlite3_errmsg(mDBHandle);
			sqlite3_close(mDBHandle);
            return;
		}
        
       CreateTables();
	}
示例#8
0
///////////////////////////////////////////////////////////////
//
// CMemStats::Draw
//
//
//
///////////////////////////////////////////////////////////////
void CMemStats::Draw ( void )
{
    if ( !m_bEnabled )
        return;

    UpdateFrameStats ();

    // Time to update?
    if ( m_UpdateTimer.Get () > 2000 )
    {
        m_UpdateTimer.Reset ();
        UpdateIntervalStats ();
        CreateTables ();
    }

    float fResWidth = static_cast < float > ( g_pGraphics->GetViewportWidth () );
    float fResHeight = static_cast < float > ( g_pGraphics->GetViewportHeight () );
    float fTotalHeight = 0;

    // Draw tables
    if ( !m_TableList.empty () )
    {

        float fX = fResWidth - m_TableList.front ().GetPixelWidth () - 15;
        float fY = 200 - m_fPosY;

        for ( std::list < CDxTable >::iterator iter = m_TableList.begin () ; iter != m_TableList.end () ; ++iter )
        {
            CDxTable& table = *iter;
            table.Draw ( fX, fY, 0x78000000, 10, 10, 8, 8 );
            float fHeight = table.GetPixelHeight () + 20;
            fY += fHeight;
            fTotalHeight += fHeight;
        }
    }

    // Handle scrolling
    bool bHoldingPageUp = ( GetAsyncKeyState ( VK_PRIOR ) & 0x8000 ) != 0;
    bool bHoldingPageDown = ( GetAsyncKeyState ( VK_NEXT ) & 0x8000 ) != 0;

    if ( bHoldingPageUp )
    {
        m_fPosY = std::max ( 0.f, m_fPosY - 10 );
    }
    if ( bHoldingPageDown )
    {
        float fScrollHeight = fTotalHeight - ( fResHeight - 200 );
        if ( fScrollHeight > 0 )
            m_fPosY = std::min ( fScrollHeight, m_fPosY + 10 );
    }
}
示例#9
0
///////////////////////////////////////////////////////////////
//
// CMemStats::SetEnabled
//
//
//
///////////////////////////////////////////////////////////////
void CMemStats::SetEnabled ( bool bEnabled )
{
    if ( m_bEnabled != bEnabled )
    {
        m_bEnabled = bEnabled;
        // Clear accumulated changes for first display
        if ( m_bEnabled )
        {
            UpdateIntervalStats ();
            UpdateIntervalStats ();
            CreateTables ();
        }
    }
}
示例#10
0
文件: Test.cpp 项目: 6e6f36/DarunGrim
	void TestReadFunctionMembers()
	{
		DBWrapper InputDB(Filename);
		CreateTables(InputDB);
		//OneIDAClientManager *pOneClientManagerTheTarget=new OneIDAClientManager();
		//pOneClientManagerTheTarget->Retrieve(InputDB);
		multimap <DWORD,DWORD> *FunctionMembersMapForTheSource=LoadFunctionMembersMap(InputDB,1);
		hash_map <DWORD,DWORD> *AddressToFunctionMapForTheTarget=LoadAddressToFunctionMap(InputDB,2);
		FunctionMembersMapForTheSource->clear();
		delete FunctionMembersMapForTheSource;
		AddressToFunctionMapForTheTarget->clear();
		delete AddressToFunctionMapForTheTarget;
		InputDB.CloseDatabase();
	}
示例#11
0
int BRCWriter::DBOpen(char *name)
{
    int rv = false;
    unlink(name);
    if (sqlite3_open_v2(name, &dbPointer,SQLITE_OPEN_READWRITE, nullptr) == SQLITE_OK)
    {
#ifdef TEST
        printf("checkdb...");
#endif
        rv = CheckDb();
        if (!rv || !SQLiteExec(deletion))
        {
            sqlite3_close(dbPointer);
            unlink(name);
            goto doCreate;
        }
    }
    else 
    {
        if (dbPointer)
            sqlite3_close(dbPointer);
doCreate:
        dbPointer = nullptr;
        if (sqlite3_open_v2(name, &dbPointer, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr) == SQLITE_OK)
        {
#ifdef TEST
            printf("createdb...");
#endif
            rv = CreateTables();
        }
        else
        {
#ifdef TEST
            printf("open...");
#endif
        }
    }
    if (rv)
        sqlite3_busy_timeout(dbPointer, 800);
    return rv;
}
示例#12
0
QSqlError DataLayer::initdbcon()
{
    qDebug() << QSqlDatabase::drivers();

    selfdb = QSqlDatabase::addDatabase("QSQLITE");
    selfdb.setDatabaseName("../database/transdb.db3");

    /*
    selfdb = QSqlDatabase::addDatabase("SQLITECIPHER");
    selfdb.setDatabaseName("transdb.db3");
    selfdb.setPassword("12345");
    if (QFile("transdb.db").exists()) {
      dbFileExists_ = true;
    }
    if(dbFileExists_)
     {
        selfdb.setConnectOptions("OPEN_WITH_KEY");
        qDebug() << "dbFileExists_ is true";
     }
      else
         {
             selfdb.setConnectOptions("QSQLITE_CREATE_KEY");// only for first time usage
             qDebug() << "dbFileExists_ is false";
         }
*/
    if(!selfdb.open()){
        qDebug() << "Can not open connection.";
        //exit(CONNECTION_FAILED);
        return selfdb.lastError();
    }

    CreateTables();


 /*   query.exec("select id, name from mapping");
    while (query.next()) {
        qDebug() << query.value(0).toInt() << ": " << query.value(1).toString();
    }*/
    return QSqlError();
}
示例#13
0
 void Schema::Initialize()
 {
     CreateTables();
 }
示例#14
0
void DboInstaller::Install()
{
	CreateTables();
	InsertRows();
}
示例#15
0
文件: main.cpp 项目: chyla/pat-lms
int
main(int argc, char *argv[]) {
  program_options::Parser p;
  program_options::type::Options options;
  bash::dbus::object::BashPtr bash_object;
  apache::dbus::object::ApachePtr apache_object;
  database::SQLiteWrapperPtr sqlite_wrapper;
  database::DatabasePtr database;
  database::GeneralDatabaseFunctionsPtr general_database_functions;
  apache::database::DatabaseFunctionsPtr apache_database_functions;

  try {
    p.SetCommandLineOptions(argc, argv);
    p.SetConfigFilePath(SYSCONFFILE);
    options = p.Parse();

    if (options.IsShowHelpMessage()) {
      std::cout << "Usage: " << argv[0] << " " << "[options]\n";
      std::cout << p.GetHelpMessage() << '\n';
      return 0;
    }
  }
  catch (interface::Exception &ex) {
    std::cerr << "Error: Wrong option: " << ex.what() << '\n';
    return 1;
  }
  catch (std::exception &ex) {
    std::cerr << "Error: Missing or wrong program option.\n";
    std::cerr << "Error detail: " << ex.what() << "\n\n";
    std::cout << "Usage: " << argv[0] << " " << "[options]\n";
    std::cerr << p.GetHelpMessage() << "\n";
    return 1;
  }

  try {
    util::ConfigureLogger(options.GetLogfilePath(), options.IsDebug());
  }
  catch (std::exception &ex) {
    std::cerr << "Error: Can't configure logger: " << ex.what() << '\n';
    return 1;
  }

  try {
    BOOST_LOG_TRIVIAL(info) << "SLAS Server";
#ifdef HAVE_CONFIG_H
    BOOST_LOG_TRIVIAL(info) << "Version: " << VERSION;
#endif

    util::Demonize(options.IsDaemon());

    sqlite_wrapper = database::SQLiteWrapper::Create();
    sqlite_wrapper->Open(options.GetDatabasefilePath());
    database = CreateDatabase(sqlite_wrapper);
    general_database_functions = database::GeneralDatabaseFunctions::Create(database,
                                                                            sqlite_wrapper);
    general_database_functions->CreateTables();
    apache_database_functions = apache::database::DatabaseFunctions::Create(database,
                                                                            sqlite_wrapper,
                                                                            general_database_functions);
    apache_database_functions->CreateTables();

    auto options_command_object = program_options::web::CommandExecutorObject::Create(options);
    auto command_executor = web::CommandExecutor::Create();
    auto apache_web_command_executor = apache::web::CommandExecutorObject::Create(database,
                                                                                  general_database_functions,
                                                                                  apache_database_functions);
    command_executor->RegisterCommandObject(options_command_object);
    command_executor->RegisterCommandObject(apache_web_command_executor);
    command_receiver = web::CommandReceiver::Create(command_executor);
    command_receiver->OpenPort(options.GetWebAddress(), options.GetWebPort());

    bus = std::make_shared<dbus::Bus>(dbus::Bus::Options(options.GetDbusAddress(),
                                                         options.GetDbusPort(),
                                                         options.GetDbusFamily()));
    bus->Connect();
    bus->RequestConnectionName("org.chyla.slas.server");

    auto bash_database_functions = ::bash::database::DatabaseFunctions::Create(sqlite_wrapper,
                                                                               general_database_functions);
    bash_database_functions->CreateTables();

    auto bash_scripts = ::bash::domain::Scripts::Create(bash_database_functions,
                                                        general_database_functions);

    auto bash_web_scripts = ::bash::domain::WebScripts::Create(bash_scripts);

    auto bash_web_command_executor = bash::web::CommandExecutorObject::Create(bash_web_scripts);
    command_executor->RegisterCommandObject(bash_web_command_executor);

    bash_object = std::make_shared<bash::dbus::object::Bash>(bash_scripts);
    bus->RegisterObject(bash_object);

    apache_object = std::make_shared<apache::dbus::object::Apache>(database, general_database_functions, apache_database_functions);
    bus->RegisterObject(apache_object);

    util::CreatePidFile(options.GetPidfilePath());

    memset(&act, '\0', sizeof (act));
    act.sa_sigaction = exit_signal_handler;
    act.sa_flags = SA_SIGINFO;
    sigaction(SIGTERM, &act, nullptr);
    sigaction(SIGINT, &act, nullptr);
    sigaction(SIGKILL, &act, nullptr);
    sigaction(SIGQUIT, &act, nullptr);

    memset(&act, '\0', sizeof (act_usr));
    act_usr.sa_sigaction = analyze_signal_handler;
    act_usr.sa_flags = SA_SIGINFO;
    sigaction(SIGUSR1, &act_usr, nullptr);

    notifier_worker = notifier::Notifier::Create(options);
    notifier_thread = std::thread([]() {
      notifier_worker->Loop();
    });

    analyzer_worker = analyzer::Analyzer::Create();
    analyzer_worker->AddObject(apache::analyzer::ApacheAnalyzerObject::Create(general_database_functions,
                                                                              apache_database_functions,
                                                                              notifier_worker));

    analyzer_worker->AddObject(bash::analyzer::BashAnalyzerObject::Create(bash_database_functions,
                                                                          general_database_functions,
                                                                          bash_scripts,
                                                                          options.GetNeuralNetworkDataDirectory()));

    analyzer_thread = std::thread([]() {
      analyzer_worker->StartLoop();
    });

    command_receiver_thread = std::thread([]() {
      command_receiver->StartListen();
    });

    bus->Loop();
  }
  catch (std::exception &ex) {
    BOOST_LOG_TRIVIAL(fatal) << ex.what();
    return 1;
  }

  try {
    if (analyzer_worker)
      analyzer_worker->StopLoop();

    if (notifier_worker)
      notifier_worker->StopLoop();

    if (command_receiver)
      command_receiver->StopListen();

    if (bus)
      bus->Disconnect();

    if (sqlite_wrapper)
      sqlite_wrapper->Close();

    if (analyzer_thread.joinable())
      analyzer_thread.join();

    if (notifier_thread.joinable())
      notifier_thread.join();

    if (command_receiver_thread.joinable())
      command_receiver_thread.join();

    if (command_receiver)
      command_receiver->ClosePort();

    util::RemoveFile(options.GetPidfilePath());
  }
  catch (std::exception &ex) {
    BOOST_LOG_TRIVIAL(fatal) << ex.what();
    return 1;
  }

  return 0;
}
void FdoSpatialContextTest::DoTest( bool hasMetaSchema )
{
    FdoPtr<FdoIConnection> connection;
    StaticConnection* staticConn = NULL;

    try {
        if ( !hasMetaSchema ) {
            staticConn = UnitTestUtil::NewStaticConnection();
            staticConn->connect();
            UnitTestUtil::CreateDBNoMeta( 
                staticConn->CreateSchemaManager(),
                UnitTestUtil::GetEnviron("datastore", DB_NAME_SUFFIX)
            );
        }


        // delete, re-create and open the datastore
		printf( "Initializing Connection ... \n" );
		connection = UnitTestUtil::CreateConnection(
			hasMetaSchema,
			hasMetaSchema,
            DB_NAME_SUFFIX,
            0,
            NULL,
            0
		);

		printf( "Creating Spatial Contexts ... \n" );

        UnitTestUtil::CreateSpatialContext( connection, L"Bermuda", L"Bermuda 1957", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Rectangular", L"", 0, 0, 1000, 1000 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Bermuda Duplicate", L"Bermuda 1957", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Luxembourg Delete", L"Luxembourg 1930", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"South", L"Australian Antarctic", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"sc_2", L"Puerto Rico", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"South Delete", L"Australian Antarctic", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"sc_1", L"NAD27", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"South Duplicate", L"Australian Antarctic", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Liberia by WKT", L"", 0, 0, 10, 10, L"GEOGCS[\"Liberia 1964\", DATUM[\"Liberia 1964\", ELLIPSOID[\"Clarke 1880 (RGS)\", 6378249.145, 293.465]], PRIMEM[\"Greenwich\", 0], UNIT[\"Degree\", 0.0174532925199433]]" ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Qatar wrong name", L"Bermuda 1957", 0, 0, 10, 10, L"GEOGCS[\"Qatar 1974\", DATUM[\"Qatar 1974\", ELLIPSOID[\"International 1924\", 6378388, 297]], PRIMEM[\"Greenwich\", 0], UNIT[\"Degree\", 0.0174532925199433]]" ); 
        UnitTestUtil::CreateSpatialContext( connection, L"California", L"CA-I", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Bermuda Mentor", L"Bermuda.LL", 0, 0, 10, 10 ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Mentor by WKT", L"", 0, 0, 10, 10, L"PROJCS[\"Quebec test\",GEOGCS[\"For testing only\",DATUM[\"Test\",SPHEROID[\"NAD 27\",6300000,123.465,]]]]" ); 
        UnitTestUtil::CreateSpatialContext( connection, L"Rectangular (Metre)", L"XY-M", 0, 0, 10, 10); 
        UnitTestUtil::CreateSpatialContext( connection, L"Rectangular (Feet)", L"XY-FT", 0, 0, 10, 10); 

        connection->Close();
        connection->Open();

		printf( "Deleting Spatial Contexts ... \n" );

        UnitTestUtil::DeleteSpatialContext( connection, L"Luxembourg Delete" );
        UnitTestUtil::DeleteSpatialContext( connection, L"South Delete" );

        connection->Close();
        connection->Open();

        CreateSchema( connection, hasMetaSchema );

		printf( "Writing output ... \n" );

        FdoStringP datastore = UnitTestUtil::GetEnviron("datastore", DB_NAME_SUFFIX);

        FdoIoMemoryStreamP stream1 = FdoIoMemoryStream::Create();

        FdoXmlSpatialContextFlagsP flags = FdoXmlSpatialContextFlags::Create(
            L"fdo.osgeo.org/schemas/feature",
            FdoXmlFlags::ErrorLevel_Normal,
            true,
            FdoXmlSpatialContextFlags::ConflictOption_Add,
            true
        );

        UnitTestUtil::ExportDb( 
            connection, 
            stream1, 
            flags,
            false, 
            FdoStringP(L"Fdo") + datastore
        );

   		UnitTestUtil::Config2SortedFile( stream1, UnitTestUtil::GetOutputFileName( GenFileName(1, hasMetaSchema, false) ) );

        UnitTestUtil::CheckOutput( 
            GenFileName( 1, hasMetaSchema, true ),
            UnitTestUtil::GetOutputFileName( GenFileName(1, hasMetaSchema, false) )
        );

        InsertFeatures( connection );

        stream1 = FdoIoMemoryStream::Create();

        UnitTestUtil::ExportDb( 
            connection, 
            stream1, 
            flags,
            false, 
            FdoStringP(L"Fdo") + datastore,
            L"AutoGen",
            true
        );

   		UnitTestUtil::Config2SortedFile( stream1, UnitTestUtil::GetOutputFileName( GenFileName(2, hasMetaSchema, false) ) );

        UnitTestUtil::CheckOutput( 
            GenFileName( 2, hasMetaSchema, true ),
            UnitTestUtil::GetOutputFileName( GenFileName(2, hasMetaSchema, false) )
        );

        if ( !hasMetaSchema ) {
            CreateTables( staticConn, datastore );

            connection->Close();
            connection->Open();

            stream1 = FdoIoMemoryStream::Create();

            UnitTestUtil::ExportDb( 
                connection, 
                stream1, 
                flags,
                false, 
                FdoStringP(L"Fdo") + datastore,
                L"AutoGen",
                true
            );

   		    UnitTestUtil::Config2SortedFile( stream1, UnitTestUtil::GetOutputFileName( GenFileName(3, hasMetaSchema, false) ) );

            UnitTestUtil::CheckOutput( 
                GenFileName( 3, hasMetaSchema, true ),
                UnitTestUtil::GetOutputFileName( GenFileName(3, hasMetaSchema, false) )
            );


            try {
                UnitTestUtil::CreateSpatialContext( connection, L"Nowhere", L"JunkCS", 0, 0, 10, 10 ); 
                CPPUNIT_FAIL( "Setting unsupported coordinate system by name supposed to fail" );
            }
            catch (FdoException* e ) {
#ifdef _WIN32
#ifdef _DEBUG
                FdoStringP expectedMessage = L" Error creating spatial context Nowhere, coordinate system JunkCS is not in current datastore. ";
                FdoString* pMessage = wcschr( e->GetExceptionMessage(), ')' );
                if (pMessage) pMessage++;
#else
                FdoStringP expectedMessage = L"Error creating spatial context Nowhere, coordinate system JunkCS is not in current datastore. ";
                FdoString* pMessage = e->GetExceptionMessage();
#endif
                CPPUNIT_ASSERT( pMessage && expectedMessage.ICompare(pMessage) == 0 );
#endif
                FDO_SAFE_RELEASE(e);
            }

            try {
                UnitTestUtil::CreateSpatialContext( connection, L"California2", L"", 0, 0, 10, 10, L"PROJCS[\"CA-I\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",60.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"false_easting\",2000000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"central_meridian\",-122.00000000000000],PARAMETER[\"latitude_of_origin\",39.33333333333333],PARAMETER[\"standard_parallel_1\",41.66666666666666],PARAMETER[\"standard_parallel_2\",40.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]" ); 
                CPPUNIT_FAIL( "Setting unsupported coordinate system by wkt supposed to fail" );
            }
            catch (FdoException* e ) {
#ifdef _WIN32
#ifdef _DEBUG
                FdoStringP expectedMessage = L" Error creating spatial context California2, coordinate system catalog does not contain entry for WKT 'PROJCS[\"CA-I\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",60.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"false_easting\",2000000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"central_meridian\",-122.00000000000000],PARAMETER[\"latitude_of_origin\",39.33333333333333],PARAMETER[\"standard_parallel_1\",41.66666666666666],PARAMETER[\"standard_parallel_2\",40.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]' ";
                FdoString* pMessage = wcschr( e->GetExceptionMessage(), ')' );
                if (pMessage) pMessage++;
#else
                FdoStringP expectedMessage = L"Error creating spatial context California2, coordinate system catalog does not contain entry for WKT 'PROJCS[\"CA-I\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",60.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"false_easting\",2000000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"central_meridian\",-122.00000000000000],PARAMETER[\"latitude_of_origin\",39.33333333333333],PARAMETER[\"standard_parallel_1\",41.66666666666666],PARAMETER[\"standard_parallel_2\",40.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]' ";
                FdoString* pMessage = e->GetExceptionMessage();
#endif
                CPPUNIT_ASSERT( pMessage && expectedMessage.ICompare(pMessage) == 0 );
#endif
                FDO_SAFE_RELEASE(e);
            }
        }
        else {
            UnitTestUtil::CreateSpatialContext( connection, L"Nowhere", L"JunkCS", 0, 0, 10, 10 ); 
            UnitTestUtil::CreateSpatialContext( connection, L"California2", L"CA_I", 0, 0, 10, 10, L"PROJCS[\"CA-I\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",60.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"false_easting\",2000000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"central_meridian\",-122.00000000000000],PARAMETER[\"latitude_of_origin\",39.33333333333333],PARAMETER[\"standard_parallel_1\",41.66666666666666],PARAMETER[\"standard_parallel_2\",40.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]" ); 

            stream1 = FdoIoMemoryStream::Create();
            UnitTestUtil::ExportDb( 
                connection, 
                stream1, 
                flags,
                false, 
                FdoStringP(L"Fdo") + datastore,
                L"AutoGen",
                true
            );

            UnitTestUtil::Config2SortedFile( stream1, UnitTestUtil::GetOutputFileName( GenFileName(3, hasMetaSchema, false) ) );

            UnitTestUtil::CheckOutput( 
                GenFileName( 3, hasMetaSchema, true ),
                UnitTestUtil::GetOutputFileName( GenFileName(3, hasMetaSchema, false) )
            );

        }

        delete staticConn;
        connection->Close();
    }
    catch ( ... )
    {
        try {
            if ( staticConn ) delete staticConn;
            if ( connection ) connection->Close();
        }
        catch ( ... ) {
        }

        throw;
    }
}