@@ -76,6 +76,13 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
7676 return result ;
7777}
7878
79+ PyDoc_STRVAR (module_connect_doc ,
80+ "connect(database[, timeout, isolation_level, detect_types, factory])\n\
81+ \n\
82+ Opens a connection to the SQLite database file *database*. You can use\n\
83+ \":memory:\" to open a database connection to a database that resides in\n\
84+ RAM instead of on disk." );
85+
7986static PyObject * module_complete (PyObject * self , PyObject * args , PyObject *
8087 kwargs )
8188{
@@ -100,6 +107,11 @@ static PyObject* module_complete(PyObject* self, PyObject* args, PyObject*
100107 return result ;
101108}
102109
110+ PyDoc_STRVAR (module_complete_doc ,
111+ "complete_statement(sql)\n\
112+ \n\
113+ Checks if a string contains a complete SQL statement. Non-standard." );
114+
103115#ifdef HAVE_SHARED_CACHE
104116static PyObject * module_enable_shared_cache (PyObject * self , PyObject * args , PyObject *
105117 kwargs )
@@ -123,9 +135,15 @@ static PyObject* module_enable_shared_cache(PyObject* self, PyObject* args, PyOb
123135 return Py_None ;
124136 }
125137}
138+
139+ PyDoc_STRVAR (module_enable_shared_cache_doc ,
140+ "enable_shared_cache(do_enable)\n\
141+ \n\
142+ Enable or disable shared cache mode for the calling thread.\n\
143+ Experimental/Non-standard." );
126144#endif /* HAVE_SHARED_CACHE */
127145
128- static PyObject * module_register_adapter (PyObject * self , PyObject * args , PyObject * kwargs )
146+ static PyObject * module_register_adapter (PyObject * self , PyObject * args )
129147{
130148 PyTypeObject * type ;
131149 PyObject * caster ;
@@ -147,7 +165,12 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args, PyObjec
147165 return Py_None ;
148166}
149167
150- static PyObject * module_register_converter (PyObject * self , PyObject * args , PyObject * kwargs )
168+ PyDoc_STRVAR (module_register_adapter_doc ,
169+ "register_adapter(type, callable)\n\
170+ \n\
171+ Registers an adapter with pysqlite's adapter registry. Non-standard." );
172+
173+ static PyObject * module_register_converter (PyObject * self , PyObject * args )
151174{
152175 PyObject * orig_name ;
153176 PyObject * name = NULL ;
@@ -175,7 +198,12 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args, PyObj
175198 return retval ;
176199}
177200
178- static PyObject * enable_callback_tracebacks (PyObject * self , PyObject * args , PyObject * kwargs )
201+ PyDoc_STRVAR (module_register_converter_doc ,
202+ "register_converter(typename, callable)\n\
203+ \n\
204+ Registers a converter with pysqlite. Non-standard." );
205+
206+ static PyObject * enable_callback_tracebacks (PyObject * self , PyObject * args )
179207{
180208 if (!PyArg_ParseTuple (args , "i" , & _enable_callback_tracebacks )) {
181209 return NULL ;
@@ -185,6 +213,11 @@ static PyObject* enable_callback_tracebacks(PyObject* self, PyObject* args, PyOb
185213 return Py_None ;
186214}
187215
216+ PyDoc_STRVAR (enable_callback_tracebacks_doc ,
217+ "enable_callback_tracebacks(flag)\n\
218+ \n\
219+ Enable or disable callback functions throwing errors to stderr." );
220+
188221static void converters_init (PyObject * dict )
189222{
190223 converters = PyDict_New ();
@@ -196,15 +229,22 @@ static void converters_init(PyObject* dict)
196229}
197230
198231static PyMethodDef module_methods [] = {
199- {"connect" , (PyCFunction )module_connect , METH_VARARGS |METH_KEYWORDS , PyDoc_STR ("Creates a connection." )},
200- {"complete_statement" , (PyCFunction )module_complete , METH_VARARGS |METH_KEYWORDS , PyDoc_STR ("Checks if a string contains a complete SQL statement. Non-standard." )},
232+ {"connect" , (PyCFunction )module_connect ,
233+ METH_VARARGS | METH_KEYWORDS , module_connect_doc },
234+ {"complete_statement" , (PyCFunction )module_complete ,
235+ METH_VARARGS | METH_KEYWORDS , module_complete_doc },
201236#ifdef HAVE_SHARED_CACHE
202- {"enable_shared_cache" , (PyCFunction )module_enable_shared_cache , METH_VARARGS |METH_KEYWORDS , PyDoc_STR ("Enable or disable shared cache mode for the calling thread. Experimental/Non-standard." )},
237+ {"enable_shared_cache" , (PyCFunction )module_enable_shared_cache ,
238+ METH_VARARGS | METH_KEYWORDS , module_enable_shared_cache_doc },
203239#endif
204- {"register_adapter" , (PyCFunction )module_register_adapter , METH_VARARGS , PyDoc_STR ("Registers an adapter with pysqlite's adapter registry. Non-standard." )},
205- {"register_converter" , (PyCFunction )module_register_converter , METH_VARARGS , PyDoc_STR ("Registers a converter with pysqlite. Non-standard." )},
206- {"adapt" , (PyCFunction )psyco_microprotocols_adapt , METH_VARARGS , psyco_microprotocols_adapt_doc },
207- {"enable_callback_tracebacks" , (PyCFunction )enable_callback_tracebacks , METH_VARARGS , PyDoc_STR ("Enable or disable callback functions throwing errors to stderr." )},
240+ {"register_adapter" , (PyCFunction )module_register_adapter ,
241+ METH_VARARGS , module_register_adapter_doc },
242+ {"register_converter" , (PyCFunction )module_register_converter ,
243+ METH_VARARGS , module_register_converter_doc },
244+ {"adapt" , (PyCFunction )psyco_microprotocols_adapt , METH_VARARGS ,
245+ psyco_microprotocols_adapt_doc },
246+ {"enable_callback_tracebacks" , (PyCFunction )enable_callback_tracebacks ,
247+ METH_VARARGS , enable_callback_tracebacks_doc },
208248 {NULL , NULL }
209249};
210250
@@ -389,12 +429,12 @@ PyMODINIT_FUNC init_sqlite3(void)
389429
390430 pysqlite_BaseTypeAdapted = 0 ;
391431
392- /* Original comment form _bsddb.c in the Python core. This is also still
432+ /* Original comment from _bsddb.c in the Python core. This is also still
393433 * needed nowadays for Python 2.3/2.4.
394434 *
395435 * PyEval_InitThreads is called here due to a quirk in python 1.5
396436 * - 2.2.1 (at least) according to Russell Williamson <merel@wt.net>:
397- * The global interepreter lock is not initialized until the first
437+ * The global interpreter lock is not initialized until the first
398438 * thread is created using thread.start_new_thread() or fork() is
399439 * called. that would cause the ALLOW_THREADS here to segfault due
400440 * to a null pointer reference if no threads or child processes
0 commit comments