• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/IO/vtkSQLDatabase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Visualization Toolkit
00004 Module:    $RCSfile: vtkSQLDatabase.h,v $
00005 
00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007 All rights reserved.
00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010 This software is distributed WITHOUT ANY WARRANTY; without even
00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012 PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00055 #ifndef __vtkSQLDatabase_h
00056 #define __vtkSQLDatabase_h
00057 
00058 #include "vtkObject.h"
00059 
00060 #include "vtkStdString.h" // Because at least one method returns a vtkStdString
00061 
00062 class vtkSQLDatabaseSchema;
00063 class vtkSQLQuery;
00064 class vtkStringArray;
00065 
00066 // This is a list of features that each database may or may not
00067 // support.  As yet (April 2008) we don't provide access to most of
00068 // them.  
00069 #define VTK_SQL_FEATURE_TRANSACTIONS            1000
00070 #define VTK_SQL_FEATURE_QUERY_SIZE              1001
00071 #define VTK_SQL_FEATURE_BLOB                    1002
00072 #define VTK_SQL_FEATURE_UNICODE                 1003
00073 #define VTK_SQL_FEATURE_PREPARED_QUERIES        1004
00074 #define VTK_SQL_FEATURE_NAMED_PLACEHOLDERS      1005
00075 #define VTK_SQL_FEATURE_POSITIONAL_PLACEHOLDERS 1006
00076 #define VTK_SQL_FEATURE_LAST_INSERT_ID          1007
00077 #define VTK_SQL_FEATURE_BATCH_OPERATIONS        1008
00078 #define VTK_SQL_FEATURE_TRIGGERS                1009 // supported
00079 
00080 // Default size for columns types which require a size to be specified 
00081 // (i.e., VARCHAR), when no size has been specified
00082 #define VTK_SQL_DEFAULT_COLUMN_SIZE 32
00083 
00084 class VTK_IO_EXPORT vtkSQLDatabase : public vtkObject
00085 {
00086 public:
00087   vtkTypeRevisionMacro(vtkSQLDatabase, vtkObject);
00088   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00095   virtual bool Open(const char* password) = 0;
00096 
00098   virtual void Close() = 0;
00099   
00101   virtual bool IsOpen() = 0;
00102 
00104   virtual vtkSQLQuery* GetQueryInstance() = 0;
00105   
00107   virtual bool HasError() = 0;
00108   
00113   virtual const char* GetLastErrorText() = 0;
00114   
00116   virtual char* GetDatabaseType() = 0;
00117   
00119   virtual vtkStringArray* GetTables() = 0;
00120     
00122   virtual vtkStringArray* GetRecord(const char *table) = 0;
00123 
00125   virtual bool IsSupported(int vtkNotUsed(feature)) { return false; }
00126   
00128   virtual vtkStdString GetURL() = 0;
00129 
00134   virtual vtkStdString GetTablePreamble( bool ) { return vtkStdString(); }
00135  
00137 
00142   virtual vtkStdString GetColumnSpecification( vtkSQLDatabaseSchema* schema,
00143                                                int tblHandle,
00144                                                int colHandle );
00146  
00148 
00157   virtual vtkStdString GetIndexSpecification( vtkSQLDatabaseSchema* schema,
00158                                               int tblHandle,
00159                                               int idxHandle,
00160                                               bool& skipped );
00162  
00164 
00172   virtual vtkStdString GetTriggerSpecification( vtkSQLDatabaseSchema* schema,
00173                                                 int tblHandle,
00174                                                 int trgHandle );
00176  
00181   static vtkSQLDatabase* CreateFromURL( const char* URL );
00182 
00184   virtual bool EffectSchema( vtkSQLDatabaseSchema*, bool dropIfExists = false );
00185 
00186 //BTX
00188   typedef vtkSQLDatabase* (*CreateFunction)(const char* URL);
00189 //ETX
00190 
00192 
00196   static void RegisterCreateFromURLCallback(CreateFunction callback);
00197   static void UnRegisterCreateFromURLCallback(CreateFunction callback);
00198   static void UnRegisterAllCreateFromURLCallbacks();
00200 
00201 //BTX
00202 protected:
00203   vtkSQLDatabase();
00204   ~vtkSQLDatabase();
00205   
00210   virtual bool ParseURL( const char* url ) = 0;
00211 
00212 private:
00213   vtkSQLDatabase(const vtkSQLDatabase &); // Not implemented.
00214   void operator=(const vtkSQLDatabase &); // Not implemented.
00215 
00217 
00218   class vtkCallbackVector;
00219   static vtkCallbackVector* Callbacks;
00221 //ETX
00222 };
00223 
00224 #endif // __vtkSQLDatabase_h

Generated by  doxygen 1.7.1