VTK
|
00001 /* -*- Mode: C++; -*- */ 00002 00003 /*========================================================================= 00004 00005 Program: Visualization Toolkit 00006 Module: vtkODBCDatabase.h 00007 00008 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00009 All rights reserved. 00010 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notice for more information. 00015 00016 =========================================================================*/ 00017 /*------------------------------------------------------------------------- 00018 Copyright 2008 Sandia Corporation. 00019 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00020 the U.S. Government retains certain rights in this software. 00021 -------------------------------------------------------------------------*/ 00022 00074 #ifndef vtkODBCDatabase_h 00075 #define vtkODBCDatabase_h 00076 00077 #include "vtkIOODBCModule.h" // For export macro 00078 #include "vtkSQLDatabase.h" 00079 00080 class vtkSQLQuery; 00081 class vtkODBCQuery; 00082 class vtkStringArray; 00083 class vtkODBCInternals; 00084 00085 class VTKIOODBC_EXPORT vtkODBCDatabase : public vtkSQLDatabase 00086 { 00087 //BTX 00088 friend class vtkODBCQuery; 00089 //ETX 00090 00091 public: 00092 vtkTypeMacro(vtkODBCDatabase, vtkSQLDatabase); 00093 void PrintSelf(ostream& os, vtkIndent indent); 00094 static vtkODBCDatabase *New(); 00095 00099 bool Open(const char* password); 00100 00102 void Close(); 00103 00105 bool IsOpen(); 00106 00108 vtkSQLQuery* GetQueryInstance(); 00109 00111 const char* GetLastErrorText(); 00112 00114 vtkStringArray* GetTables(); 00115 00117 vtkStringArray* GetRecord(const char *table); 00118 00120 bool IsSupported(int feature); 00121 00123 00126 vtkSetStringMacro(DataSourceName); 00127 vtkGetStringMacro(DataSourceName); 00129 00130 vtkSetMacro(ServerPort, int); 00131 vtkSetStringMacro(HostName); 00132 vtkSetStringMacro(UserName); 00133 vtkSetStringMacro(DatabaseName); 00134 vtkGetStringMacro(DatabaseName); 00135 vtkSetStringMacro(Password); 00136 00137 bool HasError(); 00138 00140 00141 vtkGetStringMacro(DatabaseType); 00143 00144 vtkStdString GetURL(); 00145 00147 00151 virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema, 00152 int tblHandle, 00153 int colHandle ); 00155 00157 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 bool ParseURL(const char *url); 00178 00179 protected: 00180 vtkODBCDatabase(); 00181 ~vtkODBCDatabase(); 00182 00183 vtkSetStringMacro(LastErrorText); 00184 00185 private: 00186 vtkStringArray *Tables; 00187 vtkStringArray *Record; 00188 00189 char *LastErrorText; 00190 00191 char *HostName; 00192 char *UserName; 00193 char *Password; 00194 char *DataSourceName; 00195 char *DatabaseName; 00196 int ServerPort; 00197 00198 vtkODBCInternals *Internals; 00199 00200 // We want this to be private, a user of this class 00201 // should not be setting this for any reason 00202 vtkSetStringMacro(DatabaseType); 00203 00204 char *DatabaseType; 00205 00206 vtkODBCDatabase(const vtkODBCDatabase &); // Not implemented. 00207 void operator=(const vtkODBCDatabase &); // Not implemented. 00208 }; 00209 00210 #endif // vtkODBCDatabase_h 00211