00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef MySqlDatastore_h
00026 #define MySqlDatastore_h
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <FE_Datastore.h>
00040 #include <mysql.h>
00041
00042 class MySqlDatastore: public FE_Datastore
00043 {
00044 public:
00045 MySqlDatastore(const char *databaseName,
00046 Domain &theDomain,
00047 FEM_ObjectBroker &theBroker,
00048 int dbRun = 0);
00049
00050 MySqlDatastore(const char *databaseName,
00051 const char *host,
00052 const char *user,
00053 const char *passwd,
00054 unsigned int port,
00055 const char *socket,
00056 unsigned int clientFlag,
00057 Domain &theDomain,
00058 FEM_ObjectBroker &theBroker,
00059 int dbRun = 0);
00060
00061 ~MySqlDatastore();
00062
00063
00064 int sendMsg(int dbTag, int commitTag,
00065 const Message &,
00066 ChannelAddress *theAddress =0);
00067 int recvMsg(int dbTag, int commitTag,
00068 Message &,
00069 ChannelAddress *theAddress =0);
00070
00071 int sendMatrix(int dbTag, int commitTag,
00072 const Matrix &theMatrix,
00073 ChannelAddress *theAddress =0);
00074 int recvMatrix(int dbTag, int commitTag,
00075 Matrix &theMatrix,
00076 ChannelAddress *theAddress =0);
00077
00078 int sendVector(int dbTag, int commitTag,
00079 const Vector &theVector,
00080 ChannelAddress *theAddress =0);
00081 int recvVector(int dbTag, int commitTag,
00082 Vector &theVector,
00083 ChannelAddress *theAddress =0);
00084
00085 int sendID(int dbTag, int commitTag,
00086 const ID &theID,
00087 ChannelAddress *theAddress =0);
00088 int recvID(int dbTag, int commitTag,
00089 ID &theID,
00090 ChannelAddress *theAddress =0);
00091
00092 int createTable(const char *tableName, int numColumns, char *columns[]);
00093 int insertData(const char *tableName, char *columns[], int commitTag, const Vector &data);
00094 int getData(const char *tableName, char *columns[], int commitTag, Vector &data);
00095
00096 int setDbRun(int run);
00097 int getDbRun(void);
00098
00099 protected:
00100 int createOpenSeesDatabase(const char *projectName);
00101 int execute(const char *query);
00102
00103 private:
00104 int dbTag;
00105 int dbRun;
00106
00107 bool connection;
00108 MYSQL mysql;
00109
00110 char *query;
00111 int sizeQuery;
00112 int sizeColumnString;
00113 };
00114
00115 #endif