<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>VTK: dox/IO/vtkPostgreSQLDatabasePrivate.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>dox/IO/vtkPostgreSQLDatabasePrivate.h</h1><a href="a03181.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C++; -*- */</span> <a name="l00002"></a>00002 <span class="comment">/*=========================================================================</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> Program: Visualization Toolkit</span> <a name="l00005"></a>00005 <span class="comment"> Module: $RCSfile: vtkPostgreSQLDatabasePrivate.h,v $</span> <a name="l00006"></a>00006 <span class="comment"></span> <a name="l00007"></a>00007 <span class="comment"> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</span> <a name="l00008"></a>00008 <span class="comment"> All rights reserved.</span> <a name="l00009"></a>00009 <span class="comment"> See Copyright.txt or http://www.kitware.com/Copyright.htm for details.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even</span> <a name="l00012"></a>00012 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</span> <a name="l00013"></a>00013 <span class="comment"> PURPOSE. See the above copyright notice for more information.</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment">=========================================================================*/</span> <a name="l00016"></a>00016 <span class="comment">/*-------------------------------------------------------------------------</span> <a name="l00017"></a>00017 <span class="comment"> Copyright 2008 Sandia Corporation.</span> <a name="l00018"></a>00018 <span class="comment"> Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,</span> <a name="l00019"></a>00019 <span class="comment"> the U.S. Government retains certain rights in this software.</span> <a name="l00020"></a>00020 <span class="comment">-------------------------------------------------------------------------*/</span> <a name="l00021"></a>00021 <a name="l00036"></a>00036 <span class="preprocessor">#ifndef __vtkPostgreSQLDatabasePrivate_h</span> <a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define __vtkPostgreSQLDatabasePrivate_h</span> <a name="l00038"></a>00038 <span class="preprocessor"></span> <a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="a02135.html">vtkStdString.h</a>"</span> <a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="a02149.html">vtkType.h</a>"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="a02146.html">vtkTimeStamp.h</a>"</span> <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="preprocessor">#include <libpq-fe.h></span> <a name="l00044"></a>00044 <span class="preprocessor">#include <vtksys/stl/map></span> <a name="l00045"></a>00045 <a name="l00046"></a><a class="code" href="a01289.html">00046</a> <span class="keyword">class </span><a class="code" href="a01289.html" title="internal details of a connection to a PostgreSQL database">vtkPostgreSQLDatabasePrivate</a> <a name="l00047"></a>00047 { <a name="l00048"></a>00048 <span class="keyword">public</span>: <a name="l00049"></a><a class="code" href="a01289.html#ef35ecf006220423e5928241c70712da">00049</a> <a class="code" href="a01289.html#ef35ecf006220423e5928241c70712da">vtkPostgreSQLDatabasePrivate</a>() <a name="l00050"></a>00050 { <a name="l00051"></a>00051 this-><a class="code" href="a01289.html#f7aee3b073862a2f446019ae6f3489e6">Connection</a> = NULL; <a name="l00052"></a>00052 } <a name="l00053"></a>00053 <a name="l00055"></a>00055 <a name="l00057"></a><a class="code" href="a01289.html#8d3779b6a093f5a80c3b6306f884f5bf">00057</a> <span class="keyword">virtual</span> <a class="code" href="a01289.html#8d3779b6a093f5a80c3b6306f884f5bf">~vtkPostgreSQLDatabasePrivate</a>() <a name="l00058"></a>00058 { <a name="l00059"></a>00059 <span class="keywordflow">if</span> (this-><a class="code" href="a01289.html#f7aee3b073862a2f446019ae6f3489e6">Connection</a>) <a name="l00060"></a>00060 { <a name="l00061"></a>00061 PQfinish(this-><a class="code" href="a01289.html#f7aee3b073862a2f446019ae6f3489e6">Connection</a>); <a name="l00062"></a>00062 } <a name="l00063"></a>00063 } <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="comment">// Given a Postgres column type OID, return a VTK array type (see vtkType.h).</span> <a name="l00067"></a><a class="code" href="a01289.html#ac771191371d33874ba9200f68467ac0">00067</a> <span class="keywordtype">int</span> <a class="code" href="a01289.html#ac771191371d33874ba9200f68467ac0">GetVTKTypeFromOID</a>( Oid pgtype ) <a name="l00068"></a>00068 { <a name="l00069"></a>00069 vtksys_stl::map<Oid,int>::const_iterator it = this-><a class="code" href="a01289.html#57b4097f4f80783af75ab83f61222d19">DataTypeMap</a>.find( pgtype ); <a name="l00070"></a>00070 <span class="keywordflow">if</span> ( it == this-><a class="code" href="a01289.html#57b4097f4f80783af75ab83f61222d19">DataTypeMap</a>.end() ) <a name="l00071"></a>00071 { <a name="l00072"></a>00072 <span class="keywordflow">return</span> <a class="code" href="a02149.html#a20f763f1c4fd54f98a52e71c2a04b30">VTK_STRING</a>; <a name="l00073"></a>00073 } <a name="l00074"></a>00074 <span class="keywordflow">return</span> it->second; <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a name="l00077"></a>00077 <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="comment">// This is the actual database connection. It will be NULL if no</span> <a name="l00080"></a>00080 <span class="comment">// connection is open.</span> <a name="l00081"></a><a class="code" href="a01289.html#f7aee3b073862a2f446019ae6f3489e6">00081</a> PGconn *<a class="code" href="a01289.html#f7aee3b073862a2f446019ae6f3489e6">Connection</a>; <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">// Map Postgres column types to VTK types.</span> <a name="l00084"></a><a class="code" href="a01289.html#57b4097f4f80783af75ab83f61222d19">00084</a> vtksys_stl::map<Oid,int> <a class="code" href="a01289.html#57b4097f4f80783af75ab83f61222d19">DataTypeMap</a>; <a name="l00085"></a>00085 }; <a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="preprocessor">#endif // __vtkPostgreSQLDatabasePrivate_h</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 3 18:35:40 2009 for VTK by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>