MySqlDatastore.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 2002, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.5 $
00022 // $Date: 2005/11/07 21:34:25 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/database/MySqlDatastore.h,v $
00024 
00025 #ifndef MySqlDatastore_h
00026 #define MySqlDatastore_h
00027 
00028 // Written:  fmk
00029 // Created:  02/02
00030 //
00031 // Description: This file contains the class definition for MySqlDatastore.
00032 // MySqlDatastore is a concrete subclas of FE_Datastore. A MySqlDatastore 
00033 // object is used in the program to store/restore the geometry and state 
00034 // information in a domain at a particular instance in the analysis. The
00035 // information is stored in a MySQL Database which can be local or remote.
00036 //
00037 // What: "@(#) MySqlDatastore.h, revA"
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   // methods for sending and recieving matrices, vectors and id's
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

Generated on Mon Oct 23 15:05:00 2006 for OpenSees by doxygen 1.5.0