| 145 | } |
| 146 | |
| 147 | static void splitDataSourceName(thread_db* tdbb, const string& dataSource, |
| 148 | string& prvName, PathName& dbName) |
| 149 | { |
| 150 | // dataSource : registered data source name |
| 151 | // or connection string : provider::database |
| 152 | |
| 153 | if (dataSource.isEmpty()) |
| 154 | { |
| 155 | prvName = INTERNAL_PROVIDER_NAME; |
| 156 | dbName = tdbb->getDatabase()->dbb_database_name; |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | FB_SIZE_T pos = dataSource.find("::"); |
| 161 | |
| 162 | // Check if it is part of IPv6 address, assume provider name can't contain square brackets |
| 163 | if (pos != string::npos && |
| 164 | dataSource.rfind("[", pos) != string::npos && |
| 165 | dataSource.find("]", pos) != string::npos) |
| 166 | { |
| 167 | pos = string::npos; |
| 168 | } |
| 169 | |
| 170 | if (pos != string::npos) |
| 171 | { |
| 172 | prvName = dataSource.substr(0, pos); |
| 173 | dbName = dataSource.substr(pos + 2).ToPathName(); |
| 174 | } |
| 175 | else |
| 176 | { |
| 177 | // search dataSource at registered data sources and get connection |
| 178 | // string, user and password from this info if found |
| 179 | |
| 180 | // if not found - treat dataSource as Firebird's connection string |
| 181 | prvName = FIREBIRD_PROVIDER_NAME; |
| 182 | dbName = dataSource.ToPathName(); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | static bool isCurrentAccount(UserId* currUserID, |
| 188 | const MetaName& user, const string& pwd, const MetaName& role) |
no test coverage detected