| 608 | // john:smith@server2:/my/replica/database.fdb |
| 609 | |
| 610 | void Config::splitConnectionString(const string& input, string& database, string& username, string& password) |
| 611 | { |
| 612 | database = input; |
| 613 | |
| 614 | auto pos = database.rfind('@'); |
| 615 | if (pos != string::npos) |
| 616 | { |
| 617 | //john:smith |
| 618 | const string temp = database.substr(0, pos); |
| 619 | //server2:/my/replica/database.fdb |
| 620 | database = database.substr(pos + 1); |
| 621 | |
| 622 | pos = temp.find(':'); |
| 623 | if (pos != string::npos) |
| 624 | { |
| 625 | username = temp.substr(0, pos); |
| 626 | password = temp.substr(pos + 1); |
| 627 | } |
| 628 | else |
| 629 | { |
| 630 | username = temp; |
| 631 | } |
| 632 | } |
| 633 | } |