00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00058 #ifndef __vtkSQLDatabase_h
00059 #define __vtkSQLDatabase_h
00060
00061 #include "vtkObject.h"
00062
00063 #include "vtkStdString.h"
00064
00065 class vtkSQLDatabaseSchema;
00066 class vtkSQLQuery;
00067 class vtkStringArray;
00068
00069
00070
00071
00072 #define VTK_SQL_FEATURE_TRANSACTIONS 1000
00073 #define VTK_SQL_FEATURE_QUERY_SIZE 1001
00074 #define VTK_SQL_FEATURE_BLOB 1002
00075 #define VTK_SQL_FEATURE_UNICODE 1003
00076 #define VTK_SQL_FEATURE_PREPARED_QUERIES 1004
00077 #define VTK_SQL_FEATURE_NAMED_PLACEHOLDERS 1005
00078 #define VTK_SQL_FEATURE_POSITIONAL_PLACEHOLDERS 1006
00079 #define VTK_SQL_FEATURE_LAST_INSERT_ID 1007
00080 #define VTK_SQL_FEATURE_BATCH_OPERATIONS 1008
00081 #define VTK_SQL_FEATURE_TRIGGERS 1009 // supported
00082
00083
00084
00085 #define VTK_SQL_DEFAULT_COLUMN_SIZE 32
00086
00087 class VTK_IO_EXPORT vtkSQLDatabase : public vtkObject
00088 {
00089 public:
00090 vtkTypeRevisionMacro(vtkSQLDatabase, vtkObject);
00091 void PrintSelf(ostream& os, vtkIndent indent);
00092
00096 virtual bool Open() = 0;
00097
00099 virtual void Close() = 0;
00100
00102 virtual bool IsOpen() = 0;
00103
00105 virtual vtkSQLQuery* GetQueryInstance() = 0;
00106
00108 virtual bool HasError() = 0;
00109
00114 virtual const char* GetLastErrorText() = 0;
00115
00117 virtual char* GetDatabaseType() = 0;
00118
00120 virtual vtkStringArray* GetTables() = 0;
00121
00123 virtual vtkStringArray* GetRecord(const char *table) = 0;
00124
00126 virtual bool IsSupported(int vtkNotUsed(feature)) { return false; }
00127
00129 virtual vtkStdString GetURL() = 0;
00130
00135 virtual vtkStdString GetTablePreamble( bool ) { return vtkStdString(); }
00136
00138
00143 virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
00144 int tblHandle,
00145 int colHandle );
00147
00149
00158 virtual vtkStdString GetIndexSpecification( vtkSQLDatabaseSchema* schema,
00159 int tblHandle,
00160 int idxHandle,
00161 bool& skipped );
00163
00165
00173 virtual vtkStdString GetTriggerSpecification( vtkSQLDatabaseSchema* schema,
00174 int tblHandle,
00175 int trgHandle );
00177
00182 static vtkSQLDatabase* CreateFromURL( const char* URL );
00183
00185 virtual bool EffectSchema( vtkSQLDatabaseSchema*, bool dropIfExists = false );
00186
00187 protected:
00188 vtkSQLDatabase();
00189 ~vtkSQLDatabase();
00190
00191 private:
00192 vtkSQLDatabase(const vtkSQLDatabase &);
00193 void operator=(const vtkSQLDatabase &);
00194 };
00195
00196 #endif // __vtkSQLDatabase_h