KDb

PostgresqlTypes.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2003 Adam Pigg <adam@piggz.co.uk>
3 Copyright (C) 2010 Jarosław Staniek <staniek@kde.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#include "PostgresqlDriver.h"
22
23#ifdef _MSC_VER
24#pragma warning(push)
25#pragma warning(disable: 4200) // "nonstandard extension used : zero-sized array in struct/union"
26#endif
27
28#ifdef __GNUC__
29# pragma GCC diagnostic push
30// remove c.h: warning: ISO C++ does not support ‘__int128’ for ‘int128’ [-Wpedantic]
31# pragma GCC diagnostic ignored "-Wpedantic"
32# include <postgres.h>
33# pragma GCC diagnostic pop
34#else
35# include <postgres.h>
36#endif
37#include <libpq-fe.h>
38#include <catalog/pg_type.h> // needed for BOOLOID, etc.
39#include <pg_config.h> // needed for PG_VERSION_NUM
40
41#ifdef _MSC_VER
42#pragma warning( pop )
43#endif
44
45void PostgresqlDriver::initPgsqlToKDbMap()
46{
47 m_pgsqlToKDbTypes.insert(BOOLOID, KDbField::Boolean);
48 m_pgsqlToKDbTypes.insert(BYTEAOID, KDbField::BLOB);
49 m_pgsqlToKDbTypes.insert(CHAROID, KDbField::Integer);
50 m_pgsqlToKDbTypes.insert(NAMEOID, KDbField::BLOB);
51 m_pgsqlToKDbTypes.insert(INT8OID, KDbField::BigInteger);
52 m_pgsqlToKDbTypes.insert(INT2OID, KDbField::Integer);
53 //! @todo INT2VECTOROID? (array of int2, used in system tables)
54 m_pgsqlToKDbTypes.insert(INT4OID, KDbField::Integer);
55 m_pgsqlToKDbTypes.insert(REGPROCOID, KDbField::Integer);
56 m_pgsqlToKDbTypes.insert(TEXTOID, KDbField::LongText);
57 m_pgsqlToKDbTypes.insert(OIDOID, KDbField::Integer);
58 //! @todo TIDOID? (block, offset), physical location of tuple
59 m_pgsqlToKDbTypes.insert(XIDOID, KDbField::Integer);
60 m_pgsqlToKDbTypes.insert(CIDOID, KDbField::Integer);
61 //! @todo OIDVECTOROID? (array of oids, used in system tables)
62 // PG_TYPE_RELTYPE_OID
63 // PG_ATTRIBUTE_RELTYPE_OID
64 // PG_PROC_RELTYPE_OID
65 // PG_CLASS_RELTYPE_OID
66 m_pgsqlToKDbTypes.insert(XMLOID, KDbField::LongText);
67 //! @todo POINTOID geometric point '(x, y)
68 //! @todo LSEGOID geometric line segment '(pt1,pt2)
69 //! @todo PATHOID geometric path '(pt1,...)'
70 //! @todo BOXOID geometric box '(lower left,upper right)
71 //! @todo POLYGONOID geometric polygon '(pt1,...)'
72 m_pgsqlToKDbTypes.insert(FLOAT4OID, KDbField::Double);
73 m_pgsqlToKDbTypes.insert(FLOAT8OID, KDbField::Double);
74#if PG_VERSION_NUM < 120000
75 m_pgsqlToKDbTypes.insert(ABSTIMEOID, KDbField::Date);
76 m_pgsqlToKDbTypes.insert(RELTIMEOID, KDbField::Date);
77#endif
78 //! @todo TINTERVALOID (abstime,abstime), time interval
79 //! @todo CIRCLEOID geometric circle '(center,radius)'
80 //! @todo CASHOID monetary amounts, $d,ddd.cc
81 //! @todo MACADDROID XX:XX:XX:XX:XX:XX, MAC address
82 //! @todo INETOID IP address/netmask, host address, netmask optional
83 //! @todo CIDROID network IP address/netmask, network address
84 //! @todo INT4ARRAYOID
85 //! @todo FLOAT4ARRAYOID
86 //! @todo ACLITEMOID access control list
87 m_pgsqlToKDbTypes.insert(CSTRINGARRAYOID, KDbField::BLOB);
88 m_pgsqlToKDbTypes.insert(BPCHAROID, KDbField::LongText); // char(length), blank-padded string,
89 // fixed storage length
90 m_pgsqlToKDbTypes.insert(VARCHAROID, KDbField::LongText); // varchar(length), non-blank-padded string,
91 // variable storage length
92 m_pgsqlToKDbTypes.insert(DATEOID, KDbField::Date);
93 m_pgsqlToKDbTypes.insert(TIMEOID, KDbField::Time);
94 m_pgsqlToKDbTypes.insert(TIMESTAMPOID, KDbField::DateTime);
95 m_pgsqlToKDbTypes.insert(TIMESTAMPTZOID, KDbField::DateTime);
96 //! @todo INTERVALOID @ <number> <units>, time interval
97 m_pgsqlToKDbTypes.insert(TIMETZOID, KDbField::Time);
98 //! @todo BITOID ok?
99 m_pgsqlToKDbTypes.insert(BITOID, KDbField::BLOB);
100 //! @todo VARBITOID ok?
101 m_pgsqlToKDbTypes.insert(VARBITOID, KDbField::BLOB);
102 m_pgsqlToKDbTypes.insert(NUMERICOID, KDbField::Double);
103 //! @todo REFCURSOROID reference cursor (portal name)
104 //! @todo REGPROCEDUREOID registered procedure (with args)
105 //! @todo REGOPEROID registered operator
106 //! @todo REGOPERATOROID registered operator (with args)
107 //! @todo REGCLASSOID registered class
108 //! @todo REGTYPEOID registered type
109 //! @todo REGTYPEARRAYOID
110 //! @todo TSVECTOROID text representation for text search
111 //! @todo GTSVECTOROID GiST index internal text representation for text search
112 //! @todo TSQUERYOID query representation for text search
113 //! @todo REGCONFIGOID registered text search configuration
114 //! @todo REGDICTIONARYOID registered text search dictionary
115 //! @todo RECORDOID
116 //! @todo CSTRINGOID
117 //! @todo ANYOID
118 //! @todo ANYARRAYOID
119 //! @todo VOIDOID
120 //! @todo TRIGGEROID
121 //! @todo LANGUAGE_HANDLEROID
122 //! @todo INTERNALOID
123 //! @todo OPAQUEOID
124 //! @todo ANYELEMENTOID
125 //! @todo ANYNONARRAYOID
126 //! @todo ANYENUMOID
127}
@ Integer
Definition KDbField.h:90
@ Boolean
Definition KDbField.h:92
@ BigInteger
Definition KDbField.h:91
@ LongText
Definition KDbField.h:99
iterator insert(const Key &key, const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.