summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-06-04 17:08:27 +0200
committerCarlos Garnacho <carlosg@gnome.org>2017-06-29 19:52:49 +0200
commita94b3ed228aa9d4d53e0149b6a3cba67480c15dc (patch)
tree51a2dde895b6e38d99c2e44adf3ffd8ab7d3f188
parent41f2c1b0297732782295b074c0add01871fd2154 (diff)
downloadtracker-a94b3ed228aa9d4d53e0149b6a3cba67480c15dc.tar.gz
libtracker-data: Remove TRACKER_PRAGMAS_FILE envvar
Now that we are exposing databases to apps, it doesn't make sense to offer an environment variable that can entirely mangle how tracker behaves for these (Nor IMHO made sense back in the days, either). Let's just remove this envvar and pretend it never existed.
-rw-r--r--docs/manpages/tracker-info.17
-rw-r--r--docs/manpages/tracker-search.17
-rw-r--r--docs/manpages/tracker-sparql.17
-rw-r--r--docs/manpages/tracker-store.17
-rw-r--r--docs/manpages/tracker-tag.17
-rw-r--r--docs/reference/libtracker-sparql/overview.sgml10
-rw-r--r--src/libtracker-data/tracker-db-manager.c100
7 files changed, 42 insertions, 103 deletions
diff --git a/docs/manpages/tracker-info.1 b/docs/manpages/tracker-info.1
index f50759398..fbbc68fac 100644
--- a/docs/manpages/tracker-info.1
+++ b/docs/manpages/tracker-info.1
@@ -72,13 +72,6 @@ approach you can use if you want to \fIwrite\fR to the database.
With "\fBauto\fR" the backend is decided for you, much like it would
be if this environment variable was undefined.
-.TP
-.B TRACKER_PRAGMAS_FILE
-Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
-With this environment variable pointing to a text file you can override these
-settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in \fBtracker-store\fR.
-
.SH SEE ALSO
.BR tracker-store (1),
.BR tracker-sparql (1).
diff --git a/docs/manpages/tracker-search.1 b/docs/manpages/tracker-search.1
index 109602ed0..06762f5af 100644
--- a/docs/manpages/tracker-search.1
+++ b/docs/manpages/tracker-search.1
@@ -129,13 +129,6 @@ approach you can use if you want to \fIwrite\fR to the database.
With "\fBauto\fR" the backend is decided for you, much like it would
be if this environment variable was undefined.
-.TP
-.B TRACKER_PRAGMAS_FILE
-Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
-With this environment variable pointing to a text file you can override these
-settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in tracker-store.
-
.SH SEE ALSO
.BR tracker-store (1),
.BR tracker-stats (1),
diff --git a/docs/manpages/tracker-sparql.1 b/docs/manpages/tracker-sparql.1
index cf60f9fee..78ea98971 100644
--- a/docs/manpages/tracker-sparql.1
+++ b/docs/manpages/tracker-sparql.1
@@ -236,13 +236,6 @@ approach you can use if you want to \fIwrite\fR to the database.
With "\fBauto\fR" the backend is decided for you, much like it would
be if this environment variable was undefined.
-.TP
-.B TRACKER_PRAGMAS_FILE
-Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
-With this environment variable pointing to a text file you can override these
-settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in \fBtracker-store\fR.
-
.SH EXAMPLES
.TP
List all classes
diff --git a/docs/manpages/tracker-store.1 b/docs/manpages/tracker-store.1
index 77ecb177f..28452f0da 100644
--- a/docs/manpages/tracker-store.1
+++ b/docs/manpages/tracker-store.1
@@ -75,13 +75,6 @@ number represents the number of cached statements to keep around.
This environment variable is used mainly for testing purposes.
.TP
-.B TRACKER_PRAGMAS_FILE
-Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
-With this environment variable pointing to a text file you can override these
-settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in tracker-store.
-
-.TP
.B TRACKER_USE_LOG_FILES
Don't just log to stdout and stderr, but to log files too which are
kept in $HOME/.local/share/tracker/. This came into effect in 0.15.3
diff --git a/docs/manpages/tracker-tag.1 b/docs/manpages/tracker-tag.1
index b450f8f24..c4e3285e5 100644
--- a/docs/manpages/tracker-tag.1
+++ b/docs/manpages/tracker-tag.1
@@ -97,13 +97,6 @@ approach you can use if you want to \fIwrite\fR to the database.
With "\fBauto\fR" the backend is decided for you, much like it would
be if this environment variable was undefined.
-.TP
-.B TRACKER_PRAGMAS_FILE
-Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
-With this environment variable pointing to a text file you can override these
-settings. The file is a \\n separated list of SQLite queries to execute on any
-newly created SQLite connection in \fBtracker-store\fR.
-
.SH SEE ALSO
.BR tracker-store (1),
.BR tracker-sparql (1),
diff --git a/docs/reference/libtracker-sparql/overview.sgml b/docs/reference/libtracker-sparql/overview.sgml
index 400dca904..14890457d 100644
--- a/docs/reference/libtracker-sparql/overview.sgml
+++ b/docs/reference/libtracker-sparql/overview.sgml
@@ -174,16 +174,6 @@ $ pkg-config --libs tracker-sparql-0.12
is <emphasis>0</emphasis>.
</para>
</listitem>
- <listitem>
- <emphasis>TRACKER_PRAGMAS_FILE</emphasis>
- <para>
- Tracker has a fixed set of PRAGMA settings for creating its
- SQLite connection. With this environment variable pointing to
- a text file you can override these settings. The file is a
- \n separated list of SQLite queries to execute on any newly
- created SQLite connection in tracker-store.
- </para>
- </listitem>
</itemizedlist>
</para>
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 9e2d79666..d5351db0b 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -214,78 +214,62 @@ db_set_params (TrackerDBInterface *iface,
gboolean readonly,
GError **error)
{
- gchar *queries = NULL;
- const gchar *pragmas_file;
-
- pragmas_file = g_getenv ("TRACKER_PRAGMAS_FILE");
-
- if (pragmas_file && g_file_get_contents (pragmas_file, &queries, NULL, NULL)) {
- gchar *query = strtok (queries, "\n");
- g_debug ("PRAGMA's from file: %s", pragmas_file);
- while (query) {
- g_debug (" INIT query: %s", query);
- tracker_db_interface_execute_query (iface, NULL, "%s", query);
- query = strtok (NULL, "\n");
- }
- g_free (queries);
- } else {
- GError *internal_error = NULL;
- TrackerDBStatement *stmt;
+ GError *internal_error = NULL;
+ TrackerDBStatement *stmt;
#ifdef DISABLE_JOURNAL
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA synchronous = NORMAL;");
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA synchronous = NORMAL;");
#else
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA synchronous = OFF;");
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA synchronous = OFF;");
#endif /* DISABLE_JOURNAL */
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA encoding = \"UTF-8\"");
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA auto_vacuum = 0;");
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA encoding = \"UTF-8\"");
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA auto_vacuum = 0;");
- if (readonly) {
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA temp_store = MEMORY;");
- } else {
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA temp_store = FILE;");
- }
+ if (readonly) {
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA temp_store = MEMORY;");
+ } else {
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA temp_store = FILE;");
+ }
- stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_NONE,
- &internal_error,
- "PRAGMA journal_mode = WAL;");
+ stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_NONE,
+ &internal_error,
+ "PRAGMA journal_mode = WAL;");
- if (internal_error) {
- g_message ("Can't set journal mode to WAL: '%s'",
- internal_error->message);
- g_propagate_error (error, internal_error);
- } else {
- TrackerDBCursor *cursor;
-
- cursor = tracker_db_statement_start_cursor (stmt, NULL);
- if (tracker_db_cursor_iter_next (cursor, NULL, NULL)) {
- if (g_ascii_strcasecmp (tracker_db_cursor_get_string (cursor, 0, NULL), "WAL") != 0) {
- g_set_error (error,
- TRACKER_DB_INTERFACE_ERROR,
- TRACKER_DB_OPEN_ERROR,
- "Can't set journal mode to WAL");
- }
- }
- g_object_unref (cursor);
- }
+ if (internal_error) {
+ g_message ("Can't set journal mode to WAL: '%s'",
+ internal_error->message);
+ g_propagate_error (error, internal_error);
+ } else {
+ TrackerDBCursor *cursor;
- if (stmt) {
- g_object_unref (stmt);
+ cursor = tracker_db_statement_start_cursor (stmt, NULL);
+ if (tracker_db_cursor_iter_next (cursor, NULL, NULL)) {
+ if (g_ascii_strcasecmp (tracker_db_cursor_get_string (cursor, 0, NULL), "WAL") != 0) {
+ g_set_error (error,
+ TRACKER_DB_INTERFACE_ERROR,
+ TRACKER_DB_OPEN_ERROR,
+ "Can't set journal mode to WAL");
+ }
}
+ g_object_unref (cursor);
+ }
- /* disable autocheckpoint */
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA wal_autocheckpoint = 0");
+ if (stmt) {
+ g_object_unref (stmt);
+ }
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA journal_size_limit = 10240000");
+ /* disable autocheckpoint */
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA wal_autocheckpoint = 0");
- if (page_size != TRACKER_DB_PAGE_SIZE_DONT_SET) {
- g_message (" Setting page size to %d", page_size);
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA page_size = %d", page_size);
- }
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA journal_size_limit = 10240000");
- tracker_db_interface_execute_query (iface, NULL, "PRAGMA cache_size = %d", cache_size);
- g_message (" Setting cache size to %d", cache_size);
+ if (page_size != TRACKER_DB_PAGE_SIZE_DONT_SET) {
+ g_message (" Setting page size to %d", page_size);
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA page_size = %d", page_size);
}
+
+ tracker_db_interface_execute_query (iface, NULL, "PRAGMA cache_size = %d", cache_size);
+ g_message (" Setting cache size to %d", cache_size);
}