2004-10-19 07:17:12 +04:00
|
|
|
/* microprotocols.c - definitions for minimalist and non-validating protocols
|
|
|
|
*
|
2019-02-17 04:34:52 +03:00
|
|
|
* Copyright (C) 2003-2019 Federico Di Gregorio <fog@debian.org>
|
2004-10-19 07:17:12 +04:00
|
|
|
*
|
|
|
|
* This file is part of psycopg.
|
|
|
|
*
|
2010-02-13 01:34:53 +03:00
|
|
|
* psycopg2 is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2004-10-19 07:17:12 +04:00
|
|
|
*
|
2010-02-13 01:34:53 +03:00
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link this program with the OpenSSL library (or with
|
|
|
|
* modified versions of OpenSSL that use the same license as OpenSSL),
|
|
|
|
* and distribute linked combinations including the two.
|
2004-10-19 07:17:12 +04:00
|
|
|
*
|
2010-02-13 01:34:53 +03:00
|
|
|
* You must obey the GNU Lesser General Public License in all respects for
|
|
|
|
* all of the code used other than OpenSSL.
|
|
|
|
*
|
|
|
|
* psycopg2 is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
* License for more details.
|
2004-10-19 07:17:12 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PSYCOPG_MICROPROTOCOLS_H
|
|
|
|
#define PSYCOPG_MICROPROTOCOLS_H 1
|
|
|
|
|
2005-04-10 09:38:34 +04:00
|
|
|
#include "psycopg/connection.h"
|
|
|
|
#include "psycopg/cursor.h"
|
2004-10-19 07:17:12 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** adapters registry **/
|
|
|
|
|
2008-01-21 08:54:01 +03:00
|
|
|
extern HIDDEN PyObject *psyco_adapters;
|
2004-10-19 07:17:12 +04:00
|
|
|
|
|
|
|
/** the names of the three mandatory methods **/
|
|
|
|
|
|
|
|
#define MICROPROTOCOLS_GETQUOTED_NAME "getquoted"
|
|
|
|
#define MICROPROTOCOLS_GETSTRING_NAME "getstring"
|
|
|
|
#define MICROPROTOCOLS_GETBINARY_NAME "getbinary"
|
|
|
|
|
|
|
|
/** exported functions **/
|
|
|
|
|
|
|
|
/* used by module.c to init the microprotocols system */
|
2019-01-22 16:54:06 +03:00
|
|
|
HIDDEN RAISES_NEG int microprotocols_init(PyObject *dict);
|
|
|
|
HIDDEN RAISES_NEG int microprotocols_add(
|
2004-10-19 07:17:12 +04:00
|
|
|
PyTypeObject *type, PyObject *proto, PyObject *cast);
|
2007-04-10 10:36:18 +04:00
|
|
|
|
2008-01-21 08:54:01 +03:00
|
|
|
HIDDEN PyObject *microprotocols_adapt(
|
2004-10-19 07:17:12 +04:00
|
|
|
PyObject *obj, PyObject *proto, PyObject *alt);
|
2008-01-21 08:54:01 +03:00
|
|
|
HIDDEN PyObject *microprotocol_getquoted(
|
2005-04-10 09:38:34 +04:00
|
|
|
PyObject *obj, connectionObject *conn);
|
2007-04-10 10:36:18 +04:00
|
|
|
|
2008-01-21 08:54:01 +03:00
|
|
|
HIDDEN PyObject *
|
2007-04-10 10:36:18 +04:00
|
|
|
psyco_microprotocols_adapt(cursorObject *self, PyObject *args);
|
2004-10-19 07:17:12 +04:00
|
|
|
#define psyco_microprotocols_adapt_doc \
|
2005-11-26 10:47:48 +03:00
|
|
|
"adapt(obj, protocol, alternate) -> object -- adapt obj to given protocol"
|
2007-04-10 10:36:18 +04:00
|
|
|
|
2004-10-19 07:17:12 +04:00
|
|
|
#endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */
|