MCPcopy Create free account
hub / github.com/Kitware/VTK / CreateDatabase

Method CreateDatabase

IO/MySQL/vtkMySQLDatabase.cxx:562–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562bool vtkMySQLDatabase::CreateDatabase(const char* dbName, bool dropExisting = false)
563{
564 if (dropExisting)
565 {
566 this->DropDatabase(dbName);
567 }
568 std::string queryStr;
569 queryStr = "CREATE DATABASE ";
570 queryStr += dbName;
571 bool status = false;
572 char* tmpName = this->DatabaseName;
573 bool needToReopen = false;
574 if (!strcmp(dbName, tmpName))
575 {
576 this->Close();
577 this->DatabaseName = nullptr;
578 needToReopen = true;
579 }
580 if (this->IsOpen() || this->Open(this->Password))
581 {
582 vtkSQLQuery* query = this->GetQueryInstance();
583 query->SetQuery(queryStr.c_str());
584 status = query->Execute();
585 query->Delete();
586 }
587 if (needToReopen)
588 {
589 this->Close();
590 this->DatabaseName = tmpName;
591 this->Open(this->Password);
592 }
593 return status;
594}
595
596bool vtkMySQLDatabase::DropDatabase(const char* dbName)
597{

Callers

nothing calls this directly

Calls 9

DropDatabaseMethod · 0.95
CloseMethod · 0.95
IsOpenMethod · 0.95
OpenMethod · 0.95
GetQueryInstanceMethod · 0.95
DeleteMethod · 0.65
SetQueryMethod · 0.45
c_strMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected