VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/MySQL/vtkMySQLDatabase.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkMySQLDatabase.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00038 #ifndef vtkMySQLDatabase_h
00039 #define vtkMySQLDatabase_h
00040 
00041 #include "vtkIOMySQLModule.h" // For export macro
00042 #include "vtkSQLDatabase.h"
00043 
00044 class vtkSQLQuery;
00045 class vtkMySQLQuery;
00046 class vtkStringArray;
00047 class vtkMySQLDatabasePrivate;
00048 
00049 class VTKIOMYSQL_EXPORT vtkMySQLDatabase : public vtkSQLDatabase
00050 {
00051 //BTX
00052   friend class vtkMySQLQuery;
00053 //ETX
00054 
00055 public:
00056   vtkTypeMacro(vtkMySQLDatabase, vtkSQLDatabase);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00058   static vtkMySQLDatabase *New();
00059 
00063   bool Open( const char* password = 0 );
00064 
00066   void Close();
00067 
00069   bool IsOpen();
00070 
00072   vtkSQLQuery* GetQueryInstance();
00073 
00075   vtkStringArray* GetTables();
00076 
00078   vtkStringArray* GetRecord(const char *table);
00079 
00081   bool IsSupported(int feature);
00082 
00084   bool HasError();
00085 
00087   const char* GetLastErrorText();
00088 
00090 
00091   vtkGetStringMacro(DatabaseType);
00093 
00095 
00096   vtkSetStringMacro(HostName);
00097   vtkGetStringMacro(HostName);
00099 
00101 
00102   vtkSetStringMacro(User);
00103   vtkGetStringMacro(User);
00105 
00107 
00108   vtkSetStringMacro(Password);
00110 
00112 
00113   vtkSetStringMacro(DatabaseName);
00114   vtkGetStringMacro(DatabaseName);
00116 
00118 
00120   vtkSetMacro(Reconnect,int);
00121   vtkGetMacro(Reconnect,int);
00122   vtkBooleanMacro(Reconnect,int);
00124 
00126 
00127   vtkSetClampMacro(ServerPort, int, 0, VTK_INT_MAX);
00128   vtkGetMacro(ServerPort, int);
00130 
00132   virtual vtkStdString GetURL();
00133 
00137   virtual vtkStdString GetTablePreamble( bool b ) { return b ? vtkStdString() :"IF NOT EXISTS "; }
00138 
00140 
00147   virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
00148                                                int tblHandle,
00149                                                int colHandle );
00151 
00153 
00159   virtual vtkStdString GetIndexSpecification( vtkSQLDatabaseSchema* schema,
00160                                               int tblHandle,
00161                                               int idxHandle,
00162                                               bool& skipped );
00164 
00168   bool CreateDatabase( const char* dbName, bool dropExisting );
00169 
00172   bool DropDatabase( const char* dbName );
00173 
00177   virtual bool ParseURL(const char* url);
00178 
00179 protected:
00180   vtkMySQLDatabase();
00181   ~vtkMySQLDatabase();
00182 
00183 private:
00184   // We want this to be private, a user of this class
00185   // should not be setting this for any reason
00186   vtkSetStringMacro(DatabaseType);
00187 
00188   vtkStringArray *Tables;
00189   vtkStringArray *Record;
00190 
00191   char* DatabaseType;
00192   char* HostName;
00193   char* User;
00194   char* Password;
00195   char* DatabaseName;
00196   int ServerPort;
00197   int Reconnect;
00198 
00199 //BTX
00200   vtkMySQLDatabasePrivate* const Private;
00201 //ETX
00202 
00203   vtkMySQLDatabase(const vtkMySQLDatabase &); // Not implemented.
00204   void operator=(const vtkMySQLDatabase &); // Not implemented.
00205 };
00206 
00207 #endif // vtkMySQLDatabase_h
00208