VTK
vtkMySQLDatabase.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMySQLDatabase.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
38 #ifndef __vtkMySQLDatabase_h
39 #define __vtkMySQLDatabase_h
40 
41 #include "vtkSQLDatabase.h"
42 
43 class vtkSQLQuery;
44 class vtkMySQLQuery;
45 class vtkStringArray;
47 
49 {
50 //BTX
51  friend class vtkMySQLQuery;
52 //ETX
53 
54 public:
56  void PrintSelf(ostream& os, vtkIndent indent);
57  static vtkMySQLDatabase *New();
58 
62  bool Open( const char* password = 0 );
63 
65  void Close();
66 
68  bool IsOpen();
69 
72 
75 
77  vtkStringArray* GetRecord(const char *table);
78 
80  bool IsSupported(int feature);
81 
83  bool HasError();
84 
86  const char* GetLastErrorText();
87 
89 
90  vtkGetStringMacro(DatabaseType);
92 
94 
95  vtkSetStringMacro(HostName);
96  vtkGetStringMacro(HostName);
98 
100 
101  vtkSetStringMacro(User);
102  vtkGetStringMacro(User);
104 
106 
107  vtkSetStringMacro(Password);
109 
111 
112  vtkSetStringMacro(DatabaseName);
113  vtkGetStringMacro(DatabaseName);
115 
117 
119  vtkSetMacro(Reconnect,int);
120  vtkGetMacro(Reconnect,int);
121  vtkBooleanMacro(Reconnect,int);
123 
125 
126  vtkSetClampMacro(ServerPort, int, 0, VTK_INT_MAX);
127  vtkGetMacro(ServerPort, int);
129 
131  virtual vtkStdString GetURL();
132 
136  virtual vtkStdString GetTablePreamble( bool b ) { return b ? vtkStdString() :"IF NOT EXISTS "; }
137 
139 
147  int tblHandle,
148  int colHandle );
150 
152 
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:
175  ~vtkMySQLDatabase();
176 
180  virtual bool ParseURL(const char* url);
181 
182 private:
183  // We want this to be private, a user of this class
184  // should not be setting this for any reason
185  vtkSetStringMacro(DatabaseType);
186 
187  vtkStringArray *Tables;
188  vtkStringArray *Record;
189 
190  char* DatabaseType;
191  char* HostName;
192  char* User;
193  char* Password;
194  char* DatabaseName;
195  int ServerPort;
196  int Reconnect;
197 
198 //BTX
199  vtkMySQLDatabasePrivate* const Private;
200 //ETX
201 
202  vtkMySQLDatabase(const vtkMySQLDatabase &); // Not implemented.
203  void operator=(const vtkMySQLDatabase &); // Not implemented.
204 };
205 
206 #endif // __vtkMySQLDatabase_h
207