/usr/include/vtk-7.1/vtkODBCDatabase.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | /* -*- Mode: C++; -*- */
/*=========================================================================
Program: Visualization Toolkit
Module: vtkODBCDatabase.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
/**
* @class vtkODBCDatabase
* @brief maintain an ODBC connection to a SQL database
*
*
*
* ODBC is a standard for connecting to an SQL database regardless of
* vendor or implementation. In order to make it work you need two
* separate pices of software: a driver manager and then a
* database-specific driver. On Windows, the driver manager is built
* into the OS. On Unix platforms, the open-source packages iODBC and
* unixODBC will do the job. Mac OS X has its own driver manager and
* can also use the open-source packages. Database-specific drivers
* must be obtained from the entity that makes the database(s) you
* use.
*
* Unlike the other VTK database drivers, ODBC can read its parameters
* from a configuration file (odbc.ini). That file can define an
* entire set of connection parameters and give it a single name
* called a data source name (DSN). Writing and maintaining odbc.ini
* files is beyond the scope of this header file.
*
*
* @warning
* The password supplied as an argument to the Open call will override
* whatever password is set (if any) in the DSN definition. To use
* the password from the DSN definition, pass in NULL for
* the password argument.
*
* @warning
* Also, vtkSQLDatabase::CreateFromURL() will only handle URLs of the
* following form for ODBC:
*
* @warning
* odbc://[user@]datsourcename[:port]/[dbname]
*
* @warning
* Anything more complicated than that needs to be set up manually.
*
* @warning
* Finally, this class does not yet support the schema API present in
* the SQLite, MySQL and PostgreSQL drivers. Those functions will be
* added once the bare-bones driver has been successfully integrated
* into VTK.
*
* @sa
* vtkODBCQuery
*/
#ifndef vtkODBCDatabase_h
#define vtkODBCDatabase_h
#include "vtkIOODBCModule.h" // For export macro
#include "vtkSQLDatabase.h"
class vtkSQLQuery;
class vtkODBCQuery;
class vtkStringArray;
class vtkODBCInternals;
class VTKIOODBC_EXPORT vtkODBCDatabase : public vtkSQLDatabase
{
friend class vtkODBCQuery;
public:
vtkTypeMacro(vtkODBCDatabase, vtkSQLDatabase);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkODBCDatabase *New();
/**
* Open a new connection to the database. You need to set the
* filename before calling this function. Returns true if the
* database was opened successfully; false otherwise.
*/
bool Open(const char* password);
/**
* Close the connection to the database.
*/
void Close();
/**
* Return whether the database has an open connection
*/
bool IsOpen();
/**
* Return an empty query on this database.
*/
vtkSQLQuery* GetQueryInstance();
/**
* Get the last error text from the database
*/
const char* GetLastErrorText();
/**
* Get the list of tables from the database
*/
vtkStringArray* GetTables();
/**
* Get the list of fields for a particular table
*/
vtkStringArray* GetRecord(const char *table);
/**
* Return whether a feature is supported by the database.
*/
bool IsSupported(int feature);
//@{
/**
* Set the data source name. For ODBC connections this will be
* something listed in odbc.ini. The location of that file varies wildly
* based on system, ODBC library, and installation. Good luck.
*/
vtkSetStringMacro(DataSourceName);
vtkGetStringMacro(DataSourceName);
//@}
vtkSetMacro(ServerPort, int);
vtkSetStringMacro(HostName);
vtkSetStringMacro(UserName);
vtkSetStringMacro(DatabaseName);
vtkGetStringMacro(DatabaseName);
vtkSetStringMacro(Password);
bool HasError();
//@{
/**
* String representing database type (e.g. "ODBC").
*/
vtkGetStringMacro(DatabaseType);
//@}
vtkStdString GetURL();
/**
* Return the SQL string with the syntax to create a column inside a
* "CREATE TABLE" SQL statement.
* NB2: if a column has type SERIAL in the schema, this will be turned
* into INT NOT NULL. Therefore, one should not pass
* NOT NULL as an attribute of a column whose type is SERIAL.
*/
virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
int tblHandle,
int colHandle );
/**
* Return the SQL string with the syntax to create an index inside a
* "CREATE TABLE" SQL statement.
*/
virtual vtkStdString GetIndexSpecification( vtkSQLDatabaseSchema* schema,
int tblHandle,
int idxHandle,
bool& skipped );
/**
* Create a new database, optionally dropping any existing database of the same name.
* Returns true when the database is properly created and false on failure.
*/
bool CreateDatabase( const char* dbName, bool dropExisting );
/**
* Drop a database if it exists.
* Returns true on success and false on failure.
*/
bool DropDatabase( const char* dbName );
/**
* This will only handle URLs of the form
* odbc://[user@]datsourcename[:port]/[dbname]. Anything
* more complicated than that needs to be set up manually.
*/
bool ParseURL(const char *url);
protected:
vtkODBCDatabase();
~vtkODBCDatabase();
vtkSetStringMacro(LastErrorText);
private:
vtkStringArray *Tables;
vtkStringArray *Record;
char *LastErrorText;
char *HostName;
char *UserName;
char *Password;
char *DataSourceName;
char *DatabaseName;
int ServerPort;
vtkODBCInternals *Internals;
// We want this to be private, a user of this class
// should not be setting this for any reason
vtkSetStringMacro(DatabaseType);
char *DatabaseType;
vtkODBCDatabase(const vtkODBCDatabase &) VTK_DELETE_FUNCTION;
void operator=(const vtkODBCDatabase &) VTK_DELETE_FUNCTION;
};
#endif // vtkODBCDatabase_h
|