dox/IO/vtkMySQLDatabase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMySQLDatabase.h,v $
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 "vtkSQLDatabase.h"
00042 
00043 class vtkSQLQuery;
00044 class vtkMySQLQuery;
00045 class vtkStringArray;
00046 class vtkMySQLDatabasePrivate;
00047 
00048 class VTK_IO_EXPORT vtkMySQLDatabase : public vtkSQLDatabase
00049 {
00050 //BTX
00051   friend class vtkMySQLQuery;
00052 //ETX
00053 
00054 public:
00055   vtkTypeRevisionMacro(vtkMySQLDatabase, vtkSQLDatabase);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057   static vtkMySQLDatabase *New();
00058 
00062   bool Open( const char* password = 0 );
00063 
00065   void Close();
00066   
00068   bool IsOpen();
00069 
00071   vtkSQLQuery* GetQueryInstance();
00072   
00074   vtkStringArray* GetTables();
00075     
00077   vtkStringArray* GetRecord(const char *table);
00078 
00080   bool IsSupported(int feature);
00081   
00083   bool HasError();
00084   
00086   const char* GetLastErrorText();
00087   
00089 
00090   vtkGetStringMacro(DatabaseType);
00092 
00094 
00095   vtkSetStringMacro(HostName);
00096   vtkGetStringMacro(HostName);
00098 
00100 
00101   vtkSetStringMacro(User);
00102   vtkGetStringMacro(User);
00104 
00106 
00107   vtkSetStringMacro(Password);
00109 
00111 
00112   vtkSetStringMacro(DatabaseName);
00113   vtkGetStringMacro(DatabaseName);
00115 
00117 
00118   vtkSetStringMacro(ConnectOptions);
00119   vtkGetStringMacro(ConnectOptions);
00121 
00123 
00124   vtkSetClampMacro(ServerPort, int, 0, VTK_INT_MAX);
00125   vtkGetMacro(ServerPort, int);
00127   
00129   virtual vtkStdString GetURL();
00130 
00134   virtual vtkStdString GetTablePreamble( bool b ) { return b ? vtkStdString() :"IF NOT EXISTS "; }
00135  
00137 
00143   virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
00144                                                int tblHandle,
00145                                                int colHandle );
00147  
00149 
00154   virtual vtkStdString GetIndexSpecification( vtkSQLDatabaseSchema* schema,
00155                                               int tblHandle,
00156                                               int idxHandle,
00157                                               bool& skipped );
00159 
00163   bool CreateDatabase( const char* dbName, bool dropExisting );
00164 
00167   bool DropDatabase( const char* dbName );
00168 
00169 protected:
00170   vtkMySQLDatabase();
00171   ~vtkMySQLDatabase();
00172 
00176   virtual bool ParseURL(const char* url);
00177 
00178 private:
00179   // We want this to be private, a user of this class
00180   // should not be setting this for any reason
00181   vtkSetStringMacro(DatabaseType);
00182   
00183   vtkStringArray *Tables;
00184   vtkStringArray *Record;
00185 
00186   char* DatabaseType;
00187   char* HostName;
00188   char* User;
00189   char* Password;
00190   char* DatabaseName;
00191   int ServerPort;
00192   char* ConnectOptions;
00193 
00194 //BTX
00195   vtkMySQLDatabasePrivate* const Private;
00196 //ETX
00197 
00198   vtkMySQLDatabase(const vtkMySQLDatabase &); // Not implemented.
00199   void operator=(const vtkMySQLDatabase &); // Not implemented.
00200 };
00201 
00202 #endif // __vtkMySQLDatabase_h
00203 

Generated on Thu Jan 8 14:38:54 2009 for VTK by  doxygen 1.4.7