Skip to content

Commit

Permalink
SQLite: cats: remove sqlite macros
Browse files Browse the repository at this point in the history
SQLITE3_INIT_QUERY
HAVE_SQLITE3
HAVE_SQLITE3_THREAD_SAFE
  • Loading branch information
alaaeddineelamri committed Feb 27, 2023
1 parent 2c7a676 commit 95f5cf4
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 44 deletions.
1 change: 0 additions & 1 deletion cmake/BareosSetVariableDefaults.cmake
Expand Up @@ -574,7 +574,6 @@ set(_LARGEFILE_SOURCE 1)
set(_LARGE_FILES 1)
set(_FILE_OFFSET_BITS 64)
set(HAVE_COMPRESS_BOUND 1)
set(HAVE_SQLITE3_THREADSAFE 1)

set(PACKAGE_NAME "\"${CMAKE_PROJECT_NAME}\"")
set(PACKAGE_STRING "\"${CMAKE_PROJECT_NAME} ${BAREOS_NUMERIC_VERSION}\"")
Expand Down
1 change: 0 additions & 1 deletion core/cmake/BareosCheckFunctions.cmake
Expand Up @@ -80,7 +80,6 @@ check_function_exists(setreuid HAVE_SETREUID)
check_function_exists(setxattr HAVE_SETXATTR)
check_function_exists(hl_loa HAVE_HL_LOA)
check_function_exists(sizeof_proplist_entry HAVE_SIZEOF_PROPLIST_ENTRY)
check_function_exists(sqlite3_threadsafe HAVE_SQLITE3_THREADSAFE)
check_function_exists(unlinkat HAVE_UNLINKAT)
check_function_exists(utimes HAVE_UTIMES)

Expand Down
4 changes: 2 additions & 2 deletions core/src/cats/bvfs.cc
Expand Up @@ -26,7 +26,7 @@
*/
#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats/cats.h"
# include "cats/sql.h"
Expand Down Expand Up @@ -883,5 +883,5 @@ bool Bvfs::compute_restore_list(char* fileid,
return retval;
}

#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/cats.cc
Expand Up @@ -28,7 +28,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "sql_pooling.h"
Expand Down Expand Up @@ -237,5 +237,5 @@ void BareosDb::UnescapeObject(JobControlRecord*,
dest[expected_len] = '\0';
}

#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/cats_backends.cc
Expand Up @@ -28,7 +28,7 @@
#include "include/bareos.h"
#include "lib/edit.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"

Expand Down Expand Up @@ -299,5 +299,5 @@ BareosDb* db_init_database(JobControlRecord* jcr,

void DbFlushBackends(void) {}
# endif /* HAVE_DYNAMIC_CATS_BACKENDS */
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql.cc
Expand Up @@ -32,7 +32,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -909,5 +909,5 @@ void DbDebugPrint(JobControlRecord* jcr, FILE* fp)

mdb->DbDebugPrint(fp);
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_create.cc
Expand Up @@ -30,7 +30,7 @@

static const int dbglevel = 100;

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -1392,5 +1392,5 @@ bool BareosDb::CreateTapealertStatistics(JobControlRecord* jcr,
return true;
}
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_delete.cc
Expand Up @@ -28,7 +28,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -264,4 +264,4 @@ void BareosDb::PurgeJobs(const char* jobids)
Mmsg(query, "DELETE FROM Job WHERE JobId IN (%s)", jobids);
SqlQuery(query.c_str());
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES */
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES */
4 changes: 2 additions & 2 deletions core/src/cats/sql_find.cc
Expand Up @@ -32,7 +32,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -621,5 +621,5 @@ int BareosDb::FindNextVolume(JobControlRecord* jcr,
Dmsg1(050, "Rtn numrows=%d\n", num_rows);
return num_rows;
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_get.cc
Expand Up @@ -32,7 +32,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "sql.h"
Expand Down Expand Up @@ -1910,5 +1910,5 @@ bool BareosDb::VerifyMediaIdsFromSingleStorage(JobControlRecord* jcr,
}


#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_list.cc
Expand Up @@ -28,7 +28,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -788,5 +788,5 @@ void BareosDb::ListFilesets(JobControlRecord* jcr,

SqlFreeResult();
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_pooling.cc
Expand Up @@ -28,7 +28,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "cats_backends.h"
Expand Down Expand Up @@ -148,5 +148,5 @@ void DbSqlClosePooledConnection(JobControlRecord* jcr, BareosDb* mdb, bool)
mdb->CloseDatabase(jcr);
}

#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_query.cc
Expand Up @@ -27,7 +27,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"

Expand Down Expand Up @@ -155,5 +155,5 @@ bool BareosDb::SqlQuery(const char* query,

return retval;
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
4 changes: 2 additions & 2 deletions core/src/cats/sql_update.cc
Expand Up @@ -28,7 +28,7 @@

#include "include/bareos.h"

#if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
#if HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI

# include "cats.h"
# include "lib/edit.h"
Expand Down Expand Up @@ -573,5 +573,5 @@ void BareosDb::UpgradeCopies(const char* jobids)

SqlQuery("DROP TABLE cpy_tmp");
}
#endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
#endif /* HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || \
HAVE_DBI */
6 changes: 0 additions & 6 deletions core/src/include/config.h.in
Expand Up @@ -421,12 +421,6 @@ extern char win_os[];
// Define to 1 if you have the `sizeof_proplist_entry' function
#cmakedefine HAVE_SIZEOF_PROPLIST_ENTRY @HAVE_SIZEOF_PROPLIST_ENTRY@

// Set if you have an SQLite3 Database
#cmakedefine HAVE_SQLITE3 @HAVE_SQLITE3@

// Define to 1 if you have the `sqlite3_threadsafe' function
#cmakedefine HAVE_SQLITE3_THREADSAFE @HAVE_SQLITE3_THREADSAFE@

// Define to 1 if you are running Solaris
#cmakedefine HAVE_SUN_OS @HAVE_SUN_OS@

Expand Down
6 changes: 0 additions & 6 deletions core/src/lib/version.h
Expand Up @@ -66,12 +66,6 @@ extern const struct BareosVersionStrings kBareosVersionStrings;
# define SMCHECK
#endif

// for fastest speed but you must have a UPS to avoid unwanted shutdowns
//#define SQLITE3_INIT_QUERY "PRAGMA synchronous = OFF"

// for more safety, but is 30 times slower than above
#define SQLITE3_INIT_QUERY "PRAGMA synchronous = NORMAL"

/* Debug flags not normally turned on */

/* #define TRACE_JCR_CHAIN 1 */
Expand Down
6 changes: 0 additions & 6 deletions core/src/win32/compat/include/mingwconfig.h
Expand Up @@ -153,12 +153,6 @@
/* Define to 1 if DB batch insert code enabled */
#define USE_BATCH_FILE_INSERT 1

/* Set if you have an SQLite3 Database */
#define HAVE_SQLITE3 1

/* Define to 1 if you have the `sqlite3_threadsafe' function. */
#define HAVE_SQLITE3_THREADSAFE 1

/* Set if you have an PostgreSQL Database */
#define HAVE_POSTGRESQL 1

Expand Down

0 comments on commit 95f5cf4

Please sign in to comment.