Checking, if a Database exists
    Ruslan Zasukhin 
    sunshine at public.kherson.ua
       
    Thu Nov 20 04:23:04 CST 2008
    
    
  
On 11/20/08 12:21 PM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:
Another our test
void Test_I_Database_CreateAfterOpen( void ) throw()
{
    TEST_LEVEL_NAME_INIT( "Test_I_Database_CreateAfterOpen" );
    I_Database_Ptr db = FBL::CreateDatabase();
    // assign location
    I_Location_Ptr pLoc = CreateDiskLocation( "test_db.vdb" );
    db->put_Location( pLoc );
    // We must get Object of I_Database that not exists on device.
    DO_TEST_EQ( db->get_Exists(), false );
    try
    {
        try
        {
            db->Open();
        }
        catch( xException& Err )
        {
            if( Err.get_ErrorCode() == ERR_OS_FILE_NOT_FOUND )
            {
                db->Create();
                DO_TEST_EQ( db->get_Exists(), true );
            }
            else
            {
                 DO_TEST_EQ( Err.get_ErrorCode(), ERR_OS_FILE_NOT_FOUND );
            }
        }
        if( DoIt(1) ) Test_FBL_Exceptions_errors( db );
        if( DoIt(1) ) Test_I_Database_Empty( db );
        if( DoIt(1) ) Test_I_Database_Properties( db );
    }
    TEST_CATCH
    db->Close();
    db->ThrowOut();
}
-- 
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
    
    
More information about the Valentina
mailing list