@ -215,7 +215,7 @@ bool CDBEnv::Salvage(std::string strFile, bool fAggressive,
}
}
void CDBEnv : : CheckpointLSN ( std : : string strFile )
void CDBEnv : : CheckpointLSN ( const std : : string & strFile )
{
{
dbenv . txn_checkpoint ( 0 , 0 , 0 ) ;
dbenv . txn_checkpoint ( 0 , 0 , 0 ) ;
if ( fMockDb )
if ( fMockDb )
@ -224,12 +224,12 @@ void CDBEnv::CheckpointLSN(std::string strFile)
}
}
CDB : : CDB ( const char * pszFil e, const char * pszMode ) :
CDB : : CDB ( const std : : string & strFilenam e, const char * pszMode ) :
pdb ( NULL ) , activeTxn ( NULL )
pdb ( NULL ) , activeTxn ( NULL )
{
{
int ret ;
int ret ;
fReadOnly = ( ! strchr ( pszMode , ' + ' ) & & ! strchr ( pszMode , ' w ' ) ) ;
fReadOnly = ( ! strchr ( pszMode , ' + ' ) & & ! strchr ( pszMode , ' w ' ) ) ;
if ( pszFile = = NULL )
if ( strFilename . empty ( ) )
return ;
return ;
bool fCreate = strchr ( pszMode , ' c ' ) ! = NULL ;
bool fCreate = strchr ( pszMode , ' c ' ) ! = NULL ;
@ -242,7 +242,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
if ( ! bitdb . Open ( GetDataDir ( ) ) )
if ( ! bitdb . Open ( GetDataDir ( ) ) )
throw runtime_error ( " CDB : Failed to open database environment. " ) ;
throw runtime_error ( " CDB : Failed to open database environment. " ) ;
strFile = pszFil e;
strFile = strFilenam e;
+ + bitdb . mapFileUseCount [ strFile ] ;
+ + bitdb . mapFileUseCount [ strFile ] ;
pdb = bitdb . mapDb [ strFile ] ;
pdb = bitdb . mapDb [ strFile ] ;
if ( pdb = = NULL )
if ( pdb = = NULL )
@ -255,12 +255,12 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
DbMpoolFile * mpf = pdb - > get_mpf ( ) ;
DbMpoolFile * mpf = pdb - > get_mpf ( ) ;
ret = mpf - > set_flags ( DB_MPOOL_NOFILE , 1 ) ;
ret = mpf - > set_flags ( DB_MPOOL_NOFILE , 1 ) ;
if ( ret ! = 0 )
if ( ret ! = 0 )
throw runtime_error ( strprintf ( " CDB : Failed to configure for no temp file backing for database %s " , psz File) ) ;
throw runtime_error ( strprintf ( " CDB : Failed to configure for no temp file backing for database %s " , str File) ) ;
}
}
ret = pdb - > open ( NULL , // Txn pointer
ret = pdb - > open ( NULL , // Txn pointer
fMockDb ? NULL : pszFile , // Filename
fMockDb ? NULL : strFile . c_str ( ) , // Filename
fMockDb ? pszFile : " main " , // Logical db name
fMockDb ? strFile . c_str ( ) : " main " , // Logical db name
DB_BTREE , // Database type
DB_BTREE , // Database type
nFlags , // Flags
nFlags , // Flags
0 ) ;
0 ) ;
@ -271,7 +271,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
pdb = NULL ;
pdb = NULL ;
- - bitdb . mapFileUseCount [ strFile ] ;
- - bitdb . mapFileUseCount [ strFile ] ;
strFile = " " ;
strFile = " " ;
throw runtime_error ( strprintf ( " CDB : Error %d, can't open database %s " , ret , psz File) ) ;
throw runtime_error ( strprintf ( " CDB : Error %d, can't open database %s " , ret , str File) ) ;
}
}
if ( fCreate & & ! Exists ( string ( " version " ) ) )
if ( fCreate & & ! Exists ( string ( " version " ) ) )