VTK  9.1.0
vtkPostgreSQLDatabasePrivate.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPostgreSQLDatabasePrivate.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-------------------------------------------------------------------------*/
20
36#ifndef vtkPostgreSQLDatabasePrivate_h
37#define vtkPostgreSQLDatabasePrivate_h
38
39#include "vtkStdString.h"
40#include "vtkTimeStamp.h"
41#include "vtkType.h"
42
43#include <libpq-fe.h>
44#include <map>
45
47{
48public:
50
55 {
56 if (this->Connection)
57 {
58 PQfinish(this->Connection);
59 }
60 }
61
62 // Given a Postgres column type OID, return a VTK array type (see vtkType.h).
63 int GetVTKTypeFromOID(Oid pgtype)
64 {
65 std::map<Oid, int>::const_iterator it = this->DataTypeMap.find(pgtype);
66 if (it == this->DataTypeMap.end())
67 {
68 return VTK_STRING;
69 }
70 return it->second;
71 }
72
73 // This is the actual database connection. It will be nullptr if no
74 // connection is open.
75 PGconn* Connection;
76
77 // Map Postgres column types to VTK types.
78 std::map<Oid, int> DataTypeMap;
79};
80
81#endif // vtkPostgreSQLDatabasePrivate_h
82// VTK-HeaderTest-Exclude: vtkPostgreSQLDatabasePrivate.h
internal details of a connection to a PostgreSQL database
virtual ~vtkPostgreSQLDatabasePrivate()
Destroy the database connection.
#define VTK_STRING
Definition: vtkType.h:60