1
/* microprotocols.c - definitions for minimalist and non-validating protocols
3
* Copyright (C) 2003-2004 Federico Di Gregorio <fog@debian.org>
5
* This file is part of psycopg.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2,
10
* or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#ifndef PSYCOPG_MICROPROTOCOLS_H
23
#define PSYCOPG_MICROPROTOCOLS_H 1
26
#include "psycopg/connection.h"
27
#include "psycopg/cursor.h"
33
/** adapters registry **/
35
extern PyObject *psyco_adapters;
37
/** the names of the three mandatory methods **/
39
#define MICROPROTOCOLS_GETQUOTED_NAME "getquoted"
40
#define MICROPROTOCOLS_GETSTRING_NAME "getstring"
41
#define MICROPROTOCOLS_GETBINARY_NAME "getbinary"
43
/** exported functions **/
45
/* used by module.c to init the microprotocols system */
46
extern int microprotocols_init(PyObject *dict);
47
extern int microprotocols_add(
48
PyTypeObject *type, PyObject *proto, PyObject *cast);
50
extern PyObject *microprotocols_adapt(
51
PyObject *obj, PyObject *proto, PyObject *alt);
52
extern PyObject *microprotocol_getquoted(
53
PyObject *obj, connectionObject *conn);
56
psyco_microprotocols_adapt(cursorObject *self, PyObject *args);
57
#define psyco_microprotocols_adapt_doc \
58
"adapt(obj, protocol, alternate) -> object -- adapt obj to given protocol"
60
#endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */