| 1 | /* microprotocols.c - definitions for minimalist and non-validating protocols
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright (C) 2003-2004 Federico Di Gregorio <[email protected]>
|
|---|
| 4 | *
|
|---|
| 5 | * This file is part of psycopg and was adapted for pysqlite. Federico Di
|
|---|
| 6 | * Gregorio gave the permission to use it within pysqlite under the following
|
|---|
| 7 | * license:
|
|---|
| 8 | *
|
|---|
| 9 | * This software is provided 'as-is', without any express or implied
|
|---|
| 10 | * warranty. In no event will the authors be held liable for any damages
|
|---|
| 11 | * arising from the use of this software.
|
|---|
| 12 | *
|
|---|
| 13 | * Permission is granted to anyone to use this software for any purpose,
|
|---|
| 14 | * including commercial applications, and to alter it and redistribute it
|
|---|
| 15 | * freely, subject to the following restrictions:
|
|---|
| 16 | *
|
|---|
| 17 | * 1. The origin of this software must not be misrepresented; you must not
|
|---|
| 18 | * claim that you wrote the original software. If you use this software
|
|---|
| 19 | * in a product, an acknowledgment in the product documentation would be
|
|---|
| 20 | * appreciated but is not required.
|
|---|
| 21 | * 2. Altered source versions must be plainly marked as such, and must not be
|
|---|
| 22 | * misrepresented as being the original software.
|
|---|
| 23 | * 3. This notice may not be removed or altered from any source distribution.
|
|---|
| 24 | */
|
|---|
| 25 |
|
|---|
| 26 | #ifndef PSYCOPG_MICROPROTOCOLS_H
|
|---|
| 27 | #define PSYCOPG_MICROPROTOCOLS_H 1
|
|---|
| 28 |
|
|---|
| 29 | #include <Python.h>
|
|---|
| 30 |
|
|---|
| 31 | #ifdef __cplusplus
|
|---|
| 32 | extern "C" {
|
|---|
| 33 | #endif
|
|---|
| 34 |
|
|---|
| 35 | /** adapters registry **/
|
|---|
| 36 |
|
|---|
| 37 | extern PyObject *psyco_adapters;
|
|---|
| 38 |
|
|---|
| 39 | /** the names of the three mandatory methods **/
|
|---|
| 40 |
|
|---|
| 41 | #define MICROPROTOCOLS_GETQUOTED_NAME "getquoted"
|
|---|
| 42 | #define MICROPROTOCOLS_GETSTRING_NAME "getstring"
|
|---|
| 43 | #define MICROPROTOCOLS_GETBINARY_NAME "getbinary"
|
|---|
| 44 |
|
|---|
| 45 | /** exported functions **/
|
|---|
| 46 |
|
|---|
| 47 | /* used by module.c to init the microprotocols system */
|
|---|
| 48 | extern int microprotocols_init(PyObject *dict);
|
|---|
| 49 | extern int microprotocols_add(
|
|---|
| 50 | PyTypeObject *type, PyObject *proto, PyObject *cast);
|
|---|
| 51 | extern PyObject *microprotocols_adapt(
|
|---|
| 52 | PyObject *obj, PyObject *proto, PyObject *alt);
|
|---|
| 53 |
|
|---|
| 54 | extern PyObject *
|
|---|
| 55 | psyco_microprotocols_adapt(Cursor* self, PyObject *args);
|
|---|
| 56 | #define psyco_microprotocols_adapt_doc \
|
|---|
| 57 | "adapt(obj, protocol, alternate) -> adapt obj to given protocol. Non-standard."
|
|---|
| 58 |
|
|---|
| 59 | #endif /* !defined(PSYCOPG_MICROPROTOCOLS_H) */
|
|---|