MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / FindOrLoadDriver

Method FindOrLoadDriver

core/logic/Database.cpp:343–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343IDBDriver *DBManager::FindOrLoadDriver(const char *name)
344{
345 size_t last_size = m_drivers.size();
346 for (size_t i=0; i<last_size; i++)
347 {
348 if (strcmp(m_drivers[i]->GetIdentifier(), name) == 0)
349 {
350 return m_drivers[i];
351 }
352 }
353
354 char filename[PLATFORM_MAX_PATH];
355 g_pSM->Format(filename, sizeof(filename), "dbi.%s.ext", name);
356
357 IExtension *pExt = g_Extensions.LoadAutoExtension(filename);
358 if (!pExt || !pExt->IsLoaded() || m_drivers.size() <= last_size)
359 {
360 return NULL;
361 }
362
363 /* last_size is now gauranteed to be a valid index.
364 * The identifier must match the name.
365 */
366 if (strcmp(m_drivers[last_size]->GetIdentifier(), name) == 0)
367 {
368 return m_drivers[last_size];
369 }
370
371 return NULL;
372}
373
374void DBManager::KillWorkerThread()
375{

Callers 4

ConnectToDbAsyncFunction · 0.80
SQL_GetDriverFunction · 0.80
SQL_ConnectCustomFunction · 0.80
SDK_OnLoadMethod · 0.80

Calls 5

FormatMethod · 0.80
LoadAutoExtensionMethod · 0.80
IsLoadedMethod · 0.80
sizeMethod · 0.45
GetIdentifierMethod · 0.45

Tested by

no test coverage detected