+++ /dev/null
-/* connection.h - definitions for the connection type\r
- *\r
- * Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>\r
- *\r
- * This file is part of pysqlite.\r
- *\r
- * This software is provided 'as-is', without any express or implied\r
- * warranty. In no event will the authors be held liable for any damages\r
- * arising from the use of this software.\r
- *\r
- * Permission is granted to anyone to use this software for any purpose,\r
- * including commercial applications, and to alter it and redistribute it\r
- * freely, subject to the following restrictions:\r
- *\r
- * 1. The origin of this software must not be misrepresented; you must not\r
- * claim that you wrote the original software. If you use this software\r
- * in a product, an acknowledgment in the product documentation would be\r
- * appreciated but is not required.\r
- * 2. Altered source versions must be plainly marked as such, and must not be\r
- * misrepresented as being the original software.\r
- * 3. This notice may not be removed or altered from any source distribution.\r
- */\r
-\r
-#ifndef PYSQLITE_CONNECTION_H\r
-#define PYSQLITE_CONNECTION_H\r
-#include "Python.h"\r
-#include "pythread.h"\r
-#include "structmember.h"\r
-\r
-#include "cache.h"\r
-#include "module.h"\r
-\r
-#include "sqlite3.h"\r
-\r
-typedef struct\r
-{\r
- PyObject_HEAD\r
- sqlite3* db;\r
-\r
- /* 1 if we are currently within a transaction, i. e. if a BEGIN has been\r
- * issued */\r
- int inTransaction;\r
-\r
- /* the type detection mode. Only 0, PARSE_DECLTYPES, PARSE_COLNAMES or a\r
- * bitwise combination thereof makes sense */\r
- int detect_types;\r
-\r
- /* the timeout value in seconds for database locks */\r
- double timeout;\r
-\r
- /* for internal use in the timeout handler: when did the timeout handler\r
- * first get called with count=0? */\r
- double timeout_started;\r
-\r
- /* None for autocommit, otherwise a PyString with the isolation level */\r
- PyObject* isolation_level;\r
-\r
- /* NULL for autocommit, otherwise a string with the BEGIN statement; will be\r
- * freed in connection destructor */\r
- char* begin_statement;\r
-\r
- /* 1 if a check should be performed for each API call if the connection is\r
- * used from the same thread it was created in */\r
- int check_same_thread;\r
-\r
- int initialized;\r
-\r
- /* thread identification of the thread the connection was created in */\r
- long thread_ident;\r
-\r
- pysqlite_Cache* statement_cache;\r
-\r
- /* Lists of weak references to statements and cursors used within this connection */\r
- PyObject* statements;\r
- PyObject* cursors;\r
-\r
- /* Counters for how many statements/cursors were created in the connection. May be\r
- * reset to 0 at certain intervals */\r
- int created_statements;\r
- int created_cursors;\r
-\r
- PyObject* row_factory;\r
-\r
- /* Determines how bytestrings from SQLite are converted to Python objects:\r
- * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings\r
- * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created.\r
- * - PyString_Type: PyStrings are created as-is.\r
- * - Any custom callable: Any object returned from the callable called with the bytestring\r
- * as single parameter.\r
- */\r
- PyObject* text_factory;\r
-\r
- /* remember references to functions/classes used in\r
- * create_function/create/aggregate, use these as dictionary keys, so we\r
- * can keep the total system refcount constant by clearing that dictionary\r
- * in connection_dealloc */\r
- PyObject* function_pinboard;\r
-\r
- /* a dictionary of registered collation name => collation callable mappings */\r
- PyObject* collations;\r
-\r
- /* if our connection was created from a APSW connection, we keep a\r
- * reference to the APSW connection around and get rid of it in our\r
- * destructor */\r
- PyObject* apsw_connection;\r
-\r
- /* Exception objects */\r
- PyObject* Warning;\r
- PyObject* Error;\r
- PyObject* InterfaceError;\r
- PyObject* DatabaseError;\r
- PyObject* DataError;\r
- PyObject* OperationalError;\r
- PyObject* IntegrityError;\r
- PyObject* InternalError;\r
- PyObject* ProgrammingError;\r
- PyObject* NotSupportedError;\r
-} pysqlite_Connection;\r
-\r
-extern PyTypeObject pysqlite_ConnectionType;\r
-\r
-PyObject* pysqlite_connection_alloc(PyTypeObject* type, int aware);\r
-void pysqlite_connection_dealloc(pysqlite_Connection* self);\r
-PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);\r
-PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args);\r
-PyObject* _pysqlite_connection_begin(pysqlite_Connection* self);\r
-PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args);\r
-PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args);\r
-PyObject* pysqlite_connection_new(PyTypeObject* type, PyObject* args, PyObject* kw);\r
-int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs);\r
-\r
-int pysqlite_connection_register_cursor(pysqlite_Connection* connection, PyObject* cursor);\r
-int pysqlite_check_thread(pysqlite_Connection* self);\r
-int pysqlite_check_connection(pysqlite_Connection* con);\r
-\r
-int pysqlite_connection_setup_types(void);\r
-\r
-#endif\r