1 #include <libpq-fe.h> |
1 #include <libpq-fe.h> |
2 #include <postgres.h> |
2 #include <postgres.h> |
3 #include <catalog/pg_type.h> |
3 #include <catalog/pg_type.h> |
4 #include <dbd/common.h> |
4 #include <dbd/common.h> |
5 |
5 |
|
6 /* |
|
7 * length of a prepared statement ID |
|
8 * \d{17}\0 |
|
9 */ |
6 #define IDLEN 18 |
10 #define IDLEN 18 |
7 |
11 |
8 #define DBD_POSTGRESQL_CONNECTION "DBD.PostgreSQL.Connection" |
12 #define DBD_POSTGRESQL_CONNECTION "DBD.PostgreSQL.Connection" |
9 #define DBD_POSTGRESQL_STATEMENT "DBD.PostgreSQL.Statement" |
13 #define DBD_POSTGRESQL_STATEMENT "DBD.PostgreSQL.Statement" |
10 |
14 |
|
15 /* |
|
16 * connection object implentation |
|
17 */ |
11 typedef struct _connection { |
18 typedef struct _connection { |
12 PGconn *postgresql; |
19 PGconn *postgresql; |
13 unsigned int statement_id; |
20 unsigned int statement_id; /* sequence for statement IDs */ |
14 } connection_t; |
21 } connection_t; |
15 |
22 |
|
23 /* |
|
24 * statement object implementation |
|
25 */ |
16 typedef struct _statement { |
26 typedef struct _statement { |
17 PGconn *postgresql; |
27 PGconn *postgresql; |
18 PGresult *result; |
28 PGresult *result; |
19 char name[IDLEN]; |
29 char name[IDLEN]; /* statement ID */ |
20 int tuple; |
30 int tuple; /* number of rows returned */ |
21 } statement_t; |
31 } statement_t; |
22 |
32 |