-
Notifications
You must be signed in to change notification settings - Fork 1
/
dbd_pg.h
50 lines (39 loc) · 1.43 KB
/
dbd_pg.h
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
/*
* dbd_pg.h
*
* Copyright (c) 2003-2005 Scheme Arts, L.L.C., All rights reserved.
* Copyright (c) 2003-2005 Time Intermedia Corporation, All rights reserved.
* See COPYING for terms and conditions of using this software
*
*/
/* Prologue */
#ifndef GAUCHE_DBD_PG_H
#define GAUCHE_DBD_PG_H
#include <stdio.h>
#include <libpq-fe.h>
#include <gauche.h>
#include <gauche/extend.h>
SCM_DECL_BEGIN
/*
* Internal Classes
*/
/* We use foreign pointer to hold PG connection and result set
handles. Once a handle is closed, we mark the foreign pointer
so by setting a foreign-pointer-attribute 'closed to #t. */
extern ScmClass *PGConnClass;
#define PG_CONN_P(obj) SCM_XTYPEP(obj, PGConnClass)
#define PG_CONN_UNBOX(obj) SCM_FOREIGN_POINTER_REF(PGconn*, obj)
#define PG_CONN_BOX(conn) Scm_MakeForeignPointer(PGConnClass, conn)
extern ScmClass *PGResultClass;
#define PG_RESULT_P(obj) SCM_XTYPEP(obj, PGResultClass)
#define PG_RESULT_UNBOX(obj) SCM_FOREIGN_POINTER_REF(PGresult*, obj)
#define PG_RESULT_BOX(res) Scm_MakeForeignPointer(PGResultClass, res)
extern ScmClass *PGCancelClass;
#define PG_CANCEL_P(obj) SCM_XTYPEP(obj, PGCancelClass)
#define PG_CANCEL_UNBOX(obj) SCM_FOREIGN_POINTER_REF(PGcancel*, obj)
#define PG_CANCEL_BOX(can) Scm_MakeForeignPointer(PGCancelClass, can)
extern int PGClosedP(ScmObj obj);
extern void PGMarkClosed(ScmObj obj);
/* Epilogue */
SCM_DECL_END
#endif /* GAUCHE_DBD_PG_H */