From 6b440a0adf327fa9c3f5e3dcc84f9356c62a4580 Mon Sep 17 00:00:00 2001
From: David Bremner <david@tethera.net>
Date: Sun, 7 Jun 2015 17:01:56 +0200
Subject: [PATCH] lib: add public accessor for database from query

This is to make it easier for clients of the library to update to the
new error code returning versions of notmuch_query_search_messages
---
 lib/Makefile.local | 2 +-
 lib/notmuch.h      | 6 ++++++
 lib/query.cc       | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index b58b4e8a..412d8650 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -11,7 +11,7 @@ LIBNOTMUCH_VERSION_MAJOR = 4
 # the time of release for any additions to the library interface,
 # (and when it is incremented, the release version of the library should
 #  be reset to 0).
-LIBNOTMUCH_VERSION_MINOR = 2
+LIBNOTMUCH_VERSION_MINOR = 3
 
 # The release version the library interface. This should be incremented at
 # the time of release if there have been no changes to the interface, (but
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 7e8e162d..421c19dd 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -712,6 +712,12 @@ typedef enum {
 const char *
 notmuch_query_get_query_string (notmuch_query_t *query);
 
+/**
+ * Return the notmuch database of this query. See notmuch_query_create.
+ */
+notmuch_database_t *
+notmuch_query_get_database (notmuch_query_t *query);
+
 /**
  * Exclude values for notmuch_query_set_omit_excluded. The strange
  * order is to maintain backward compatibility: the old FALSE/TRUE
diff --git a/lib/query.cc b/lib/query.cc
index 9cedb6a8..5275b5a2 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -654,3 +654,9 @@ notmuch_query_count_threads (notmuch_query_t *query)
 
     return count;
 }
+
+notmuch_database_t *
+notmuch_query_get_database (notmuch_query_t *query)
+{
+    return query->notmuch;
+}
-- 
2.45.2