Skip to content

Commit

Permalink
remove old test macros
Browse files Browse the repository at this point in the history
OPENDB
ADDQUERYFUNCS
SQL_EXEC
  • Loading branch information
calccrypto committed Feb 11, 2025
1 parent 0184405 commit 853c0cf
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 62 deletions.
20 changes: 0 additions & 20 deletions docs/latex/sections/build.tex
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,6 @@ \subsubsection{Testing}
\end{tabularx}
\end{table}

Do not turn these off unless you know what you are doing:

\begin{table}[H]
\centering
\begin{tabularx}{1.2\textwidth}{| l | X |}
\hline
\texttt{-D<VAR>=<VALUE>} & Description \\
\hline
\texttt{RUN\_ADDQUERYFUNCS=<On|Off>}
& Compile \gufiquery without calls to \texttt{addqueryfuncs}. \\
\hline
\texttt{RUN\_OPENDB=<On|Off>}
& Compile \gufiquery without calls to \texttt{opendb}. \\
\hline
\texttt{RUN\_SQL\_EXEC=<On|Off>}
& Compile \gufiquery without calls to \texttt{sqlite3\_exec}. \\
\hline
\end{tabularx}
\end{table}

\subsubsection{Docs}
\begin{table}[H]
\centering
Expand Down
32 changes: 0 additions & 32 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,38 +66,6 @@ if (LOCALTIME_R)
add_definitions(-DLOCALTIME_R)
endif()

# ##########################################
# flags that can be used to modify code
# behavior at compile time for some binaries.
#
# All of these should be left at their
# default values when running the ctest.
#
# All binaries should be able to run
# even if all of the values are changed.
#

# opendb can be turned off
# addqueryfuncs fails silently if not turned off
# sqlite3_exec fails with error message if not turned off
option(RUN_OPENDB "Whether or not to enable opening databases" ON)
if (RUN_OPENDB)
add_definitions(-DOPENDB=1)
endif()

# addqueryfuncs can be turned off
option(RUN_ADDQUERYFUNCS "Add custom functions to opened databases" ON)
if (RUN_ADDQUERYFUNCS)
add_definitions(-DADDQUERYFUNCS=1)
endif()

# sqlite3_exec can be turned off
option(RUN_SQL_EXEC "Call sqlite3_exec" ON)
if (RUN_SQL_EXEC)
add_definitions(-DSQL_EXEC=1)
endif()
# ##########################################

# create the GUFI library, which contains all of the common source files
set(GUFI_SOURCES
BottomUp.c
Expand Down
2 changes: 0 additions & 2 deletions src/gufi_query/PoolArgs.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,9 @@ int PoolArgs_init(PoolArgs_t *pa, struct input *in, pthread_mutex_t *global_mute
break;
}

#ifdef ADDQUERYFUNCS
if (addqueryfuncs(ta->outdb) != 0) {
fprintf(stderr, "Warning: Could not add functions to sqlite\n");
}
#endif

/* create empty xattr tables to UNION to */
char *err = NULL;
Expand Down
6 changes: 0 additions & 6 deletions src/gufi_query/processdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,14 @@ int processdir(QPTPool_t *ctx, const size_t id, void *data, void *args) {
}

if (gqw->work.level >= in->min_level) {
#if OPENDB
db = attachdb(dbname, ta->outdb, ATTACH_NAME, in->open_flags, 1);
#endif

/* this is needed to add some query functions like path() uidtouser() gidtogroup() */
#ifdef ADDQUERYFUNCS
if (db) {
if (addqueryfuncs_with_context(db, &gqw->work) != 0) {
fprintf(stderr, "Could not add functions to sqlite\n");
}
}
#endif
}

/* get number of subdirs walked on first call to process_queries */
Expand Down Expand Up @@ -346,11 +342,9 @@ int processdir(QPTPool_t *ctx, const size_t id, void *data, void *args) {
process_queries(pa, ctx, id, dir, gqw, db, dbname, dbname_len, 1, &subdirs_walked_count);
}

#ifdef OPENDB
if (db) {
detachdb_cached(dbname, db, pa->detach, 1);
}
#endif

/* restore mtime and atime */
if (db) {
Expand Down
2 changes: 0 additions & 2 deletions src/gufi_query/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ void querydb(struct work *work,
};

char *err = NULL;
#ifdef SQL_EXEC
if (sqlite3_exec(db, query, callback, &args, &err) != SQLITE_OK) {
char buf[MAXPATH];
present_user_path(dbname, dbname_len,
&work->root_parent, work->root_basename_len, &work->orig_root,
buf, sizeof(buf));
sqlite_print_err_and_free(err, stderr, "Error: %s: %s: \"%s\"\n", err, buf, query);
}
#endif

*rc = args.rows;
}

0 comments on commit 853c0cf

Please sign in to comment.