MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / splitDataSourceName

Function splitDataSourceName

src/jrd/extds/ExtDS.cpp:147–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147static 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
187static bool isCurrentAccount(UserId* currUserID,
188 const MetaName& user, const string& pwd, const MetaName& role)

Callers 1

getConnectionMethod · 0.85

Calls 6

getDatabaseMethod · 0.80
ToPathNameMethod · 0.80
isEmptyMethod · 0.45
findMethod · 0.45
rfindMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected