enum {
CHECK_IS_SUMMARY = (1 << 0),
CHECK_IS_LIST_ATTR = (1 << 1),
+ CHECK_UNSUPPORTED = (1 << 2),
};
static ESExpResult *
* thus cannot be done with an SQL statement
*/
if (one_non_summary_query)
- result = 0;
+ result &= ~CHECK_IS_SUMMARY;
r = e_sexp_result_new (f, ESEXP_RES_INT);
r->value.number = result;
{
ESExpResult *const r = func_check (f, argc, argv, data);
+ if (!e_phone_number_is_supported ()) {
+ r->value.number |= CHECK_UNSUPPORTED;
+ return r;
+ }
+
if (r && r->value.number) {
GError *error = NULL;
const gchar *const query_value = argv[1]->value.string;
static gboolean
e_book_backend_sqlitedb_check_summary_query_locked (EBookBackendSqliteDB *ebsdb,
const gchar *query,
- gboolean *with_list_attrs)
+ gboolean *with_list_attrs,
+ gboolean *unsupported_query)
{
ESExp *sexp;
ESExpResult *r;
if ((r->value.number & CHECK_IS_LIST_ATTR) != 0 && with_list_attrs)
*with_list_attrs = TRUE;
+
+ if (unsupported_query)
+ *unsupported_query = (r->value.number & CHECK_UNSUPPORTED) != 0;
}
e_sexp_result_free (sexp, r);
g_return_val_if_fail (E_IS_BOOK_BACKEND_SQLITEDB (ebsdb), FALSE);
LOCK_MUTEX (&ebsdb->priv->lock);
- is_summary = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, query, with_list_attrs);
+ is_summary = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, query, with_list_attrs, NULL);
UNLOCK_MUTEX (&ebsdb->priv->lock);
return is_summary;
gboolean
e_book_backend_sqlitedb_is_summary_query (const gchar *query)
{
- return e_book_backend_sqlitedb_check_summary_query_locked (NULL, query, NULL);
+ return e_book_backend_sqlitedb_check_summary_query_locked (NULL, query, NULL, NULL);
}
static ESExpResult *
gboolean local_searched = FALSE;
gboolean local_with_all_required_fields = FALSE;
gboolean query_with_list_attrs = FALSE;
+ gboolean query_unsupported = FALSE;
+ gboolean summary_query = FALSE;
g_return_val_if_fail (E_IS_BOOK_BACKEND_SQLITEDB (ebsdb), NULL);
g_return_val_if_fail (folderid != NULL, NULL);
LOCK_MUTEX (&ebsdb->priv->lock);
- if (!sexp || e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp,
- &query_with_list_attrs)) {
+ if (sexp)
+ summary_query = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp,
+ &query_with_list_attrs,
+ &query_unsupported);
+
+ if (query_unsupported)
+ g_set_error (
+ error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_NOT_SUPPORTED,
+ _("Query contained unsupported elements"));
+ else if (!sexp || summary_query) {
gchar *sql_query;
sql_query = sexp ? sexp_to_sql_query (ebsdb, folderid, sexp) : NULL;
GSList *uids = NULL;
gboolean local_searched = FALSE;
gboolean query_with_list_attrs = FALSE;
+ gboolean query_unsupported = FALSE;
+ gboolean summary_query = FALSE;
g_return_val_if_fail (E_IS_BOOK_BACKEND_SQLITEDB (ebsdb), NULL);
g_return_val_if_fail (folderid != NULL, NULL);
LOCK_MUTEX (&ebsdb->priv->lock);
- if (!sexp || e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp, &query_with_list_attrs)) {
+ if (sexp)
+ summary_query = e_book_backend_sqlitedb_check_summary_query_locked (ebsdb, sexp,
+ &query_with_list_attrs,
+ &query_unsupported);
+
+ if (query_unsupported)
+ g_set_error (
+ error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_NOT_SUPPORTED,
+ _("Query contained unsupported elements"));
+ else if (!sexp || summary_query) {
gchar *stmt;
gchar *sql_query = sexp ? sexp_to_sql_query (ebsdb, folderid, sexp) : NULL;