PostGIS
3.7.0dev-r@@SVN_REVISION@@
postgis_module.c
Go to the documentation of this file.
1
/**********************************************************************
2
*
3
* PostGIS - Spatial Types for PostgreSQL
4
* http://postgis.net
5
*
6
* PostGIS is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* PostGIS is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18
*
19
**********************************************************************
20
*
21
* Copyright (C) 2011 OpenGeo.org
22
*
23
**********************************************************************/
24
25
26
#include "postgres.h"
27
#include "fmgr.h"
28
#include "miscadmin.h"
29
#include "utils/elog.h"
30
#include "utils/guc.h"
31
#include "libpq/pqsignal.h"
32
33
#include "../postgis_config.h"
34
35
#include "
lwgeom_log.h
"
36
#include "lwgeom_pg.h"
37
#include "geos_c.h"
38
39
#ifdef HAVE_LIBPROTOBUF
40
#include "lwgeom_wagyu.h"
41
#endif
42
43
/*
44
* This is required for builds against pgsql
45
*/
46
PG_MODULE_MAGIC
;
47
48
49
static
void
interrupt_geos_callback
()
50
{
51
#ifdef WIN32
52
if
(UNBLOCKED_SIGNAL_QUEUE())
53
{
54
pgwin32_dispatch_queued_signals();
55
}
56
#endif
57
/*
58
* If PgSQL global flags show interrupt,
59
* flip the pending flag in GEOS
60
* to end current query.
61
*/
62
if
(QueryCancelPending || ProcDiePending)
63
{
64
GEOS_interruptRequest();
65
}
66
}
67
68
static
void
interrupt_liblwgeom_callback
()
69
{
70
#ifdef WIN32
71
if
(UNBLOCKED_SIGNAL_QUEUE())
72
{
73
pgwin32_dispatch_queued_signals();
74
}
75
#endif
76
/*
77
* If PgSQL global flags show interrupt,
78
* flip the pending flag in liblwgeom
79
* to end current query.
80
*/
81
if
(QueryCancelPending || ProcDiePending)
82
{
83
lwgeom_request_interrupt
();
84
}
85
}
86
87
/*
88
* Pass proj error message out via the PostgreSQL logging
89
* system instead of letting them default into the
90
* stderr.
91
*/
92
#if POSTGIS_PROJ_VERSION > 60000
93
#include "proj.h"
94
95
static
void
96
pjLogFunction
(
void
*
data
,
int
logLevel,
const
char
* message)
97
{
98
elog(DEBUG1,
"libproj threw an exception (%d): %s"
, logLevel, message);
99
}
100
#endif
101
102
/*
103
* Module load callback
104
*/
105
void
_PG_init
(
void
);
106
void
107
_PG_init
(
void
)
108
{
109
/*
110
* Hook up interrupt checking to call back here
111
* and examine the PgSQL interrupt state variables
112
*/
113
GEOS_interruptRegisterCallback(
interrupt_geos_callback
);
114
lwgeom_register_interrupt_callback
(
interrupt_liblwgeom_callback
);
115
116
/* Install PostgreSQL error/memory handlers */
117
pg_install_lwgeom_handlers();
118
119
#if POSTGIS_PROJ_VERSION > 60000
120
/* Pass proj messages through the pgsql error handler */
121
proj_log_func(NULL, NULL,
pjLogFunction
);
122
#endif
123
124
}
125
126
/*
127
* Module unload callback
128
*/
129
void
_PG_fini
(
void
);
130
void
131
_PG_fini
(
void
)
132
{
133
elog(NOTICE,
"Goodbye from PostGIS %s"
, POSTGIS_VERSION);
134
}
135
136
lwgeom_request_interrupt
void lwgeom_request_interrupt(void)
Request interruption of any running code.
Definition:
lwgeom_api.c:658
lwgeom_register_interrupt_callback
lwinterrupt_callback * lwgeom_register_interrupt_callback(lwinterrupt_callback *)
Definition:
lwgeom_api.c:668
lwgeom_log.h
ovdump.data
data
Definition:
ovdump.py:104
_PG_init
void _PG_init(void)
Definition:
postgis_module.c:107
interrupt_liblwgeom_callback
static void interrupt_liblwgeom_callback()
Definition:
postgis_module.c:68
PG_MODULE_MAGIC
PG_MODULE_MAGIC
Definition:
postgis_module.c:46
_PG_fini
void _PG_fini(void)
Definition:
postgis_module.c:131
interrupt_geos_callback
static void interrupt_geos_callback()
Definition:
postgis_module.c:49
pjLogFunction
static void pjLogFunction(void *data, int logLevel, const char *message)
Definition:
postgis_module.c:96
postgis
postgis_module.c
Generated by
1.9.1