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

Method ParseURL

IO/MySQL/vtkMySQLDatabase.cxx:315–353  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

313
314//------------------------------------------------------------------------------
315bool vtkMySQLDatabase::ParseURL(const char* URL)
316{
317 std::string urlstr(URL ? URL : "");
318 std::string protocol;
319 std::string username;
320 std::string password;
321 std::string hostname;
322 std::string dataport;
323 std::string database;
324
325 if (!vtksys::SystemTools::ParseURL(
326 urlstr, protocol, username, password, hostname, dataport, database))
327 {
328 vtkGenericWarningMacro("Invalid URL: \"" << urlstr << "\"");
329 return false;
330 }
331
332 if (protocol == "mysql")
333 {
334 if (!username.empty())
335 {
336 this->SetUser(username.c_str());
337 }
338 if (!password.empty())
339 {
340 this->SetPassword(password.c_str());
341 }
342 if (!dataport.empty())
343 {
344 int port;
345 VTK_FROM_CHARS_IF_ERROR_RETURN(dataport, port, false);
346 this->SetServerPort(port);
347 }
348 this->SetHostName(hostname.c_str());
349 this->SetDatabaseName(database.c_str());
350 return true;
351 }
352 return false;
353}
354
355//------------------------------------------------------------------------------
356vtkStdString vtkMySQLDatabase::GetColumnSpecification(

Callers 1

Calls 4

SetServerPortMethod · 0.80
emptyMethod · 0.45
c_strMethod · 0.45
SetPasswordMethod · 0.45

Tested by

no test coverage detected