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

Method ParseURL

IO/PostgreSQL/vtkPostgreSQLDatabase.cxx:360–391  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

358
359//------------------------------------------------------------------------------
360bool vtkPostgreSQLDatabase::ParseURL(const char* URL)
361{
362 std::string urlstr(URL ? URL : "");
363 std::string protocol;
364 std::string username;
365 std::string password;
366 std::string hostname;
367 std::string dataport;
368 std::string database;
369
370 // Okay now for all the other database types get more detailed info
371 if (!vtksys::SystemTools::ParseURL(
372 urlstr, protocol, username, password, hostname, dataport, database))
373 {
374 vtkErrorMacro("Invalid URL: \"" << urlstr << "\"");
375 return false;
376 }
377
378 if (protocol == "psql")
379 {
380 this->SetUser(username.empty() ? nullptr : username.c_str());
381 this->SetPassword(password.empty() ? nullptr : password.c_str());
382 this->SetHostName(hostname.empty() ? nullptr : hostname.c_str());
383 int port;
384 VTK_FROM_CHARS_IF_ERROR_RETURN(dataport, port, false);
385 this->SetServerPort(port);
386 this->SetDatabaseName(database.empty() ? nullptr : database.c_str());
387 return true;
388 }
389
390 return false;
391}
392
393//------------------------------------------------------------------------------
394vtkStringArray* vtkPostgreSQLDatabase::GetTables()

Callers 1

Calls 4

SetServerPortMethod · 0.95
emptyMethod · 0.45
c_strMethod · 0.45
SetPasswordMethod · 0.45

Tested by

no test coverage detected