libvirtualpg  2.0.0
virtualpg.h
Go to the documentation of this file.
1 /*
2 / virtualpg.h
3 /
4 / public declarations
5 /
6 / version 2.0.0-RC0, 2018 July 14
7 /
8 / Author: Sandro Furieri a.furieri@lqt.it
9 /
10 / ------------------------------------------------------------------------------
11 /
12 / Version: MPL 1.1/GPL 2.0/LGPL 2.1
13 /
14 / The contents of this file are subject to the Mozilla Public License Version
15 / 1.1 (the "License"); you may not use this file except in compliance with
16 / the License. You may obtain a copy of the License at
17 / http://www.mozilla.org/MPL/
18 /
19 / Software distributed under the License is distributed on an "AS IS" basis,
20 / WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21 / for the specific language governing rights and limitations under the
22 / License.
23 /
24 / The Original Code is the VirtualPG library
25 /
26 / The Initial Developer of the Original Code is Alessandro Furieri
27 /
28 / Portions created by the Initial Developer are Copyright (C) 2013-2018
29 / the Initial Developer. All Rights Reserved.
30 /
31 / Contributor(s):
32 /
33 / Alternatively, the contents of this file may be used under the terms of
34 / either the GNU General Public License Version 2 or later (the "GPL"), or
35 / the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
36 / in which case the provisions of the GPL or the LGPL are applicable instead
37 / of those above. If you wish to allow use of your version of this file only
38 / under the terms of either the GPL or the LGPL, and not to allow others to
39 / use your version of this file under the terms of the MPL, indicate your
40 / decision by deleting the provisions above and replace them with the notice
41 / and other provisions required by the GPL or the LGPL. If you do not delete
42 / the provisions above, a recipient may use your version of this file under
43 / the terms of any one of the MPL, the GPL or the LGPL.
44 /
45 */
46 
52 #ifndef DOXYGEN_SHOULD_SKIP_THIS
53 #ifdef DLL_EXPORT
54 #define VIRTUALPG_DECLARE __declspec(dllexport)
55 #else
56 #define VIRTUALPG_DECLARE extern
57 #endif
58 #endif
59 
60 #ifndef _VIRTUALPG_H
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 #define _VIRTUALPG_H
63 #endif
64 
65 #include <libpq-fe.h>
66 
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif
71 
77  typedef struct virtualPQstruct
78  {
80  void (*PQclear) (PGresult * res);
82  PGconn *(*PQconnectdb) (const char *conninfo);
84  char *(*PQerrorMessage) (const PGconn * conn);
86  PGresult *(*PQexec) (PGconn * conn, const char *command);
88  void (*PQfinish) (PGconn * conn);
90  int (*PQgetisnull) (const PGresult * res, int row_number,
91  int column_number);
93  char *(*PQgetvalue) (const PGresult * res, int row_number,
94  int column_number);
96  int (*PQlibVersion) (void);
98  int (*PQnfields) (const PGresult * res);
100  int (*PQntuples) (const PGresult * res);
102  ExecStatusType (*PQresultStatus) (const PGresult * res);
104  ConnStatusType (*PQstatus) (const PGconn * conn);
105  } virtualPQ;
112 
114  VIRTUALPG_DECLARE void vpgPQclear (PGresult * res);
116  VIRTUALPG_DECLARE PGconn *vpgPQconnectdb (const char *conninfo);
118  VIRTUALPG_DECLARE char *vpgPQerrorMessage (const PGconn * conn);
120  VIRTUALPG_DECLARE PGresult *vpgPQexec (PGconn * conn, const char *command);
122  VIRTUALPG_DECLARE void vpgPQfinish (PGconn * conn);
124  VIRTUALPG_DECLARE int vpgPQgetisnull (const PGresult * res, int row_number,
125  int column_number);
127  VIRTUALPG_DECLARE char *vpgPQgetvalue (const PGresult * res, int row_number,
128  int column_number);
130  VIRTUALPG_DECLARE int vpgPQlibVersion(void);
132  VIRTUALPG_DECLARE int vpgPQnfields (const PGresult * res);
134  VIRTUALPG_DECLARE int vpgPQntuples (const PGresult * res);
136  VIRTUALPG_DECLARE ExecStatusType vpgPQresultStatus (const PGresult * res);
138  VIRTUALPG_DECLARE ConnStatusType vpgPQstatus (const PGconn * conn);
139 
145  VIRTUALPG_DECLARE const char *virtualpg_version (void);
146 
156  VIRTUALPG_DECLARE int virtualpg_extension_init (sqlite3 * db_handle,
157  virtualPQptr virtual_api);
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif /* _VIRTUALPG_H */
virtualPQ * virtualPQptr
Typedef for virtual libPQ structure.
Definition: virtualpg.h:111
ExecStatusType(* PQresultStatus)(const PGresult *res)
pointer to PQresultStatus
Definition: virtualpg.h:102
VIRTUALPG_DECLARE const char * virtualpg_version(void)
Return the current library version.
VIRTUALPG_DECLARE int virtualpg_extension_init(sqlite3 *db_handle, virtualPQptr virtual_api)
Initializes libvirtualpg as an extension to SQLite.
VIRTUALPG_DECLARE int vpgPQnfields(const PGresult *res)
virtual implementation for LibPQ - PQnfields
struct virtualPQstruct virtualPQ
virtualized libPQ methods
VIRTUALPG_DECLARE int vpgPQntuples(const PGresult *res)
virtual implementation for LibPQ - PQntuples
VIRTUALPG_DECLARE int vpgPQgetisnull(const PGresult *res, int row_number, int column_number)
virtual implementation for LibPQ - PQgetisnull
ConnStatusType(* PQstatus)(const PGconn *conn)
pointer to PQstatus
Definition: virtualpg.h:104
VIRTUALPG_DECLARE ConnStatusType vpgPQstatus(const PGconn *conn)
virtual implementation for LibPQ - PQstatus
VIRTUALPG_DECLARE char * vpgPQerrorMessage(const PGconn *conn)
virtual implementation for LibPQ - PQerrorMessage
virtualized libPQ methods
Definition: virtualpg.h:77
VIRTUALPG_DECLARE ExecStatusType vpgPQresultStatus(const PGresult *res)
virtual implementation for LibPQ - PQresultStatus
VIRTUALPG_DECLARE PGresult * vpgPQexec(PGconn *conn, const char *command)
virtual implementation for LibPQ - PQexec
int(* PQgetisnull)(const PGresult *res, int row_number, int column_number)
pointer to PQgetisnull
Definition: virtualpg.h:90
VIRTUALPG_DECLARE int vpgPQlibVersion(void)
virtual implementation for LibPQ - PQlibVersion
int(* PQlibVersion)(void)
pointer to PQlibVersion
Definition: virtualpg.h:96
void(* PQfinish)(PGconn *conn)
pointer to PQfinish
Definition: virtualpg.h:88
VIRTUALPG_DECLARE PGconn * vpgPQconnectdb(const char *conninfo)
virtual implementation for LibPQ - PQconnectdb
VIRTUALPG_DECLARE void vpgPQfinish(PGconn *conn)
virtual implementation for LibPQ - PQfinish
int(* PQntuples)(const PGresult *res)
pointer to PQntuples
Definition: virtualpg.h:100
int(* PQnfields)(const PGresult *res)
pointer to PQnfields
Definition: virtualpg.h:98
VIRTUALPG_DECLARE void vpgPQclear(PGresult *res)
virtual implementation for LibPQ - PQclear
VIRTUALPG_DECLARE char * vpgPQgetvalue(const PGresult *res, int row_number, int column_number)
virtual implementation for LibPQ - PQgetvalue
void(* PQclear)(PGresult *res)
pointer to PQclear
Definition: virtualpg.h:80