Updated Copyright year to 2013
[getmangos.git] / src / shared / Database / QueryResultPostgre.h
blobffbeb25e811117f4b89d70bda48d23d1378f9202
1 /*
2 * Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #if !defined(QUERYRESULTPOSTGRE_H)
20 #define QUERYRESULTPOSTGRE_H
22 #ifdef WIN32
23 #define FD_SETSIZE 1024
24 #include <winsock2.h>
25 #include <postgre/libpq-fe.h>
26 #include <postgre/pg_type.h>
27 #else
28 // Define OID's from pg_type.h in postgresql server includes.
29 #define BOOLOID 16
30 #define BYTEAOID 17
31 #define CHAROID 18
32 #define NAMEOID 19
33 #define INT8OID 20
34 #define INT2OID 21
35 #define INT2VECTOROID 22
36 #define INT4OID 23
37 #define REGPROCOID 24
38 #define TEXTOID 25
39 #define OIDOID 26
40 #define TIDOID 27
41 #define XIDOID 28
42 #define CIDOID 29
43 #define OIDVECTOROID 30
44 #define POINTOID 600
45 #define LSEGOID 601
46 #define PATHOID 602
47 #define BOXOID 603
48 #define POLYGONOID 604
49 #define LINEOID 628
50 #define FLOAT4OID 700
51 #define FLOAT8OID 701
52 #define ABSTIMEOID 702
53 #define RELTIMEOID 703
54 #define TINTERVALOID 704
55 #define UNKNOWNOID 705
56 #define CIRCLEOID 718
57 #define CASHOID 790
58 #define INETOID 869
59 #define CIDROID 650
60 #define BPCHAROID 1042
61 #define VARCHAROID 1043
62 #define DATEOID 1082
63 #define TIMEOID 1083
64 #define TIMESTAMPOID 1114
65 #define TIMESTAMPTZOID 1184
66 #define INTERVALOID 1186
67 #define TIMETZOID 1266
68 #define BITOID 1560
69 #define VARBITOID 1562
70 #define NUMERICOID 1700
71 #include <libpq-fe.h>
72 #endif
74 class QueryResultPostgre : public QueryResult
76 public:
77 QueryResultPostgre(PGresult* result, uint64 rowCount, uint32 fieldCount);
79 ~QueryResultPostgre();
81 bool NextRow() override;
83 private:
84 enum Field::DataTypes ConvertNativeType(Oid pOid) const;
85 void EndQuery() override;
87 PGresult* mResult;
88 uint32 mTableIndex;
90 #endif