MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / db_connect

Function db_connect

Exercises/NoModules/Chapter 18/Soln18_04/DB.cpp:32–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32DB_CONNECTION* db_connect()
33{
34 // We only have one single database, which allows only one single connection:
35 static Database theDatabase;
36 if (theDatabase.hasConnection())
37 {
38 return nullptr;
39 }
40 else
41 {
42 theDatabase.connect();
43 return &theDatabase;
44 }
45}
46
47void db_disconnect(DB_CONNECTION* connection)
48{

Callers 1

mainFunction · 0.70

Calls 2

hasConnectionMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected