XC Open source finite element analysis program
MySqlDatastore.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 2002, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.5 $
48 // $Date: 2005/11/07 21:34:25 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/utility/database/MySqlDatastore.h,v $
50 
51 #ifndef MySqlDatastore_h
52 #define MySqlDatastore_h
53 
54 // Written: fmk
55 // Created: 02/02
56 //
57 // Description: This file contains the class definition for MySqlDatastore.
58 // MySqlDatastore is a concrete subclas of DBDatastore. A MySqlDatastore
59 // object is used in the program to store/restore the geometry and state
60 // information in a model at a particular instance in the analysis. The
61 // information is stored in a MySQL Database which can be local or remote.
62 //
63 // What: "@(#) MySqlDatastore.h, revA"
64 
65 #include "DBDatastore.h"
66 #include <mysql.h>
67 
68 namespace XC {
70 //
72  {
73  private:
74  int dbRun;
75 
76  bool connection;
77  MYSQL mysql;
78 
79  std::string query;
80  int sizeColumnString;
81  protected:
82  int createOpenSeesDatabase(const std::string &projectName);
83  int execute(const std::string &query);
84  public:
85  MySqlDatastore(const std::string &,Preprocessor &, FEM_ObjectBroker &,int dbRun = 0);
86  MySqlDatastore(const std::string &,const std::string &, const std::string &, const std::string &, unsigned int port, const std::string &, unsigned int clientFlag, Preprocessor &, FEM_ObjectBroker &, int dbRun = 0);
87  ~MySqlDatastore();
88 
89  // methods for sending and recieving matrices, vectors and id's
90  int sendMsg(int dbTag, int commitTag, const Message &, ChannelAddress *theAddress= nullptr);
91  int recvMsg(int dbTag, int commitTag, Message &, ChannelAddress *theAddress= nullptr);
92 
93  int sendMatrix(int dbTag, int commitTag, const Matrix &,ChannelAddress *theAddress= nullptr);
94  int recvMatrix(int dbTag, int commitTag, Matrix &, ChannelAddress *theAddress= nullptr);
95 
96  int sendVector(int dbTag, int commitTag, const Vector &,ChannelAddress *theAddress= nullptr);
97  int recvVector(int dbTag, int commitTag, Vector &,ChannelAddress *theAddress= nullptr);
98 
99  int sendID(int dbTag, int commitTag,const ID &,ChannelAddress *theAddress= nullptr);
100  int recvID(int dbTag, int commitTag,ID &,ChannelAddress *theAddress= nullptr);
101 
102  int createTable(const std::string &tableName,const std::vector<std::string> &columns);
103  int insertData(const std::string &tableName,const std::vector<std::string> &columns, int commitTag, const Vector &data);
104  int getData(const std::string &tableName,const std::vector<std::string> &columns, int commitTag, Vector &data);
105 
106  int setDbRun(int run);
107  int getDbRun(void);
108  };
109 } // end of XC namespace
110 
111 #endif
Definition: MySqlDatastore.h:71
Definition: Vector.h:82
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
Definition: ChannelAddress.h:69
Finite element model generation tools.
Definition: Preprocessor.h:58
Definition: ID.h:77
Definition: Matrix.h:82
Message between processes.
Definition: Message.h:67
================================================================================
Definition: ContinuaReprComponent.h:34
Definition: DBDatastore.h:38