Repository navigation
Expand file tree
/
Copy pathREADME
More file actions
112 lines (84 loc) · 4.26 KB
/
Copy pathREADME
File metadata and controls
112 lines (84 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
pgsql (PostgreSQL) module for Qore
by David Nichols / Qore Technologies, s.r.o.
Requires qore 0.9+, a C++17 compiler, and PostgreSQL client headers and libraries to build
This module is released under a choice of two licenses: LGPL 2.1 and MIT; see
COPYING.LGPL and COPYING.MIT for more information
The driver supports the following features:
* All builtin PostgreSQL data types are supported including:
- Basic types: boolean, bytea, int2, int4, int8, float4, float8, numeric, money
- Text types: text, varchar, char, name
- Date/time types: date, time, timetz, timestamp, timestamptz, interval
- Structured types: json, jsonb, xml
- Network types: macaddr, inet, cidr
- Geometric types: point, line, lseg, box, path, polygon, circle
- Binary types: bytea, bit, varbit
* Multi-dimensional arrays are supported for binding and retrieving
* Is thread-safe
* Stored procedure execution is supported
* Transaction management is supported
* Transparent character encoding conversion is supported if necessary
* The "optimal-numbers" option is set by default as of module version 2.2
* Supports a server timezone setting for correctly handling date/time values
when communicating with a DB server in another time zone
* The prepared statement API is supported (SQLStatement class)
* Automatic reconnection to the server if the connection is lost (when not in a transaction)
* Full support for PostgreSQL error codes in exceptions
The driver's name is "pgsql" and the Datasource type constant is SQL::DSPGSQL
Example: Datasource db = new Datasource(DSPGSQL);
Example: Datasource db = new Datasource("pgsql");
Example: Datasource db = new Datasource("pgsql:user/pass@dbname%hostname:5432");
The Qore pgsql driver uses binary communication with PostgreSQL servers and sets
per-connection variables based on server settings (i.e. it automatically determines
if the server is using floats or 64-bit integers for time values, etc).
This module is stable and has been extensively tested.
Documentation: docs/pgsql-module-doc.html (generated by Doxygen)
Test script: test/pgsql.qtest
DRIVER OPTIONS
--------------
The driver supports the following options:
* "optimal-numbers": return numeric types as an integer if possible, otherwise as
an arbitrary-precision number (default)
* "string-numbers": return numeric types as strings (for backwards-compatibility)
* "numeric-numbers": return numeric types as arbitrary-precision number values
* "timezone": set the server's time zone (region name like "Europe/Prague" or
UTC offset like "+01:00")
Options can be set in the Datasource constructor:
Datasource db("pgsql:user/pass@dbname{numeric-numbers,timezone=Europe/Vienna}");
LICENSE
-------
The source code is released under the LGPL 2.1 and MIT licenses; either license
may be used at the user's discretion. Note that both licenses are treated
equally by the Qore library in the sense that both licenses allow the module
to be loaded without restrictions by the Qore library (even when the Qore
library is initialized in GPL mode).
See COPYING.MIT and COPYING.LGPL for details on the open-source licenses.
BUILD AND INSTALL
-----------------
PostgreSQL DBI module requires PostgreSQL 8+ client libraries and headers, a
C++17 compiler, and CMake. If your PostgreSQL libraries are in a non-standard
location, set the PostgreSQL_INCLUDE_DIR, PostgreSQL_TYPE_INCLUDE_DIR, and
PostgreSQL_LIBRARY environment variables (or pass them as -D options to cmake).
mkdir build
cd build
cmake ..
make
sudo make install
The install prefix should match the prefix where Qore is installed; for
example, if qore is /usr/bin/qore, use -DCMAKE_INSTALL_PREFIX=/usr.
To build the API documentation (requires doxygen):
make docs
RUNNING TESTS
-------------
Set the QORE_DB_CONNSTR_PGSQL environment variable to a valid PostgreSQL
connection string, then run:
qore test/pgsql.qtest
Example:
export QORE_DB_CONNSTR_PGSQL="pgsql:user/pass@db"
qore test/pgsql.qtest
Docker-based tests are also available in test/docker_test/
Develop CI
----------
After a squash merge into develop, CI checks the merged pull request head
as well as the merge commit and its parents. It reuses an earlier result
only when the Git trees match and the existing pipeline checks pass.
A missing PR, changed tree, or unavailable evidence runs the full suite.