MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / MySqlDatastore

Method MySqlDatastore

SRC/database/MySqlDatastore.cpp:36–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#define MAX_BLOB_SIZE 16777215
35
36MySqlDatastore::MySqlDatastore(const char *projectName,
37 Domain &theDomain,
38 FEM_ObjectBroker &theObjectBroker,
39 int run)
40 :FE_Datastore(theDomain, theObjectBroker), dbTag(0), dbRun(run),
41 connection(true), query(0), sizeQuery(0), sizeColumnString(0)
42{
43 // initialise the mysql structure
44 mysql_init(&mysql);
45
46 // connect to the server
47 if (mysql_real_connect(&mysql, NULL, NULL, NULL, NULL, 0, "/tmp/mysql.sock", 0) == NULL) {
48
49 opserr << "MySqlDatastore::MySqlDatastore() - could not connect to server\n";
50 opserr << mysql_error(&mysql) << endln;
51 connection = false;
52
53 } else {
54
55 // link to the database,
56 if (mysql_select_db(&mysql, projectName) != 0) {
57
58 // if no database exists, try creating one
59 if (this->createOpenSeesDatabase(projectName) != 0) {
60 connection = false;
61 mysql_close(&mysql);
62 opserr << "MySqlDatastore::MySqlDatastore() - could not open the database\n";
63 opserr << mysql_error(&mysql) << endln;
64 }
65 }
66 }
67
68}
69
70
71

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected