| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | /*[clinic input]
 | 
					
						
							|  |  |  | preserve | 
					
						
							|  |  |  | [clinic start generated code]*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2023-08-31 23:42:34 +02:00
										 |  |  | #  include "pycore_gc.h"          // PyGC_Head
 | 
					
						
							|  |  |  | #  include "pycore_runtime.h"     // _Py_ID()
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2023-10-17 14:30:31 +02:00
										 |  |  | #include "pycore_modsupport.h"    // _PyArg_UnpackKeywords()
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  | static int | 
					
						
							| 
									
										
										
										
											2022-05-20 11:53:05 +03:00
										 |  |  | pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database, | 
					
						
							|  |  |  |                               double timeout, int detect_types, | 
					
						
							|  |  |  |                               const char *isolation_level, | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |                               int check_same_thread, PyObject *factory, | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |                               int cache_size, int uri, | 
					
						
							|  |  |  |                               enum autocommit_mode autocommit); | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-19 10:13:35 +03:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.__init__'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.__init__'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.__init__'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  | static int | 
					
						
							|  |  |  | pysqlite_connection_init(PyObject *self, PyObject *args, PyObject *kwargs) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     int return_value = -1; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     #define NUM_KEYWORDS 9
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |         .ob_item = { &_Py_ID(database), &_Py_ID(timeout), &_Py_ID(detect_types), &_Py_ID(isolation_level), &_Py_ID(check_same_thread), &_Py_ID(factory), &_Py_ID(cached_statements), &_Py_ID(uri), &_Py_ID(autocommit), }, | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     static const char * const _keywords[] = {"database", "timeout", "detect_types", "isolation_level", "check_same_thread", "factory", "cached_statements", "uri", "autocommit", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "Connection", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     PyObject *argsbuf[9]; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     PyObject * const *fastargs; | 
					
						
							|  |  |  |     Py_ssize_t nargs = PyTuple_GET_SIZE(args); | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1; | 
					
						
							| 
									
										
										
										
											2022-05-20 11:53:05 +03:00
										 |  |  |     PyObject *database; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     double timeout = 5.0; | 
					
						
							|  |  |  |     int detect_types = 0; | 
					
						
							| 
									
										
										
										
											2021-11-15 08:50:59 +01:00
										 |  |  |     const char *isolation_level = ""; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     int check_same_thread = 1; | 
					
						
							|  |  |  |     PyObject *factory = (PyObject*)clinic_state()->ConnectionType; | 
					
						
							| 
									
										
										
										
											2021-11-16 15:53:35 +01:00
										 |  |  |     int cache_size = 128; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     int uri = 0; | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     enum autocommit_mode autocommit = LEGACY_TRANSACTION_CONTROL; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-15 10:09:56 +02:00
										 |  |  |     if (nargs > 1 && nargs <= 8) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing more than 1 positional argument to _sqlite3.Connection()" | 
					
						
							|  |  |  |                 " is deprecated. Parameters 'timeout', 'detect_types', " | 
					
						
							|  |  |  |                 "'isolation_level', 'check_same_thread', 'factory', " | 
					
						
							|  |  |  |                 "'cached_statements' and 'uri' will become keyword-only " | 
					
						
							|  |  |  |                 "parameters in Python 3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2023-08-19 10:13:35 +03:00
										 |  |  |             goto exit; | 
					
						
							| 
									
										
										
										
											2023-08-15 10:09:56 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 8, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     if (!fastargs) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-20 11:53:05 +03:00
										 |  |  |     database = fastargs[0]; | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_pos; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[1]) { | 
					
						
							|  |  |  |         if (PyFloat_CheckExact(fastargs[1])) { | 
					
						
							|  |  |  |             timeout = PyFloat_AS_DOUBLE(fastargs[1]); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             timeout = PyFloat_AsDouble(fastargs[1]); | 
					
						
							|  |  |  |             if (timeout == -1.0 && PyErr_Occurred()) { | 
					
						
							|  |  |  |                 goto exit; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[2]) { | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |         detect_types = PyLong_AsInt(fastargs[2]); | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |         if (detect_types == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[3]) { | 
					
						
							| 
									
										
										
										
											2021-11-18 10:18:09 +01:00
										 |  |  |         if (!isolation_level_converter(fastargs[3], &isolation_level)) { | 
					
						
							| 
									
										
										
										
											2021-11-15 08:50:59 +01:00
										 |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[4]) { | 
					
						
							| 
									
										
										
										
											2022-12-03 21:52:21 +02:00
										 |  |  |         check_same_thread = PyObject_IsTrue(fastargs[4]); | 
					
						
							|  |  |  |         if (check_same_thread < 0) { | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[5]) { | 
					
						
							|  |  |  |         factory = fastargs[5]; | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (fastargs[6]) { | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |         cache_size = PyLong_AsInt(fastargs[6]); | 
					
						
							| 
									
										
										
										
											2021-11-16 15:53:35 +01:00
										 |  |  |         if (cache_size == -1 && PyErr_Occurred()) { | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     if (fastargs[7]) { | 
					
						
							|  |  |  |         uri = PyObject_IsTrue(fastargs[7]); | 
					
						
							|  |  |  |         if (uri < 0) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_pos; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | skip_optional_pos: | 
					
						
							| 
									
										
										
										
											2022-11-12 23:44:41 +01:00
										 |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!autocommit_converter(fastargs[8], &autocommit)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | skip_optional_kwonly: | 
					
						
							|  |  |  |     return_value = pysqlite_connection_init_impl((pysqlite_Connection *)self, database, timeout, detect_types, isolation_level, check_same_thread, factory, cache_size, uri, autocommit); | 
					
						
							| 
									
										
										
										
											2021-06-20 21:24:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_cursor__doc__, | 
					
						
							|  |  |  | "cursor($self, /, factory=<unrepresentable>)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Return a cursor for the connection."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_CURSOR_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"cursor", _PyCFunction_CAST(pysqlite_connection_cursor), METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_cursor__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_cursor(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(factory), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     static const char * const _keywords[] = {"factory", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "cursor", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     PyObject *argsbuf[1]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; | 
					
						
							|  |  |  |     PyObject *factory = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 0, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_pos; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     factory = args[0]; | 
					
						
							|  |  |  | skip_optional_pos: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_cursor_impl((pysqlite_Connection *)self, factory); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | PyDoc_STRVAR(blobopen__doc__, | 
					
						
							|  |  |  | "blobopen($self, table, column, row, /, *, readonly=False, name=\'main\')\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Open and return a BLOB object.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  table\n" | 
					
						
							|  |  |  | "    Table name.\n" | 
					
						
							|  |  |  | "  column\n" | 
					
						
							|  |  |  | "    Column name.\n" | 
					
						
							|  |  |  | "  row\n" | 
					
						
							|  |  |  | "    Row index.\n" | 
					
						
							|  |  |  | "  readonly\n" | 
					
						
							|  |  |  | "    Open the BLOB without write permissions.\n" | 
					
						
							|  |  |  | "  name\n" | 
					
						
							|  |  |  | "    Database name."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define BLOBOPEN_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"blobopen", _PyCFunction_CAST(blobopen), METH_FASTCALL|METH_KEYWORDS, blobopen__doc__}, | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | blobopen_impl(pysqlite_Connection *self, const char *table, const char *col, | 
					
						
							| 
									
										
										
										
											2023-05-07 12:55:31 +02:00
										 |  |  |               sqlite3_int64 row, int readonly, const char *name); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | blobopen(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 2
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(readonly), &_Py_ID(name), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     static const char * const _keywords[] = {"", "", "", "readonly", "name", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "blobopen", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     PyObject *argsbuf[5]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; | 
					
						
							|  |  |  |     const char *table; | 
					
						
							|  |  |  |     const char *col; | 
					
						
							| 
									
										
										
										
											2023-05-07 12:55:31 +02:00
										 |  |  |     sqlite3_int64 row; | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     int readonly = 0; | 
					
						
							|  |  |  |     const char *name = "main"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 3, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("blobopen", "argument 1", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t table_length; | 
					
						
							|  |  |  |     table = PyUnicode_AsUTF8AndSize(args[0], &table_length); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     if (table == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(table) != (size_t)table_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     if (!PyUnicode_Check(args[1])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("blobopen", "argument 2", "str", args[1]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t col_length; | 
					
						
							|  |  |  |     col = PyUnicode_AsUTF8AndSize(args[1], &col_length); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     if (col == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(col) != (size_t)col_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-05-07 12:55:31 +02:00
										 |  |  |     if (!sqlite3_int64_converter(args[2], &row)) { | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (args[3]) { | 
					
						
							| 
									
										
										
										
											2022-12-03 21:52:21 +02:00
										 |  |  |         readonly = PyObject_IsTrue(args[3]); | 
					
						
							|  |  |  |         if (readonly < 0) { | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_kwonly; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[4])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("blobopen", "argument 'name'", "str", args[4]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[4], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = blobopen_impl((pysqlite_Connection *)self, table, col, row, readonly, name); | 
					
						
							| 
									
										
										
										
											2022-04-15 02:02:56 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_close__doc__, | 
					
						
							|  |  |  | "close($self, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-06-19 21:17:28 +02:00
										 |  |  | "Close the database connection.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Any pending transaction is not committed implicitly."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_CLOSE_METHODDEF    \
 | 
					
						
							|  |  |  |     {"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS, pysqlite_connection_close__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_close_impl(pysqlite_Connection *self); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_close(PyObject *self, PyObject *Py_UNUSED(ignored)) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return pysqlite_connection_close_impl((pysqlite_Connection *)self); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_commit__doc__, | 
					
						
							|  |  |  | "commit($self, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-06-19 21:17:28 +02:00
										 |  |  | "Commit any pending transaction to the database.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "If there is no open transaction, this method is a no-op."); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_COMMIT_METHODDEF    \
 | 
					
						
							|  |  |  |     {"commit", (PyCFunction)pysqlite_connection_commit, METH_NOARGS, pysqlite_connection_commit__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_commit_impl(pysqlite_Connection *self); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_commit(PyObject *self, PyObject *Py_UNUSED(ignored)) | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return pysqlite_connection_commit_impl((pysqlite_Connection *)self); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_rollback__doc__, | 
					
						
							|  |  |  | "rollback($self, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-06-19 21:17:28 +02:00
										 |  |  | "Roll back to the start of any pending transaction.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "If there is no open transaction, this method is a no-op."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_ROLLBACK_METHODDEF    \
 | 
					
						
							|  |  |  |     {"rollback", (PyCFunction)pysqlite_connection_rollback, METH_NOARGS, pysqlite_connection_rollback__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_rollback_impl(pysqlite_Connection *self); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_rollback(PyObject *self, PyObject *Py_UNUSED(ignored)) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return pysqlite_connection_rollback_impl((pysqlite_Connection *)self); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_create_function__doc__, | 
					
						
							|  |  |  | "create_function($self, /, name, narg, func, *, deterministic=False)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  | "Creates a new function.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Note: Passing keyword arguments \'name\', \'narg\' and \'func\' to\n" | 
					
						
							|  |  |  | "_sqlite3.Connection.create_function() is deprecated. Parameters\n" | 
					
						
							|  |  |  | "\'name\', \'narg\' and \'func\' will become positional-only in Python 3.15.\n" | 
					
						
							|  |  |  | ""); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_CREATE_FUNCTION_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"create_function", _PyCFunction_CAST(pysqlite_connection_create_function), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_function__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_create_function_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                          PyTypeObject *cls, const char *name, | 
					
						
							|  |  |  |                                          int narg, PyObject *func, | 
					
						
							|  |  |  |                                          int deterministic); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.create_function'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.create_function'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.create_function'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_create_function(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 4
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(name), &_Py_ID(narg), &_Py_ID(func), &_Py_ID(deterministic), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     static const char * const _keywords[] = {"name", "narg", "func", "deterministic", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "create_function", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[4]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 3; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     const char *name; | 
					
						
							|  |  |  |     int narg; | 
					
						
							|  |  |  |     PyObject *func; | 
					
						
							|  |  |  |     int deterministic = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 3, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  |     if (nargs < 3) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing keyword arguments 'name', 'narg' and 'func' to " | 
					
						
							|  |  |  |                 "_sqlite3.Connection.create_function() is deprecated. Parameters " | 
					
						
							|  |  |  |                 "'name', 'narg' and 'func' will become positional-only in Python " | 
					
						
							|  |  |  |                 "3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("create_function", "argument 'name'", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[0], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     narg = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (narg == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     func = args[2]; | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     deterministic = PyObject_IsTrue(args[3]); | 
					
						
							|  |  |  |     if (deterministic < 0) { | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_create_function_impl((pysqlite_Connection *)self, cls, name, narg, func, deterministic); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  | #if defined(HAVE_WINDOW_FUNCTIONS)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(create_window_function__doc__, | 
					
						
							|  |  |  | "create_window_function($self, name, num_params, aggregate_class, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Creates or redefines an aggregate window function. Non-standard.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  name\n" | 
					
						
							|  |  |  | "    The name of the SQL aggregate window function to be created or\n" | 
					
						
							|  |  |  | "    redefined.\n" | 
					
						
							|  |  |  | "  num_params\n" | 
					
						
							|  |  |  | "    The number of arguments the step and inverse methods takes.\n" | 
					
						
							|  |  |  | "  aggregate_class\n" | 
					
						
							|  |  |  | "    A class with step(), finalize(), value(), and inverse() methods.\n" | 
					
						
							|  |  |  | "    Set to None to clear the window function."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define CREATE_WINDOW_FUNCTION_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"create_window_function", _PyCFunction_CAST(create_window_function), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, create_window_function__doc__}, | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | create_window_function_impl(pysqlite_Connection *self, PyTypeObject *cls, | 
					
						
							|  |  |  |                             const char *name, int num_params, | 
					
						
							|  |  |  |                             PyObject *aggregate_class); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | create_window_function(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							|  |  |  |     #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
 | 
					
						
							|  |  |  |     #else
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  |     static const char * const _keywords[] = {"", "", "", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "create_window_function", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[3]; | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  |     const char *name; | 
					
						
							|  |  |  |     int num_params; | 
					
						
							|  |  |  |     PyObject *aggregate_class; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 3, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("create_window_function", "argument 1", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[0], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     num_params = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (num_params == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     aggregate_class = args[2]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = create_window_function_impl((pysqlite_Connection *)self, cls, name, num_params, aggregate_class); | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* defined(HAVE_WINDOW_FUNCTIONS) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_create_aggregate__doc__, | 
					
						
							|  |  |  | "create_aggregate($self, /, name, n_arg, aggregate_class)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  | "Creates a new aggregate.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Note: Passing keyword arguments \'name\', \'n_arg\' and \'aggregate_class\'\n" | 
					
						
							|  |  |  | "to _sqlite3.Connection.create_aggregate() is deprecated. Parameters\n" | 
					
						
							|  |  |  | "\'name\', \'n_arg\' and \'aggregate_class\' will become positional-only in\n" | 
					
						
							|  |  |  | "Python 3.15.\n" | 
					
						
							|  |  |  | ""); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_CREATE_AGGREGATE_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"create_aggregate", _PyCFunction_CAST(pysqlite_connection_create_aggregate), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_aggregate__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                           PyTypeObject *cls, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |                                           const char *name, int n_arg, | 
					
						
							|  |  |  |                                           PyObject *aggregate_class); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.create_aggregate'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.create_aggregate'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.create_aggregate'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_create_aggregate(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 3
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(name), &_Py_ID(n_arg), &_Py_ID(aggregate_class), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     static const char * const _keywords[] = {"name", "n_arg", "aggregate_class", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "create_aggregate", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[3]; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     const char *name; | 
					
						
							|  |  |  |     int n_arg; | 
					
						
							|  |  |  |     PyObject *aggregate_class; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 3, /*maxpos*/ 3, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-28 15:32:07 +02:00
										 |  |  |     if (nargs < 3) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing keyword arguments 'name', 'n_arg' and 'aggregate_class' " | 
					
						
							|  |  |  |                 "to _sqlite3.Connection.create_aggregate() is deprecated. " | 
					
						
							|  |  |  |                 "Parameters 'name', 'n_arg' and 'aggregate_class' will become " | 
					
						
							|  |  |  |                 "positional-only in Python 3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("create_aggregate", "argument 'name'", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[0], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     n_arg = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (n_arg == -1 && PyErr_Occurred()) { | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     aggregate_class = args[2]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_create_aggregate_impl((pysqlite_Connection *)self, cls, name, n_arg, aggregate_class); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_set_authorizer__doc__, | 
					
						
							|  |  |  | "set_authorizer($self, /, authorizer_callback)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | "Set authorizer callback.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Note: Passing keyword argument \'authorizer_callback\' to\n" | 
					
						
							|  |  |  | "_sqlite3.Connection.set_authorizer() is deprecated. Parameter\n" | 
					
						
							|  |  |  | "\'authorizer_callback\' will become positional-only in Python 3.15.\n" | 
					
						
							|  |  |  | ""); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_SET_AUTHORIZER_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"set_authorizer", _PyCFunction_CAST(pysqlite_connection_set_authorizer), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_authorizer__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                         PyTypeObject *cls, | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |                                         PyObject *callable); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.set_authorizer'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.set_authorizer'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.set_authorizer'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_set_authorizer(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-16 18:52:45 +09:00
										 |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(authorizer_callback), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     static const char * const _keywords[] = {"authorizer_callback", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "set_authorizer", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[1]; | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |     PyObject *callable; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  |     if (nargs < 1) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing keyword argument 'authorizer_callback' to " | 
					
						
							|  |  |  |                 "_sqlite3.Connection.set_authorizer() is deprecated. Parameter " | 
					
						
							|  |  |  |                 "'authorizer_callback' will become positional-only in Python " | 
					
						
							|  |  |  |                 "3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     callable = args[0]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_set_authorizer_impl((pysqlite_Connection *)self, cls, callable); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__, | 
					
						
							|  |  |  | "set_progress_handler($self, /, progress_handler, n)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | "Set progress handler callback.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  progress_handler\n" | 
					
						
							|  |  |  | "    A callable that takes no arguments.\n" | 
					
						
							|  |  |  | "    If the callable returns non-zero, the current query is terminated,\n" | 
					
						
							|  |  |  | "    and an exception is raised.\n" | 
					
						
							|  |  |  | "  n\n" | 
					
						
							|  |  |  | "    The number of SQLite virtual machine instructions that are\n" | 
					
						
							|  |  |  | "    executed between invocations of \'progress_handler\'.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "If \'progress_handler\' is None or \'n\' is 0, the progress handler is disabled.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Note: Passing keyword argument \'progress_handler\' to\n" | 
					
						
							|  |  |  | "_sqlite3.Connection.set_progress_handler() is deprecated. Parameter\n" | 
					
						
							|  |  |  | "\'progress_handler\' will become positional-only in Python 3.15.\n" | 
					
						
							|  |  |  | ""); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_SET_PROGRESS_HANDLER_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"set_progress_handler", _PyCFunction_CAST(pysqlite_connection_set_progress_handler), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_progress_handler__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                               PyTypeObject *cls, | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |                                               PyObject *callable, int n); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.set_progress_handler'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.set_progress_handler'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.set_progress_handler'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_set_progress_handler(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-16 18:52:45 +09:00
										 |  |  |     #define NUM_KEYWORDS 2
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							| 
									
										
										
										
											2024-06-21 17:19:31 +02:00
										 |  |  |         .ob_item = { &_Py_ID(progress_handler), _Py_LATIN1_CHR('n'), }, | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     static const char * const _keywords[] = {"progress_handler", "n", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "set_progress_handler", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[2]; | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |     PyObject *callable; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     int n; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  |     if (nargs < 1) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing keyword argument 'progress_handler' to " | 
					
						
							|  |  |  |                 "_sqlite3.Connection.set_progress_handler() is deprecated. " | 
					
						
							|  |  |  |                 "Parameter 'progress_handler' will become positional-only in " | 
					
						
							|  |  |  |                 "Python 3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     callable = args[0]; | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     n = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (n == -1 && PyErr_Occurred()) { | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_set_progress_handler_impl((pysqlite_Connection *)self, cls, callable, n); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_set_trace_callback__doc__, | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | "set_trace_callback($self, /, trace_callback)\n" | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | "Set a trace callback called for each SQL statement (passed as unicode).\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Note: Passing keyword argument \'trace_callback\' to\n" | 
					
						
							|  |  |  | "_sqlite3.Connection.set_trace_callback() is deprecated. Parameter\n" | 
					
						
							|  |  |  | "\'trace_callback\' will become positional-only in Python 3.15.\n" | 
					
						
							|  |  |  | ""); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_SET_TRACE_CALLBACK_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"set_trace_callback", _PyCFunction_CAST(pysqlite_connection_set_trace_callback), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_set_trace_callback__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                             PyTypeObject *cls, | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |                                             PyObject *callable); | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  | // Emit compiler warnings when we get to Python 3.15.
 | 
					
						
							|  |  |  | #if PY_VERSION_HEX >= 0x030f00C0
 | 
					
						
							|  |  |  | #  error "Update the clinic input of '_sqlite3.Connection.set_trace_callback'."
 | 
					
						
							|  |  |  | #elif PY_VERSION_HEX >= 0x030f00A0
 | 
					
						
							|  |  |  | #  ifdef _MSC_VER
 | 
					
						
							|  |  |  | #    pragma message ("Update the clinic input of '_sqlite3.Connection.set_trace_callback'.")
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #    warning "Update the clinic input of '_sqlite3.Connection.set_trace_callback'."
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_set_trace_callback(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-16 18:52:45 +09:00
										 |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(trace_callback), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  |     static const char * const _keywords[] = {"trace_callback", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "set_trace_callback", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[1]; | 
					
						
							| 
									
										
										
										
											2021-09-07 13:43:44 +02:00
										 |  |  |     PyObject *callable; | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-29 22:02:12 +02:00
										 |  |  |     if (nargs < 1) { | 
					
						
							|  |  |  |         if (PyErr_WarnEx(PyExc_DeprecationWarning, | 
					
						
							|  |  |  |                 "Passing keyword argument 'trace_callback' to " | 
					
						
							|  |  |  |                 "_sqlite3.Connection.set_trace_callback() is deprecated. " | 
					
						
							|  |  |  |                 "Parameter 'trace_callback' will become positional-only in Python" | 
					
						
							|  |  |  |                 " 3.15.", 1)) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     callable = args[0]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_set_trace_callback_impl((pysqlite_Connection *)self, cls, callable); | 
					
						
							| 
									
										
										
										
											2020-12-19 00:41:33 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-06 11:30:37 +02:00
										 |  |  | #if defined(PY_SQLITE_ENABLE_LOAD_EXTENSION)
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_enable_load_extension__doc__, | 
					
						
							|  |  |  | "enable_load_extension($self, enable, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Enable dynamic loading of SQLite extension modules."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF    \
 | 
					
						
							|  |  |  |     {"enable_load_extension", (PyCFunction)pysqlite_connection_enable_load_extension, METH_O, pysqlite_connection_enable_load_extension__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self, | 
					
						
							|  |  |  |                                                int onoff); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_enable_load_extension(PyObject *self, PyObject *arg) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     int onoff; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 21:52:21 +02:00
										 |  |  |     onoff = PyObject_IsTrue(arg); | 
					
						
							|  |  |  |     if (onoff < 0) { | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_enable_load_extension_impl((pysqlite_Connection *)self, onoff); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-06 11:30:37 +02:00
										 |  |  | #endif /* defined(PY_SQLITE_ENABLE_LOAD_EXTENSION) */
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-06 11:30:37 +02:00
										 |  |  | #if defined(PY_SQLITE_ENABLE_LOAD_EXTENSION)
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_load_extension__doc__, | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  | "load_extension($self, name, /, *, entrypoint=None)\n" | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Load SQLite extension module."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     {"load_extension", _PyCFunction_CAST(pysqlite_connection_load_extension), METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_load_extension__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_load_extension_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |                                         const char *extension_name, | 
					
						
							|  |  |  |                                         const char *entrypoint); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_load_extension(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							|  |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(entrypoint), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							|  |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static const char * const _keywords[] = {"", "entrypoint", NULL}; | 
					
						
							|  |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "load_extension", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							|  |  |  |     PyObject *argsbuf[2]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     const char *extension_name; | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     const char *entrypoint = NULL; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("load_extension", "argument 1", "str", args[0]); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t extension_name_length; | 
					
						
							|  |  |  |     extension_name = PyUnicode_AsUTF8AndSize(args[0], &extension_name_length); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     if (extension_name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(extension_name) != (size_t)extension_name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (args[1] == Py_None) { | 
					
						
							|  |  |  |         entrypoint = NULL; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (PyUnicode_Check(args[1])) { | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |         Py_ssize_t entrypoint_length; | 
					
						
							|  |  |  |         entrypoint = PyUnicode_AsUTF8AndSize(args[1], &entrypoint_length); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |         if (entrypoint == NULL) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |         if (strlen(entrypoint) != (size_t)entrypoint_length) { | 
					
						
							|  |  |  |             PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-04-26 21:22:03 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |         _PyArg_BadArgument("load_extension", "argument 'entrypoint'", "str or None", args[1]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_load_extension_impl((pysqlite_Connection *)self, extension_name, entrypoint); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-06 11:30:37 +02:00
										 |  |  | #endif /* defined(PY_SQLITE_ENABLE_LOAD_EXTENSION) */
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_execute__doc__, | 
					
						
							|  |  |  | "execute($self, sql, parameters=<unrepresentable>, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Executes an SQL statement."); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_EXECUTE_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"execute", _PyCFunction_CAST(pysqlite_connection_execute), METH_FASTCALL, pysqlite_connection_execute__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_execute_impl(pysqlite_Connection *self, PyObject *sql, | 
					
						
							|  |  |  |                                  PyObject *parameters); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_execute(PyObject *self, PyObject *const *args, Py_ssize_t nargs) | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     PyObject *sql; | 
					
						
							|  |  |  |     PyObject *parameters = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!_PyArg_CheckPositional("execute", nargs, 1, 2)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("execute", "argument 1", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     sql = args[0]; | 
					
						
							|  |  |  |     if (nargs < 2) { | 
					
						
							|  |  |  |         goto skip_optional; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     parameters = args[1]; | 
					
						
							|  |  |  | skip_optional: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_execute_impl((pysqlite_Connection *)self, sql, parameters); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_executemany__doc__, | 
					
						
							|  |  |  | "executemany($self, sql, parameters, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Repeatedly executes an SQL statement."); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_EXECUTEMANY_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"executemany", _PyCFunction_CAST(pysqlite_connection_executemany), METH_FASTCALL, pysqlite_connection_executemany__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_executemany_impl(pysqlite_Connection *self, | 
					
						
							|  |  |  |                                      PyObject *sql, PyObject *parameters); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_executemany(PyObject *self, PyObject *const *args, Py_ssize_t nargs) | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     PyObject *sql; | 
					
						
							|  |  |  |     PyObject *parameters; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!_PyArg_CheckPositional("executemany", nargs, 2, 2)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("executemany", "argument 1", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     sql = args[0]; | 
					
						
							|  |  |  |     parameters = args[1]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_executemany_impl((pysqlite_Connection *)self, sql, parameters); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_executescript__doc__, | 
					
						
							|  |  |  | "executescript($self, sql_script, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Executes multiple SQL statements at once."); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_EXECUTESCRIPT_METHODDEF    \
 | 
					
						
							|  |  |  |     {"executescript", (PyCFunction)pysqlite_connection_executescript, METH_O, pysqlite_connection_executescript__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-11 16:33:36 +01:00
										 |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_executescript_impl(pysqlite_Connection *self, | 
					
						
							|  |  |  |                                        PyObject *script_obj); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_executescript(PyObject *self, PyObject *script_obj) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return_value = pysqlite_connection_executescript_impl((pysqlite_Connection *)self, script_obj); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_interrupt__doc__, | 
					
						
							|  |  |  | "interrupt($self, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Abort any pending database operation."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_INTERRUPT_METHODDEF    \
 | 
					
						
							|  |  |  |     {"interrupt", (PyCFunction)pysqlite_connection_interrupt, METH_NOARGS, pysqlite_connection_interrupt__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_interrupt_impl(pysqlite_Connection *self); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_interrupt(PyObject *self, PyObject *Py_UNUSED(ignored)) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return pysqlite_connection_interrupt_impl((pysqlite_Connection *)self); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_iterdump__doc__, | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  | "iterdump($self, /, *, filter=None)\n" | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  | "Returns iterator to the dump of the database in an SQL text format.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  filter\n" | 
					
						
							|  |  |  | "    An optional LIKE pattern for database objects to dump"); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_ITERDUMP_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  |     {"iterdump", _PyCFunction_CAST(pysqlite_connection_iterdump), METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_iterdump__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  | pysqlite_connection_iterdump_impl(pysqlite_Connection *self, | 
					
						
							|  |  |  |                                   PyObject *filter); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_iterdump(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							|  |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(filter), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							|  |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static const char * const _keywords[] = {"filter", NULL}; | 
					
						
							|  |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "iterdump", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							|  |  |  |     PyObject *argsbuf[1]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; | 
					
						
							|  |  |  |     PyObject *filter = Py_None; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     filter = args[0]; | 
					
						
							|  |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_iterdump_impl((pysqlite_Connection *)self, filter); | 
					
						
							| 
									
										
										
										
											2024-02-06 12:34:56 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_backup__doc__, | 
					
						
							| 
									
										
										
										
											2021-02-11 00:04:02 +01:00
										 |  |  | "backup($self, /, target, *, pages=-1, progress=None, name=\'main\',\n" | 
					
						
							|  |  |  | "       sleep=0.25)\n" | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Makes a backup of the database."); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_BACKUP_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"backup", _PyCFunction_CAST(pysqlite_connection_backup), METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_backup__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_backup_impl(pysqlite_Connection *self, | 
					
						
							|  |  |  |                                 pysqlite_Connection *target, int pages, | 
					
						
							|  |  |  |                                 PyObject *progress, const char *name, | 
					
						
							|  |  |  |                                 double sleep); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_backup(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 5
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(target), &_Py_ID(pages), &_Py_ID(progress), &_Py_ID(name), &_Py_ID(sleep), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     static const char * const _keywords[] = {"target", "pages", "progress", "name", "sleep", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "backup", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     PyObject *argsbuf[5]; | 
					
						
							| 
									
										
										
										
											2021-02-11 00:04:02 +01:00
										 |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; | 
					
						
							|  |  |  |     pysqlite_Connection *target; | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     int pages = -1; | 
					
						
							|  |  |  |     PyObject *progress = Py_None; | 
					
						
							|  |  |  |     const char *name = "main"; | 
					
						
							|  |  |  |     double sleep = 0.25; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-06-15 14:47:34 +02:00
										 |  |  |     if (!PyObject_TypeCheck(args[0], clinic_state()->ConnectionType)) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("backup", "argument 'target'", (clinic_state()->ConnectionType)->tp_name, args[0]); | 
					
						
							| 
									
										
										
										
											2021-02-11 00:04:02 +01:00
										 |  |  |         goto exit; | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-02-11 00:04:02 +01:00
										 |  |  |     target = (pysqlite_Connection *)args[0]; | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (args[1]) { | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |         pages = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |         if (pages == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_kwonly; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (args[2]) { | 
					
						
							|  |  |  |         progress = args[2]; | 
					
						
							|  |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_kwonly; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (args[3]) { | 
					
						
							|  |  |  |         if (!PyUnicode_Check(args[3])) { | 
					
						
							|  |  |  |             _PyArg_BadArgument("backup", "argument 'name'", "str", args[3]); | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |         Py_ssize_t name_length; | 
					
						
							|  |  |  |         name = PyUnicode_AsUTF8AndSize(args[3], &name_length); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |         if (name == NULL) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |         if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |             PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  |         if (!--noptargs) { | 
					
						
							|  |  |  |             goto skip_optional_kwonly; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (PyFloat_CheckExact(args[4])) { | 
					
						
							|  |  |  |         sleep = PyFloat_AS_DOUBLE(args[4]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         sleep = PyFloat_AsDouble(args[4]); | 
					
						
							|  |  |  |         if (sleep == -1.0 && PyErr_Occurred()) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_backup_impl((pysqlite_Connection *)self, target, pages, progress, name, sleep); | 
					
						
							| 
									
										
										
										
											2020-12-27 09:32:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_create_collation__doc__, | 
					
						
							|  |  |  | "create_collation($self, name, callback, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							| 
									
										
										
										
											2022-03-08 05:18:41 +01:00
										 |  |  | "Creates a collation function."); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_CREATE_COLLATION_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"create_collation", _PyCFunction_CAST(pysqlite_connection_create_collation), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pysqlite_connection_create_collation__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_create_collation_impl(pysqlite_Connection *self, | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |                                           PyTypeObject *cls, | 
					
						
							| 
									
										
										
										
											2021-07-29 09:47:56 +02:00
										 |  |  |                                           const char *name, | 
					
						
							|  |  |  |                                           PyObject *callable); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_create_collation(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							|  |  |  |     #  define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
 | 
					
						
							|  |  |  |     #else
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-19 15:44:45 +02:00
										 |  |  |     static const char * const _keywords[] = {"", "", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "create_collation", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     PyObject *argsbuf[2]; | 
					
						
							| 
									
										
										
										
											2021-07-29 09:47:56 +02:00
										 |  |  |     const char *name; | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  |     PyObject *callable; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("create_collation", "argument 1", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[0], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-30 13:15:02 +03:00
										 |  |  |     callable = args[1]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_create_collation_impl((pysqlite_Connection *)self, cls, name, callable); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | #if defined(PY_SQLITE_HAVE_SERIALIZE)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(serialize__doc__, | 
					
						
							|  |  |  | "serialize($self, /, *, name=\'main\')\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Serialize a database into a byte string.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  name\n" | 
					
						
							|  |  |  | "    Which database to serialize.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "For an ordinary on-disk database file, the serialization is just a copy of the\n" | 
					
						
							|  |  |  | "disk file. For an in-memory database or a \"temp\" database, the serialization is\n" | 
					
						
							|  |  |  | "the same sequence of bytes which would be written to disk if that database\n" | 
					
						
							|  |  |  | "were backed up to disk."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SERIALIZE_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"serialize", _PyCFunction_CAST(serialize), METH_FASTCALL|METH_KEYWORDS, serialize__doc__}, | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | serialize_impl(pysqlite_Connection *self, const char *name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | serialize(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(name), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     static const char * const _keywords[] = {"name", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "serialize", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     PyObject *argsbuf[1]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0; | 
					
						
							|  |  |  |     const char *name = "main"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 0, /*maxpos*/ 0, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("serialize", "argument 'name'", "str", args[0]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[0], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = serialize_impl((pysqlite_Connection *)self, name); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* defined(PY_SQLITE_HAVE_SERIALIZE) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(PY_SQLITE_HAVE_SERIALIZE)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(deserialize__doc__, | 
					
						
							|  |  |  | "deserialize($self, data, /, *, name=\'main\')\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Load a serialized database.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  data\n" | 
					
						
							|  |  |  | "    The serialized database content.\n" | 
					
						
							|  |  |  | "  name\n" | 
					
						
							|  |  |  | "    Which database to reopen with the deserialization.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "The deserialize interface causes the database connection to disconnect from the\n" | 
					
						
							|  |  |  | "target database, and then reopen it as an in-memory database based on the given\n" | 
					
						
							|  |  |  | "serialized data.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "The deserialize interface will fail with SQLITE_BUSY if the database is\n" | 
					
						
							|  |  |  | "currently in a read transaction or is involved in a backup operation."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define DESERIALIZE_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"deserialize", _PyCFunction_CAST(deserialize), METH_FASTCALL|METH_KEYWORDS, deserialize__doc__}, | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | deserialize_impl(pysqlite_Connection *self, Py_buffer *data, | 
					
						
							|  |  |  |                  const char *name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | deserialize(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define NUM_KEYWORDS 1
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static struct { | 
					
						
							|  |  |  |         PyGC_Head _this_is_not_used; | 
					
						
							|  |  |  |         PyObject_VAR_HEAD | 
					
						
							|  |  |  |         PyObject *ob_item[NUM_KEYWORDS]; | 
					
						
							|  |  |  |     } _kwtuple = { | 
					
						
							|  |  |  |         .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) | 
					
						
							|  |  |  |         .ob_item = { &_Py_ID(name), }, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef NUM_KEYWORDS
 | 
					
						
							| 
									
										
										
										
											2022-08-13 12:09:40 +02:00
										 |  |  |     #define KWTUPLE (&_kwtuple.ob_base.ob_base)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     #else  // !Py_BUILD_CORE
 | 
					
						
							|  |  |  |     #  define KWTUPLE NULL
 | 
					
						
							|  |  |  |     #endif  // !Py_BUILD_CORE
 | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     static const char * const _keywords[] = {"", "name", NULL}; | 
					
						
							| 
									
										
										
										
											2022-08-11 15:25:49 -06:00
										 |  |  |     static _PyArg_Parser _parser = { | 
					
						
							|  |  |  |         .keywords = _keywords, | 
					
						
							|  |  |  |         .fname = "deserialize", | 
					
						
							|  |  |  |         .kwtuple = KWTUPLE, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     #undef KWTUPLE
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     PyObject *argsbuf[2]; | 
					
						
							|  |  |  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; | 
					
						
							|  |  |  |     Py_buffer data = {NULL, NULL}; | 
					
						
							|  |  |  |     const char *name = "main"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-08 14:23:50 +02:00
										 |  |  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, | 
					
						
							|  |  |  |             /*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     if (!args) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (PyUnicode_Check(args[0])) { | 
					
						
							|  |  |  |         Py_ssize_t len; | 
					
						
							|  |  |  |         const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len); | 
					
						
							|  |  |  |         if (ptr == NULL) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-02-05 13:45:09 +03:00
										 |  |  |         if (PyBuffer_FillInfo(&data, args[0], (void *)ptr, len, 1, PyBUF_SIMPLE) < 0) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { /* any bytes-like object */ | 
					
						
							|  |  |  |         if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { | 
					
						
							|  |  |  |             goto exit; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!noptargs) { | 
					
						
							|  |  |  |         goto skip_optional_kwonly; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!PyUnicode_Check(args[1])) { | 
					
						
							|  |  |  |         _PyArg_BadArgument("deserialize", "argument 'name'", "str", args[1]); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     Py_ssize_t name_length; | 
					
						
							|  |  |  |     name = PyUnicode_AsUTF8AndSize(args[1], &name_length); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  |     if (name == NULL) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-07 23:36:13 +01:00
										 |  |  |     if (strlen(name) != (size_t)name_length) { | 
					
						
							|  |  |  |         PyErr_SetString(PyExc_ValueError, "embedded null character"); | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | skip_optional_kwonly: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = deserialize_impl((pysqlite_Connection *)self, &data, name); | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     /* Cleanup for data */ | 
					
						
							|  |  |  |     if (data.obj) { | 
					
						
							|  |  |  |        PyBuffer_Release(&data); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* defined(PY_SQLITE_HAVE_SERIALIZE) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | PyDoc_STRVAR(pysqlite_connection_enter__doc__, | 
					
						
							|  |  |  | "__enter__($self, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Called when the connection is used as a context manager.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Returns itself as a convenience to the caller."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_ENTER_METHODDEF    \
 | 
					
						
							|  |  |  |     {"__enter__", (PyCFunction)pysqlite_connection_enter, METH_NOARGS, pysqlite_connection_enter__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_enter_impl(pysqlite_Connection *self); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_enter(PyObject *self, PyObject *Py_UNUSED(ignored)) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return pysqlite_connection_enter_impl((pysqlite_Connection *)self); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(pysqlite_connection_exit__doc__, | 
					
						
							|  |  |  | "__exit__($self, type, value, traceback, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Called when the connection is used as a context manager.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "If there was any exception, a rollback takes place; otherwise we commit."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PYSQLITE_CONNECTION_EXIT_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"__exit__", _PyCFunction_CAST(pysqlite_connection_exit), METH_FASTCALL, pysqlite_connection_exit__doc__}, | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type, | 
					
						
							|  |  |  |                               PyObject *exc_value, PyObject *exc_tb); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | pysqlite_connection_exit(PyObject *self, PyObject *const *args, Py_ssize_t nargs) | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     PyObject *exc_type; | 
					
						
							|  |  |  |     PyObject *exc_value; | 
					
						
							|  |  |  |     PyObject *exc_tb; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!_PyArg_CheckPositional("__exit__", nargs, 3, 3)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     exc_type = args[0]; | 
					
						
							|  |  |  |     exc_value = args[1]; | 
					
						
							|  |  |  |     exc_tb = args[2]; | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = pysqlite_connection_exit_impl((pysqlite_Connection *)self, exc_type, exc_value, exc_tb); | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | PyDoc_STRVAR(setlimit__doc__, | 
					
						
							|  |  |  | "setlimit($self, category, limit, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Set connection run-time limits.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  category\n" | 
					
						
							|  |  |  | "    The limit category to be set.\n" | 
					
						
							|  |  |  | "  limit\n" | 
					
						
							|  |  |  | "    The new limit. If the new limit is a negative number, the limit is\n" | 
					
						
							|  |  |  | "    unchanged.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Attempts to increase a limit above its hard upper bound are silently truncated\n" | 
					
						
							|  |  |  | "to the hard upper bound. Regardless of whether or not the limit was changed,\n" | 
					
						
							|  |  |  | "the prior value of the limit is returned."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SETLIMIT_METHODDEF    \
 | 
					
						
							| 
									
										
										
										
											2022-05-03 20:25:41 +02:00
										 |  |  |     {"setlimit", _PyCFunction_CAST(setlimit), METH_FASTCALL, setlimit__doc__}, | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | setlimit_impl(pysqlite_Connection *self, int category, int limit); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | setlimit(PyObject *self, PyObject *const *args, Py_ssize_t nargs) | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     int category; | 
					
						
							|  |  |  |     int limit; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!_PyArg_CheckPositional("setlimit", nargs, 2, 2)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     category = PyLong_AsInt(args[0]); | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  |     if (category == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     limit = PyLong_AsInt(args[1]); | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  |     if (limit == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = setlimit_impl((pysqlite_Connection *)self, category, limit); | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(getlimit__doc__, | 
					
						
							|  |  |  | "getlimit($self, category, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Get connection run-time limits.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  category\n" | 
					
						
							|  |  |  | "    The limit category to be queried."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define GETLIMIT_METHODDEF    \
 | 
					
						
							|  |  |  |     {"getlimit", (PyCFunction)getlimit, METH_O, getlimit__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | getlimit_impl(pysqlite_Connection *self, int category); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | getlimit(PyObject *self, PyObject *arg) | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     int category; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     category = PyLong_AsInt(arg); | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  |     if (category == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = getlimit_impl((pysqlite_Connection *)self, category); | 
					
						
							| 
									
										
										
										
											2021-11-01 23:50:53 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  | PyDoc_STRVAR(setconfig__doc__, | 
					
						
							|  |  |  | "setconfig($self, op, enable=True, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Set a boolean connection configuration option.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  op\n" | 
					
						
							|  |  |  | "    The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SETCONFIG_METHODDEF    \
 | 
					
						
							|  |  |  |     {"setconfig", _PyCFunction_CAST(setconfig), METH_FASTCALL, setconfig__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							|  |  |  | setconfig_impl(pysqlite_Connection *self, int op, int enable); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | setconfig(PyObject *self, PyObject *const *args, Py_ssize_t nargs) | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     int op; | 
					
						
							|  |  |  |     int enable = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!_PyArg_CheckPositional("setconfig", nargs, 1, 2)) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     op = PyLong_AsInt(args[0]); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  |     if (op == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (nargs < 2) { | 
					
						
							|  |  |  |         goto skip_optional; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     enable = PyObject_IsTrue(args[1]); | 
					
						
							|  |  |  |     if (enable < 0) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | skip_optional: | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     return_value = setconfig_impl((pysqlite_Connection *)self, op, enable); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PyDoc_STRVAR(getconfig__doc__, | 
					
						
							|  |  |  | "getconfig($self, op, /)\n" | 
					
						
							|  |  |  | "--\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "Query a boolean connection configuration option.\n" | 
					
						
							|  |  |  | "\n" | 
					
						
							|  |  |  | "  op\n" | 
					
						
							|  |  |  | "    The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define GETCONFIG_METHODDEF    \
 | 
					
						
							|  |  |  |     {"getconfig", (PyCFunction)getconfig, METH_O, getconfig__doc__}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int | 
					
						
							|  |  |  | getconfig_impl(pysqlite_Connection *self, int op); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  | getconfig(PyObject *self, PyObject *arg) | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     PyObject *return_value = NULL; | 
					
						
							|  |  |  |     int op; | 
					
						
							|  |  |  |     int _return_value; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-25 00:51:22 +02:00
										 |  |  |     op = PyLong_AsInt(arg); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  |     if (op == -1 && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-01-20 12:40:18 +01:00
										 |  |  |     _return_value = getconfig_impl((pysqlite_Connection *)self, op); | 
					
						
							| 
									
										
										
										
											2023-04-26 21:57:48 +02:00
										 |  |  |     if ((_return_value == -1) && PyErr_Occurred()) { | 
					
						
							|  |  |  |         goto exit; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return_value = PyBool_FromLong((long)_return_value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | exit: | 
					
						
							|  |  |  |     return return_value; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 02:55:59 +02:00
										 |  |  | #ifndef CREATE_WINDOW_FUNCTION_METHODDEF
 | 
					
						
							|  |  |  |     #define CREATE_WINDOW_FUNCTION_METHODDEF
 | 
					
						
							|  |  |  | #endif /* !defined(CREATE_WINDOW_FUNCTION_METHODDEF) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-18 15:25:35 +01:00
										 |  |  | #ifndef PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF
 | 
					
						
							|  |  |  |     #define PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF
 | 
					
						
							|  |  |  | #endif /* !defined(PYSQLITE_CONNECTION_ENABLE_LOAD_EXTENSION_METHODDEF) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
 | 
					
						
							|  |  |  |     #define PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF
 | 
					
						
							|  |  |  | #endif /* !defined(PYSQLITE_CONNECTION_LOAD_EXTENSION_METHODDEF) */
 | 
					
						
							| 
									
										
										
										
											2022-04-05 16:15:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef SERIALIZE_METHODDEF
 | 
					
						
							|  |  |  |     #define SERIALIZE_METHODDEF
 | 
					
						
							|  |  |  | #endif /* !defined(SERIALIZE_METHODDEF) */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef DESERIALIZE_METHODDEF
 | 
					
						
							|  |  |  |     #define DESERIALIZE_METHODDEF
 | 
					
						
							|  |  |  | #endif /* !defined(DESERIALIZE_METHODDEF) */
 | 
					
						
							| 
									
										
										
										
											2025-03-11 16:33:36 +01:00
										 |  |  | /*[clinic end generated code: output=fc4857f09ad563b1 input=a9049054013a1b77]*/ |