if(cmds[0] == "create-bind-db") {
#ifdef HAVE_SQLITE3
if(cmds.size() != 2) {
- cerr << "Syntax: pdnssec create-bind-db fname"<<endl;
+ cerr << "Syntax: pdnssec create-bind-db FNAME"<<endl;
return 0;
}
try {
// Constructor.
SSQLite3::SSQLite3( const std::string & database, bool creat )
{
- // Open the database connection.
- if(!creat)
- if ( access( database.c_str(), F_OK ) == -1 )
+ if (access( database.c_str(), F_OK ) == -1){
+ if (!creat)
throw sPerrorException( "SQLite database '"+database+"' does not exist yet" );
+ } else {
+ if (creat)
+ throw sPerrorException( "SQLite database '"+database+"' already exists" );
+ }
if ( sqlite3_open( database.c_str(), &m_pDB)!=SQLITE_OK )
throw sPerrorException( "Could not connect to the SQLite database '" + database + "'" );