VTK
vtkODBCDatabase.h
Go to the documentation of this file.
1 /* -*- Mode: C++; -*- */
2 
3 /*=========================================================================
4 
5  Program: Visualization Toolkit
6  Module: vtkODBCDatabase.h
7 
8  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
9  All rights reserved.
10  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notice for more information.
15 
16 =========================================================================*/
17 /*-------------------------------------------------------------------------
18  Copyright 2008 Sandia Corporation.
19  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
20  the U.S. Government retains certain rights in this software.
21 -------------------------------------------------------------------------*/
22 
74 #ifndef __vtkODBCDatabase_h
75 #define __vtkODBCDatabase_h
76 
77 #include "vtkIOODBCModule.h" // For export macro
78 #include "vtkSQLDatabase.h"
79 
80 class vtkSQLQuery;
81 class vtkODBCQuery;
82 class vtkStringArray;
83 class vtkODBCInternals;
84 
85 class VTKIOODBC_EXPORT vtkODBCDatabase : public vtkSQLDatabase
86 {
87 //BTX
88  friend class vtkODBCQuery;
89 //ETX
90 
91 public:
93  void PrintSelf(ostream& os, vtkIndent indent);
94  static vtkODBCDatabase *New();
95 
99  bool Open(const char* password);
100 
102  void Close();
103 
105  bool IsOpen();
106 
109 
111  const char* GetLastErrorText();
112 
115 
117  vtkStringArray* GetRecord(const char *table);
118 
120  bool IsSupported(int feature);
121 
123 
126  vtkSetStringMacro(DataSourceName);
127  vtkGetStringMacro(DataSourceName);
129 
130  vtkSetMacro(ServerPort, int);
131  vtkSetStringMacro(HostName);
132  vtkSetStringMacro(UserName);
133  vtkSetStringMacro(DatabaseName);
134  vtkGetStringMacro(DatabaseName);
135  vtkSetStringMacro(Password);
136 
137  bool HasError();
138 
140 
141  vtkGetStringMacro(DatabaseType);
143 
145 
147 
152  int tblHandle,
153  int colHandle );
155 
157 
160  int tblHandle,
161  int idxHandle,
162  bool& skipped );
164 
168  bool CreateDatabase( const char* dbName, bool dropExisting );
169 
172  bool DropDatabase( const char* dbName );
173 
177  bool ParseURL(const char *url);
178 
179 protected:
180  vtkODBCDatabase();
181  ~vtkODBCDatabase();
182 
183  vtkSetStringMacro(LastErrorText);
184 
185 private:
186  vtkStringArray *Tables;
187  vtkStringArray *Record;
188 
189  char *LastErrorText;
190 
191  char *HostName;
192  char *UserName;
193  char *Password;
194  char *DataSourceName;
195  char *DatabaseName;
196  int ServerPort;
197 
198  vtkODBCInternals *Internals;
199 
200  // We want this to be private, a user of this class
201  // should not be setting this for any reason
202  vtkSetStringMacro(DatabaseType);
203 
204  char *DatabaseType;
205 
206  vtkODBCDatabase(const vtkODBCDatabase &); // Not implemented.
207  void operator=(const vtkODBCDatabase &); // Not implemented.
208 };
209 
210 #endif // __vtkODBCDatabase_h
211