diff options
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r-- | Modules/_sqlite/connection.c | 260 |
1 files changed, 130 insertions, 130 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 703af15..924d582 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -32,7 +32,7 @@ #include "pythread.h" -static int connection_set_isolation_level(Connection* self, PyObject* isolation_level); +static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level); void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len) @@ -43,11 +43,11 @@ void _sqlite3_result_error(sqlite3_context* ctx, const char* errmsg, int len) #if SQLITE_VERSION_NUMBER >= 3003003 sqlite3_result_error(ctx, errmsg, len); #else - PyErr_SetString(OperationalError, errmsg); + PyErr_SetString(pysqlite_OperationalError, errmsg); #endif } -int connection_init(Connection* self, PyObject* args, PyObject* kwargs) +int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = {"database", "timeout", "detect_types", "isolation_level", "check_same_thread", "factory", "cached_statements", NULL, NULL}; @@ -82,7 +82,7 @@ int connection_init(Connection* self, PyObject* args, PyObject* kwargs) Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { - _seterror(self->db); + _pysqlite_seterror(self->db); return -1; } @@ -95,10 +95,10 @@ int connection_init(Connection* self, PyObject* args, PyObject* kwargs) Py_INCREF(isolation_level); } self->isolation_level = NULL; - connection_set_isolation_level(self, isolation_level); + pysqlite_connection_set_isolation_level(self, isolation_level); Py_DECREF(isolation_level); - self->statement_cache = (Cache*)PyObject_CallFunction((PyObject*)&CacheType, "Oi", self, cached_statements); + self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "Oi", self, cached_statements); if (PyErr_Occurred()) { return -1; } @@ -135,41 +135,41 @@ int connection_init(Connection* self, PyObject* args, PyObject* kwargs) return -1; } - self->Warning = Warning; - self->Error = Error; - self->InterfaceError = InterfaceError; - self->DatabaseError = DatabaseError; - self->DataError = DataError; - self->OperationalError = OperationalError; - self->IntegrityError = IntegrityError; - self->InternalError = InternalError; - self->ProgrammingError = ProgrammingError; - self->NotSupportedError = NotSupportedError; + self->Warning = pysqlite_Warning; + self->Error = pysqlite_Error; + self->InterfaceError = pysqlite_InterfaceError; + self->DatabaseError = pysqlite_DatabaseError; + self->DataError = pysqlite_DataError; + self->OperationalError = pysqlite_OperationalError; + self->IntegrityError = pysqlite_IntegrityError; + self->InternalError = pysqlite_InternalError; + self->ProgrammingError = pysqlite_ProgrammingError; + self->NotSupportedError = pysqlite_NotSupportedError; return 0; } /* Empty the entire statement cache of this connection */ -void flush_statement_cache(Connection* self) +void pysqlite_flush_statement_cache(pysqlite_Connection* self) { - Node* node; - Statement* statement; + pysqlite_Node* node; + pysqlite_Statement* statement; node = self->statement_cache->first; while (node) { - statement = (Statement*)(node->data); - (void)statement_finalize(statement); + statement = (pysqlite_Statement*)(node->data); + (void)pysqlite_statement_finalize(statement); node = node->next; } Py_DECREF(self->statement_cache); - self->statement_cache = (Cache*)PyObject_CallFunction((PyObject*)&CacheType, "O", self); + self->statement_cache = (pysqlite_Cache*)PyObject_CallFunction((PyObject*)&pysqlite_CacheType, "O", self); Py_DECREF(self); self->statement_cache->decref_factory = 0; } -void reset_all_statements(Connection* self) +void pysqlite_reset_all_statements(pysqlite_Connection* self) { int i; PyObject* weakref; @@ -179,12 +179,12 @@ void reset_all_statements(Connection* self) weakref = PyList_GetItem(self->statements, i); statement = PyWeakref_GetObject(weakref); if (statement != Py_None) { - (void)statement_reset((Statement*)statement); + (void)pysqlite_statement_reset((pysqlite_Statement*)statement); } } } -void connection_dealloc(Connection* self) +void pysqlite_connection_dealloc(pysqlite_Connection* self) { Py_XDECREF(self->statement_cache); @@ -208,7 +208,7 @@ void connection_dealloc(Connection* self) self->ob_type->tp_free((PyObject*)self); } -PyObject* connection_cursor(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = {"factory", NULL, NULL}; PyObject* factory = NULL; @@ -220,34 +220,34 @@ PyObject* connection_cursor(Connection* self, PyObject* args, PyObject* kwargs) return NULL; } - if (!check_thread(self) || !check_connection(self)) { + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; } if (factory == NULL) { - factory = (PyObject*)&CursorType; + factory = (PyObject*)&pysqlite_CursorType; } cursor = PyObject_CallFunction(factory, "O", self); if (cursor && self->row_factory != Py_None) { - Py_XDECREF(((Cursor*)cursor)->row_factory); + Py_XDECREF(((pysqlite_Cursor*)cursor)->row_factory); Py_INCREF(self->row_factory); - ((Cursor*)cursor)->row_factory = self->row_factory; + ((pysqlite_Cursor*)cursor)->row_factory = self->row_factory; } return cursor; } -PyObject* connection_close(Connection* self, PyObject* args) +PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args) { int rc; - if (!check_thread(self)) { + if (!pysqlite_check_thread(self)) { return NULL; } - flush_statement_cache(self); + pysqlite_flush_statement_cache(self); if (self->db) { Py_BEGIN_ALLOW_THREADS @@ -255,7 +255,7 @@ PyObject* connection_close(Connection* self, PyObject* args) Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { - _seterror(self->db); + _pysqlite_seterror(self->db); return NULL; } else { self->db = NULL; @@ -271,17 +271,17 @@ PyObject* connection_close(Connection* self, PyObject* args) * * 0 => error; 1 => ok */ -int check_connection(Connection* con) +int pysqlite_check_connection(pysqlite_Connection* con) { if (!con->db) { - PyErr_SetString(ProgrammingError, "Cannot operate on a closed database."); + PyErr_SetString(pysqlite_ProgrammingError, "Cannot operate on a closed database."); return 0; } else { return 1; } } -PyObject* _connection_begin(Connection* self) +PyObject* _pysqlite_connection_begin(pysqlite_Connection* self) { int rc; const char* tail; @@ -292,7 +292,7 @@ PyObject* _connection_begin(Connection* self) Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { - _seterror(self->db); + _pysqlite_seterror(self->db); goto error; } @@ -300,7 +300,7 @@ PyObject* _connection_begin(Connection* self) if (rc == SQLITE_DONE) { self->inTransaction = 1; } else { - _seterror(self->db); + _pysqlite_seterror(self->db); } Py_BEGIN_ALLOW_THREADS @@ -308,7 +308,7 @@ PyObject* _connection_begin(Connection* self) Py_END_ALLOW_THREADS if (rc != SQLITE_OK && !PyErr_Occurred()) { - _seterror(self->db); + _pysqlite_seterror(self->db); } error: @@ -320,13 +320,13 @@ error: } } -PyObject* connection_commit(Connection* self, PyObject* args) +PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args) { int rc; const char* tail; sqlite3_stmt* statement; - if (!check_thread(self) || !check_connection(self)) { + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; } @@ -335,7 +335,7 @@ PyObject* connection_commit(Connection* self, PyObject* args) rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { - _seterror(self->db); + _pysqlite_seterror(self->db); goto error; } @@ -343,14 +343,14 @@ PyObject* connection_commit(Connection* self, PyObject* args) if (rc == SQLITE_DONE) { self->inTransaction = 0; } else { - _seterror(self->db); + _pysqlite_seterror(self->db); } Py_BEGIN_ALLOW_THREADS rc = sqlite3_finalize(statement); Py_END_ALLOW_THREADS if (rc != SQLITE_OK && !PyErr_Occurred()) { - _seterror(self->db); + _pysqlite_seterror(self->db); } } @@ -364,24 +364,24 @@ error: } } -PyObject* connection_rollback(Connection* self, PyObject* args) +PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args) { int rc; const char* tail; sqlite3_stmt* statement; - if (!check_thread(self) || !check_connection(self)) { + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; } if (self->inTransaction) { - reset_all_statements(self); + pysqlite_reset_all_statements(self); Py_BEGIN_ALLOW_THREADS rc = sqlite3_prepare(self->db, "ROLLBACK", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { - _seterror(self->db); + _pysqlite_seterror(self->db); goto error; } @@ -389,14 +389,14 @@ PyObject* connection_rollback(Connection* self, PyObject* args) if (rc == SQLITE_DONE) { self->inTransaction = 0; } else { - _seterror(self->db); + _pysqlite_seterror(self->db); } Py_BEGIN_ALLOW_THREADS rc = sqlite3_finalize(statement); Py_END_ALLOW_THREADS if (rc != SQLITE_OK && !PyErr_Occurred()) { - _seterror(self->db); + _pysqlite_seterror(self->db); } } @@ -410,7 +410,7 @@ error: } } -void _set_result(sqlite3_context* context, PyObject* py_val) +void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) { long longval; const char* buffer; @@ -445,7 +445,7 @@ void _set_result(sqlite3_context* context, PyObject* py_val) } } -PyObject* _build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv) +PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_value** argv) { PyObject* args; int i; @@ -512,7 +512,7 @@ PyObject* _build_py_params(sqlite3_context *context, int argc, sqlite3_value** a return args; } -void _func_callback(sqlite3_context* context, int argc, sqlite3_value** argv) +void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** argv) { PyObject* args; PyObject* py_func; @@ -524,14 +524,14 @@ void _func_callback(sqlite3_context* context, int argc, sqlite3_value** argv) py_func = (PyObject*)sqlite3_user_data(context); - args = _build_py_params(context, argc, argv); + args = _pysqlite_build_py_params(context, argc, argv); if (args) { py_retval = PyObject_CallObject(py_func, args); Py_DECREF(args); } if (py_retval) { - _set_result(context, py_retval); + _pysqlite_set_result(context, py_retval); Py_DECREF(py_retval); } else { if (_enable_callback_tracebacks) { @@ -545,7 +545,7 @@ void _func_callback(sqlite3_context* context, int argc, sqlite3_value** argv) PyGILState_Release(threadstate); } -static void _step_callback(sqlite3_context *context, int argc, sqlite3_value** params) +static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_value** params) { PyObject* args; PyObject* function_result = NULL; @@ -581,7 +581,7 @@ static void _step_callback(sqlite3_context *context, int argc, sqlite3_value** p goto error; } - args = _build_py_params(context, argc, params); + args = _pysqlite_build_py_params(context, argc, params); if (!args) { goto error; } @@ -605,7 +605,7 @@ error: PyGILState_Release(threadstate); } -void _final_callback(sqlite3_context* context) +void _pysqlite_final_callback(sqlite3_context* context) { PyObject* function_result = NULL; PyObject** aggregate_instance; @@ -634,7 +634,7 @@ void _final_callback(sqlite3_context* context) } _sqlite3_result_error(context, "user-defined aggregate's 'finalize' method raised error", -1); } else { - _set_result(context, function_result); + _pysqlite_set_result(context, function_result); } error: @@ -644,7 +644,7 @@ error: PyGILState_Release(threadstate); } -void _drop_unused_statement_references(Connection* self) +void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self) { PyObject* new_list; PyObject* weakref; @@ -676,7 +676,7 @@ void _drop_unused_statement_references(Connection* self) self->statements = new_list; } -PyObject* connection_create_function(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { static char *kwlist[] = {"name", "narg", "func", NULL, NULL}; @@ -691,11 +691,11 @@ PyObject* connection_create_function(Connection* self, PyObject* args, PyObject* return NULL; } - rc = sqlite3_create_function(self->db, name, narg, SQLITE_UTF8, (void*)func, _func_callback, NULL, NULL); + rc = sqlite3_create_function(self->db, name, narg, SQLITE_UTF8, (void*)func, _pysqlite_func_callback, NULL, NULL); if (rc != SQLITE_OK) { /* Workaround for SQLite bug: no error code or string is available here */ - PyErr_SetString(OperationalError, "Error creating function"); + PyErr_SetString(pysqlite_OperationalError, "Error creating function"); return NULL; } else { PyDict_SetItem(self->function_pinboard, func, Py_None); @@ -705,7 +705,7 @@ PyObject* connection_create_function(Connection* self, PyObject* args, PyObject* } } -PyObject* connection_create_aggregate(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_create_aggregate(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* aggregate_class; @@ -719,10 +719,10 @@ PyObject* connection_create_aggregate(Connection* self, PyObject* args, PyObject return NULL; } - rc = sqlite3_create_function(self->db, name, n_arg, SQLITE_UTF8, (void*)aggregate_class, 0, &_step_callback, &_final_callback); + rc = sqlite3_create_function(self->db, name, n_arg, SQLITE_UTF8, (void*)aggregate_class, 0, &_pysqlite_step_callback, &_pysqlite_final_callback); if (rc != SQLITE_OK) { /* Workaround for SQLite bug: no error code or string is available here */ - PyErr_SetString(OperationalError, "Error creating aggregate"); + PyErr_SetString(pysqlite_OperationalError, "Error creating aggregate"); return NULL; } else { PyDict_SetItem(self->function_pinboard, aggregate_class, Py_None); @@ -732,7 +732,7 @@ PyObject* connection_create_aggregate(Connection* self, PyObject* args, PyObject } } -int _authorizer_callback(void* user_arg, int action, const char* arg1, const char* arg2 , const char* dbname, const char* access_attempt_source) +static int _authorizer_callback(void* user_arg, int action, const char* arg1, const char* arg2 , const char* dbname, const char* access_attempt_source) { PyObject *ret; int rc; @@ -762,7 +762,7 @@ int _authorizer_callback(void* user_arg, int action, const char* arg1, const cha return rc; } -PyObject* connection_set_authorizer(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* authorizer_cb; @@ -777,7 +777,7 @@ PyObject* connection_set_authorizer(Connection* self, PyObject* args, PyObject* rc = sqlite3_set_authorizer(self->db, _authorizer_callback, (void*)authorizer_cb); if (rc != SQLITE_OK) { - PyErr_SetString(OperationalError, "Error setting authorizer callback"); + PyErr_SetString(pysqlite_OperationalError, "Error setting authorizer callback"); return NULL; } else { PyDict_SetItem(self->function_pinboard, authorizer_cb, Py_None); @@ -787,11 +787,11 @@ PyObject* connection_set_authorizer(Connection* self, PyObject* args, PyObject* } } -int check_thread(Connection* self) +int pysqlite_check_thread(pysqlite_Connection* self) { if (self->check_same_thread) { if (PyThread_get_thread_ident() != self->thread_ident) { - PyErr_Format(ProgrammingError, + PyErr_Format(pysqlite_ProgrammingError, "SQLite objects created in a thread can only be used in that same thread." "The object was created in thread id %ld and this is thread id %ld", self->thread_ident, PyThread_get_thread_ident()); @@ -803,22 +803,22 @@ int check_thread(Connection* self) return 1; } -static PyObject* connection_get_isolation_level(Connection* self, void* unused) +static PyObject* pysqlite_connection_get_isolation_level(pysqlite_Connection* self, void* unused) { Py_INCREF(self->isolation_level); return self->isolation_level; } -static PyObject* connection_get_total_changes(Connection* self, void* unused) +static PyObject* pysqlite_connection_get_total_changes(pysqlite_Connection* self, void* unused) { - if (!check_connection(self)) { + if (!pysqlite_check_connection(self)) { return NULL; } else { return Py_BuildValue("i", sqlite3_total_changes(self->db)); } } -static int connection_set_isolation_level(Connection* self, PyObject* isolation_level) +static int pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* isolation_level) { PyObject* res; PyObject* begin_statement; @@ -834,7 +834,7 @@ static int connection_set_isolation_level(Connection* self, PyObject* isolation_ Py_INCREF(Py_None); self->isolation_level = Py_None; - res = connection_commit(self, NULL); + res = pysqlite_connection_commit(self, NULL); if (!res) { return -1; } @@ -866,10 +866,10 @@ static int connection_set_isolation_level(Connection* self, PyObject* isolation_ return 0; } -PyObject* connection_call(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* sql; - Statement* statement; + pysqlite_Statement* statement; PyObject* weakref; int rc; @@ -877,22 +877,22 @@ PyObject* connection_call(Connection* self, PyObject* args, PyObject* kwargs) return NULL; } - _drop_unused_statement_references(self); + _pysqlite_drop_unused_statement_references(self); - statement = PyObject_New(Statement, &StatementType); + statement = PyObject_New(pysqlite_Statement, &pysqlite_StatementType); if (!statement) { return NULL; } - rc = statement_create(statement, self, sql); + rc = pysqlite_statement_create(statement, self, sql); if (rc != SQLITE_OK) { if (rc == PYSQLITE_TOO_MUCH_SQL) { - PyErr_SetString(Warning, "You can only execute one statement at a time."); + PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time."); } else if (rc == PYSQLITE_SQL_WRONG_TYPE) { - PyErr_SetString(Warning, "SQL is of wrong type. Must be string or unicode."); + PyErr_SetString(pysqlite_Warning, "SQL is of wrong type. Must be string or unicode."); } else { - _seterror(self->db); + _pysqlite_seterror(self->db); } Py_DECREF(statement); @@ -918,7 +918,7 @@ error: return (PyObject*)statement; } -PyObject* connection_execute(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* cursor = 0; PyObject* result = 0; @@ -949,7 +949,7 @@ error: return cursor; } -PyObject* connection_executemany(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* cursor = 0; PyObject* result = 0; @@ -980,7 +980,7 @@ error: return cursor; } -PyObject* connection_executescript(Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) { PyObject* cursor = 0; PyObject* result = 0; @@ -1014,7 +1014,7 @@ error: /* ------------------------- COLLATION CODE ------------------------ */ static int -collation_callback( +pysqlite_collation_callback( void* context, int text1_length, const void* text1_data, int text2_length, const void* text2_data) @@ -1063,11 +1063,11 @@ finally: } static PyObject * -connection_interrupt(Connection* self, PyObject* args) +pysqlite_connection_interrupt(pysqlite_Connection* self, PyObject* args) { PyObject* retval = NULL; - if (!check_connection(self)) { + if (!pysqlite_check_connection(self)) { goto finally; } @@ -1081,7 +1081,7 @@ finally: } static PyObject * -connection_create_collation(Connection* self, PyObject* args) +pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args) { PyObject* callable; PyObject* uppercase_name = 0; @@ -1090,7 +1090,7 @@ connection_create_collation(Connection* self, PyObject* args) char* chk; int rc; - if (!check_thread(self) || !check_connection(self)) { + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { goto finally; } @@ -1111,7 +1111,7 @@ connection_create_collation(Connection* self, PyObject* args) { chk++; } else { - PyErr_SetString(ProgrammingError, "invalid character in collation name"); + PyErr_SetString(pysqlite_ProgrammingError, "invalid character in collation name"); goto finally; } } @@ -1131,10 +1131,10 @@ connection_create_collation(Connection* self, PyObject* args) PyString_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, - (callable != Py_None) ? collation_callback : NULL); + (callable != Py_None) ? pysqlite_collation_callback : NULL); if (rc != SQLITE_OK) { PyDict_DelItem(self->collations, uppercase_name); - _seterror(self->db); + _pysqlite_seterror(self->db); goto finally; } @@ -1155,63 +1155,63 @@ static char connection_doc[] = PyDoc_STR("SQLite database connection object."); static PyGetSetDef connection_getset[] = { - {"isolation_level", (getter)connection_get_isolation_level, (setter)connection_set_isolation_level}, - {"total_changes", (getter)connection_get_total_changes, (setter)0}, + {"isolation_level", (getter)pysqlite_connection_get_isolation_level, (setter)pysqlite_connection_set_isolation_level}, + {"total_changes", (getter)pysqlite_connection_get_total_changes, (setter)0}, {NULL} }; static PyMethodDef connection_methods[] = { - {"cursor", (PyCFunction)connection_cursor, METH_VARARGS|METH_KEYWORDS, + {"cursor", (PyCFunction)pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Return a cursor for the connection.")}, - {"close", (PyCFunction)connection_close, METH_NOARGS, + {"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS, PyDoc_STR("Closes the connection.")}, - {"commit", (PyCFunction)connection_commit, METH_NOARGS, + {"commit", (PyCFunction)pysqlite_connection_commit, METH_NOARGS, PyDoc_STR("Commit the current transaction.")}, - {"rollback", (PyCFunction)connection_rollback, METH_NOARGS, + {"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS, PyDoc_STR("Roll back the current transaction.")}, - {"create_function", (PyCFunction)connection_create_function, METH_VARARGS|METH_KEYWORDS, + {"create_function", (PyCFunction)pysqlite_connection_create_function, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Creates a new function. Non-standard.")}, - {"create_aggregate", (PyCFunction)connection_create_aggregate, METH_VARARGS|METH_KEYWORDS, + {"create_aggregate", (PyCFunction)pysqlite_connection_create_aggregate, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Creates a new aggregate. Non-standard.")}, - {"set_authorizer", (PyCFunction)connection_set_authorizer, METH_VARARGS|METH_KEYWORDS, + {"set_authorizer", (PyCFunction)pysqlite_connection_set_authorizer, METH_VARARGS|METH_KEYWORDS, PyDoc_STR("Sets authorizer callback. Non-standard.")}, - {"execute", (PyCFunction)connection_execute, METH_VARARGS, + {"execute", (PyCFunction)pysqlite_connection_execute, METH_VARARGS, PyDoc_STR("Executes a SQL statement. Non-standard.")}, - {"executemany", (PyCFunction)connection_executemany, METH_VARARGS, + {"executemany", (PyCFunction)pysqlite_connection_executemany, METH_VARARGS, PyDoc_STR("Repeatedly executes a SQL statement. Non-standard.")}, - {"executescript", (PyCFunction)connection_executescript, METH_VARARGS, + {"executescript", (PyCFunction)pysqlite_connection_executescript, METH_VARARGS, PyDoc_STR("Executes a multiple SQL statements at once. Non-standard.")}, - {"create_collation", (PyCFunction)connection_create_collation, METH_VARARGS, + {"create_collation", (PyCFunction)pysqlite_connection_create_collation, METH_VARARGS, PyDoc_STR("Creates a collation function. Non-standard.")}, - {"interrupt", (PyCFunction)connection_interrupt, METH_NOARGS, + {"interrupt", (PyCFunction)pysqlite_connection_interrupt, METH_NOARGS, PyDoc_STR("Abort any pending database operation. Non-standard.")}, {NULL, NULL} }; static struct PyMemberDef connection_members[] = { - {"Warning", T_OBJECT, offsetof(Connection, Warning), RO}, - {"Error", T_OBJECT, offsetof(Connection, Error), RO}, - {"InterfaceError", T_OBJECT, offsetof(Connection, InterfaceError), RO}, - {"DatabaseError", T_OBJECT, offsetof(Connection, DatabaseError), RO}, - {"DataError", T_OBJECT, offsetof(Connection, DataError), RO}, - {"OperationalError", T_OBJECT, offsetof(Connection, OperationalError), RO}, - {"IntegrityError", T_OBJECT, offsetof(Connection, IntegrityError), RO}, - {"InternalError", T_OBJECT, offsetof(Connection, InternalError), RO}, - {"ProgrammingError", T_OBJECT, offsetof(Connection, ProgrammingError), RO}, - {"NotSupportedError", T_OBJECT, offsetof(Connection, NotSupportedError), RO}, - {"row_factory", T_OBJECT, offsetof(Connection, row_factory)}, - {"text_factory", T_OBJECT, offsetof(Connection, text_factory)}, + {"Warning", T_OBJECT, offsetof(pysqlite_Connection, Warning), RO}, + {"Error", T_OBJECT, offsetof(pysqlite_Connection, Error), RO}, + {"InterfaceError", T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), RO}, + {"DatabaseError", T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), RO}, + {"DataError", T_OBJECT, offsetof(pysqlite_Connection, DataError), RO}, + {"OperationalError", T_OBJECT, offsetof(pysqlite_Connection, OperationalError), RO}, + {"IntegrityError", T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), RO}, + {"InternalError", T_OBJECT, offsetof(pysqlite_Connection, InternalError), RO}, + {"ProgrammingError", T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), RO}, + {"NotSupportedError", T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), RO}, + {"row_factory", T_OBJECT, offsetof(pysqlite_Connection, row_factory)}, + {"text_factory", T_OBJECT, offsetof(pysqlite_Connection, text_factory)}, {NULL} }; -PyTypeObject ConnectionType = { +PyTypeObject pysqlite_ConnectionType = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ MODULE_NAME ".Connection", /* tp_name */ - sizeof(Connection), /* tp_basicsize */ + sizeof(pysqlite_Connection), /* tp_basicsize */ 0, /* tp_itemsize */ - (destructor)connection_dealloc, /* tp_dealloc */ + (destructor)pysqlite_connection_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ @@ -1221,7 +1221,7 @@ PyTypeObject ConnectionType = { 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ - (ternaryfunc)connection_call, /* tp_call */ + (ternaryfunc)pysqlite_connection_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ @@ -1242,14 +1242,14 @@ PyTypeObject ConnectionType = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)connection_init, /* tp_init */ + (initproc)pysqlite_connection_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ 0 /* tp_free */ }; -extern int connection_setup_types(void) +extern int pysqlite_connection_setup_types(void) { - ConnectionType.tp_new = PyType_GenericNew; - return PyType_Ready(&ConnectionType); + pysqlite_ConnectionType.tp_new = PyType_GenericNew; + return PyType_Ready(&pysqlite_ConnectionType); } |