Skip to content

Commit

Permalink
completely disable backup functionality in order to be compilable wit…
Browse files Browse the repository at this point in the history
…h older SQLite releases
  • Loading branch information
ghaering committed Feb 15, 2011
1 parent eb1eb6f commit e421efa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion setup.py
Expand Up @@ -35,9 +35,14 @@

sqlite = "sqlite"

PYSQLITE_EXPERIMENTAL = True

sources = ["src/module.c", "src/connection.c", "src/cursor.c", "src/cache.c",
"src/microprotocols.c", "src/prepare_protocol.c", "src/statement.c",
"src/util.c", "src/row.c", "src/backup.c"]
"src/util.c", "src/row.c"]

if PYSQLITE_EXPERIMENTAL:
sources.append("src/backup.c")

include_dirs = []
library_dirs = []
Expand Down
11 changes: 8 additions & 3 deletions src/connection.c
Expand Up @@ -21,7 +21,6 @@
* 3. This notice may not be removed or altered from any source distribution.
*/

#include "backup.h"
#include "cache.h"
#include "module.h"
#include "connection.h"
Expand All @@ -31,6 +30,10 @@
#include "util.h"
#include "sqlitecompat.h"

#ifdef PYSQLITE_EXPERIMENTAL
#include "backup.h"
#endif

#include "pythread.h"

#define ACTION_FINALIZE 1
Expand Down Expand Up @@ -352,6 +355,7 @@ PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args,
return cursor;
}

#ifdef PYSQLITE_EXPERIMENTAL
PyObject* pysqlite_connection_backup(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
{
static char *kwlist[] = {"dest_db", "source_name", "dest_db_name", NULL, NULL};
Expand Down Expand Up @@ -384,6 +388,7 @@ PyObject* pysqlite_connection_backup(pysqlite_Connection* self, PyObject* args,

return (PyObject*)backup;
}
#endif

PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
{
Expand Down Expand Up @@ -1588,10 +1593,10 @@ static PyGetSetDef connection_getset[] = {
};

static PyMethodDef connection_methods[] = {
/*
#ifdef PYSQLITE_EXPERIMENTAL
{"backup", (PyCFunction)pysqlite_connection_backup, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Backup database.")},
*/
#endif
{"cursor", (PyCFunction)pysqlite_connection_cursor, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("Return a cursor for the connection.")},
{"close", (PyCFunction)pysqlite_connection_close, METH_NOARGS,
Expand Down
7 changes: 6 additions & 1 deletion src/module.c
Expand Up @@ -24,12 +24,15 @@
#include "connection.h"
#include "statement.h"
#include "cursor.h"
#include "backup.h"
#include "cache.h"
#include "prepare_protocol.h"
#include "microprotocols.h"
#include "row.h"

#ifdef PYSQLITE_EXPERIMENTAL
#include "backup.h"
#endif

#if SQLITE_VERSION_NUMBER >= 3003003
#define HAVE_SHARED_CACHE
#endif
Expand Down Expand Up @@ -315,7 +318,9 @@ PyMODINIT_FUNC init_sqlite(void)
(pysqlite_connection_setup_types() < 0) ||
(pysqlite_cache_setup_types() < 0) ||
(pysqlite_statement_setup_types() < 0) ||
#ifdef PYSQLITE_EXPERIMENTAL
(pysqlite_backup_setup_types() < 0) ||
#endif
(pysqlite_prepare_protocol_setup_types() < 0)
) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/module.h
Expand Up @@ -25,7 +25,7 @@
#define PYSQLITE_MODULE_H
#include "Python.h"

#define PYSQLITE_VERSION "2.6.1"
#define PYSQLITE_VERSION "2.6.2"

extern PyObject* pysqlite_Error;
extern PyObject* pysqlite_Warning;
Expand Down

0 comments on commit e421efa

Please sign in to comment.