VTK
9.1.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
IO
PostgreSQL
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
46
class
vtkPostgreSQLDatabasePrivate
47
{
48
public
:
49
vtkPostgreSQLDatabasePrivate
() { this->
Connection
=
nullptr
; }
50
54
virtual
~vtkPostgreSQLDatabasePrivate
()
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
vtkPostgreSQLDatabasePrivate
internal details of a connection to a PostgreSQL database
Definition:
vtkPostgreSQLDatabasePrivate.h:47
vtkPostgreSQLDatabasePrivate::DataTypeMap
std::map< Oid, int > DataTypeMap
Definition:
vtkPostgreSQLDatabasePrivate.h:78
vtkPostgreSQLDatabasePrivate::~vtkPostgreSQLDatabasePrivate
virtual ~vtkPostgreSQLDatabasePrivate()
Destroy the database connection.
Definition:
vtkPostgreSQLDatabasePrivate.h:54
vtkPostgreSQLDatabasePrivate::GetVTKTypeFromOID
int GetVTKTypeFromOID(Oid pgtype)
Definition:
vtkPostgreSQLDatabasePrivate.h:63
vtkPostgreSQLDatabasePrivate::vtkPostgreSQLDatabasePrivate
vtkPostgreSQLDatabasePrivate()
Definition:
vtkPostgreSQLDatabasePrivate.h:49
vtkPostgreSQLDatabasePrivate::Connection
PGconn * Connection
Definition:
vtkPostgreSQLDatabasePrivate.h:75
vtkStdString.h
vtkTimeStamp.h
vtkType.h
VTK_STRING
#define VTK_STRING
Definition:
vtkType.h:60
Generated on Fri Apr 21 2023 10:28:58 for VTK by
1.9.6