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 "vtkSQLDatabase.h"
78 
79 class vtkSQLQuery;
80 class vtkODBCQuery;
81 class vtkStringArray;
82 class vtkODBCInternals;
83 
85 {
86 //BTX
87  friend class vtkODBCQuery;
88 //ETX
89 
90 public:
92  void PrintSelf(ostream& os, vtkIndent indent);
93  static vtkODBCDatabase *New();
94 
98  bool Open(const char* password);
99 
101  void Close();
102 
104  bool IsOpen();
105 
108 
110  const char* GetLastErrorText();
111 
114 
116  vtkStringArray* GetRecord(const char *table);
117 
119  bool IsSupported(int feature);
120 
122 
125  vtkSetStringMacro(DataSourceName);
126  vtkGetStringMacro(DataSourceName);
128 
129  vtkSetMacro(ServerPort, int);
130  vtkSetStringMacro(HostName);
131  vtkSetStringMacro(UserName);
132  vtkSetStringMacro(DatabaseName);
133  vtkGetStringMacro(DatabaseName);
134  vtkSetStringMacro(Password);
135 
136  bool HasError();
137 
139 
140  vtkGetStringMacro(DatabaseType);
142 
144 
146 
151  int tblHandle,
152  int colHandle );
154 
156 
159  int tblHandle,
160  int idxHandle,
161  bool& skipped );
163 
167  bool CreateDatabase( const char* dbName, bool dropExisting );
168 
171  bool DropDatabase( const char* dbName );
172 
173 protected:
174  vtkODBCDatabase();
175  ~vtkODBCDatabase();
176 
177  vtkSetStringMacro(LastErrorText);
178 
182  bool ParseURL(const char *url);
183 
184 private:
185  vtkStringArray *Tables;
186  vtkStringArray *Record;
187 
188  char *LastErrorText;
189 
190  char *HostName;
191  char *UserName;
192  char *Password;
193  char *DataSourceName;
194  char *DatabaseName;
195  int ServerPort;
196 
197  vtkODBCInternals *Internals;
198 
199  // We want this to be private, a user of this class
200  // should not be setting this for any reason
201  vtkSetStringMacro(DatabaseType);
202 
203  char *DatabaseType;
204 
205  vtkODBCDatabase(const vtkODBCDatabase &); // Not implemented.
206  void operator=(const vtkODBCDatabase &); // Not implemented.
207 };
208 
209 #endif // __vtkODBCDatabase_h
210