~ubuntu-branches/ubuntu/hardy/psycopg2/hardy

« back to all changes in this revision

Viewing changes to psycopg/microprotocols.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2006-08-09 10:28:30 UTC
  • Revision ID: james.westby@ubuntu.com-20060809102830-grac1dsp24uyqfp4
Tags: upstream-2.0.4
ImportĀ upstreamĀ versionĀ 2.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* microprotocols.c - definitions for minimalist and non-validating protocols
 
2
 *
 
3
 * Copyright (C) 2003-2004 Federico Di Gregorio <fog@debian.org>
 
4
 *
 
5
 * This file is part of psycopg.
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 */
 
21
 
 
22
#ifndef PSYCOPG_MICROPROTOCOLS_H
 
23
#define PSYCOPG_MICROPROTOCOLS_H 1
 
24
 
 
25
#include <Python.h>
 
26
#include "psycopg/connection.h"
 
27
#include "psycopg/cursor.h"
 
28
 
 
29
#ifdef __cplusplus
 
30
extern "C" {
 
31
#endif
 
32
 
 
33
/** adapters registry **/
 
34
 
 
35
extern PyObject *psyco_adapters;
 
36
 
 
37
/** the names of the three mandatory methods **/
 
38
 
 
39
#define MICROPROTOCOLS_GETQUOTED_NAME "getquoted"
 
40
#define MICROPROTOCOLS_GETSTRING_NAME "getstring"
 
41
#define MICROPROTOCOLS_GETBINARY_NAME "getbinary"
 
42
 
 
43
/** exported functions **/
 
44
 
 
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);
 
49
    
 
50
extern PyObject *microprotocols_adapt(
 
51
    PyObject *obj, PyObject *proto, PyObject *alt);
 
52
extern PyObject *microprotocol_getquoted(
 
53
    PyObject *obj, connectionObject *conn);
 
54
    
 
55
extern PyObject *
 
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"
 
59
    
 
60
#endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */