* [PATCH 1/2] Optimize call history queries
@ 2010-10-27 8:53 Rafał Michalski
2010-10-27 13:49 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Michalski @ 2010-10-27 8:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Rafał Michalski
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-Optimize-call-history-queries.patch --]
[-- Type: text/x-patch, Size: 5575 bytes --]
From 59bad107ec51e6824b0c4450f4c67ab1e4505cff Mon Sep 17 00:00:00 2001
From: Rafal Michalski <michalski.raf@gmail.com>
Date: Wed, 27 Oct 2010 09:19:21 +0200
Subject: [PATCH 1/2] Optimize call history queries
This patch optimizes call history queries - now there is no redundant
results of invoking them.
---
plugins/phonebook-tracker.c | 74 ++++++++++++++++++++----------------------
1 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 3367e49..e037677 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -128,6 +128,13 @@
"WHERE { " \
"{ " \
"?x a nco:Contact . " \
+ "?x nco:hasPhoneNumber ?t . " \
+ "?call a nmo:Call ; " \
+ "nmo:from ?x ; " \
+ "nmo:isSent false ; " \
+ "nmo:isAnswered false . " \
+ "} UNION { " \
+ "?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?h . " \
"?call a nmo:Call ; " \
"nmo:from ?x ; " \
@@ -158,15 +165,8 @@
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
- "} UNION { " \
- "?x a nco:Contact . " \
- "?x nco:hasPhoneNumber ?t . " \
- "?call a nmo:Call ; " \
- "nmo:from ?x ; " \
- "nmo:isSent false ; " \
- "nmo:isAnswered false . " \
"} " \
- "} ORDER BY DESC(nmo:receivedDate(?call)) "
+ "} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) "
#define MISSED_CALLS_LIST \
"SELECT ?c nco:nameFamily(?c) " \
@@ -221,6 +221,13 @@
"WHERE { " \
"{ " \
"?x a nco:Contact . " \
+ "?x nco:hasPhoneNumber ?t . " \
+ "?call a nmo:Call ; " \
+ "nmo:from ?x ; " \
+ "nmo:isSent false ; " \
+ "nmo:isAnswered true . " \
+ "} UNION { " \
+ "?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?h . " \
"?call a nmo:Call ; " \
"nmo:from ?x ; " \
@@ -251,15 +258,8 @@
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
- "} UNION { " \
- "?x a nco:Contact . " \
- "?x nco:hasPhoneNumber ?t . " \
- "?call a nmo:Call ; " \
- "nmo:from ?x ; " \
- "nmo:isSent false ; " \
- "nmo:isAnswered true . " \
"} " \
- "} ORDER BY DESC(nmo:receivedDate(?call)) "
+ "} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) "
#define INCOMING_CALLS_LIST \
"SELECT ?c nco:nameFamily(?c) " \
@@ -314,6 +314,12 @@
"WHERE { " \
"{ " \
"?x a nco:Contact . " \
+ "?x nco:hasPhoneNumber ?t . " \
+ "?call a nmo:Call ; " \
+ "nmo:to ?x ; " \
+ "nmo:isSent true . " \
+ "} UNION { " \
+ "?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?h . " \
"?call a nmo:Call ; " \
"nmo:to ?x ; " \
@@ -342,14 +348,8 @@
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
- "} UNION { " \
- "?x a nco:Contact . " \
- "?x nco:hasPhoneNumber ?t . " \
- "?call a nmo:Call ; " \
- "nmo:to ?x ; " \
- "nmo:isSent true . " \
"} " \
- "} ORDER BY DESC(nmo:sentDate(?call)) "
+ "} GROUP BY ?call ORDER BY DESC(nmo:sentDate(?call)) "
#define OUTGOING_CALLS_LIST \
"SELECT ?c nco:nameFamily(?c) " \
@@ -400,7 +400,12 @@
"nmo:isSent(?call) nmo:isAnswered(?call) ?x " \
"WHERE { " \
"{ " \
- "{ " \
+ "?x a nco:Contact . " \
+ "?x nco:hasPhoneNumber ?t . " \
+ "?call a nmo:Call ; " \
+ "nmo:to ?x ; " \
+ "nmo:isSent true . " \
+ "} UNION { " \
"?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?h . " \
"?call a nmo:Call ; " \
@@ -416,7 +421,7 @@
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
- "} UNION { " \
+ "} UNION { " \
"?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?w . " \
"?call a nmo:Call ; " \
@@ -430,15 +435,13 @@
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
- "} UNION { " \
+ "} UNION { " \
"?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?t . " \
"?call a nmo:Call ; " \
- "nmo:to ?x ; " \
- "nmo:isSent true . " \
- "} " \
+ "nmo:from ?x ; " \
+ "nmo:isSent false . " \
"} UNION { " \
- "{ " \
"?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?h . " \
"?call a nmo:Call ; " \
@@ -454,7 +457,7 @@
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
"} " \
- "} UNION { " \
+ "} UNION { " \
"?x a nco:Contact . " \
"?x nco:hasPhoneNumber ?w . " \
"?call a nmo:Call ; " \
@@ -468,15 +471,8 @@
"OPTIONAL { ?a nco:hasEmailAddress ?ew . } " \
"OPTIONAL { ?a nco:hasPostalAddress ?pw . } " \
"OPTIONAL { ?a nco:org ?o . } " \
- "} UNION { " \
- "?x a nco:Contact . " \
- "?x nco:hasPhoneNumber ?t . " \
- "?call a nmo:Call ; " \
- "nmo:from ?x ; " \
- "nmo:isSent false . " \
- "} " \
"} " \
- "} ORDER BY DESC(nmo:receivedDate(?call)) "
+ "} GROUP BY ?call ORDER BY DESC(nmo:receivedDate(?call)) "
#define COMBINED_CALLS_LIST \
"SELECT ?c nco:nameFamily(?c) nco:nameGiven(?c) " \
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/2] Optimize call history queries
2010-10-27 8:53 [PATCH 1/2] Optimize call history queries Rafał Michalski
@ 2010-10-27 13:49 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-10-27 13:49 UTC (permalink / raw)
To: Rafał Michalski; +Cc: linux-bluetooth
Hi Rafal,
On Wed, Oct 27, 2010, Rafał Michalski wrote:
> This patch optimizes call history queries - now there is no redundant
> results of invoking them.
> ---
> plugins/phonebook-tracker.c | 74 ++++++++++++++++++++----------------------
> 1 files changed, 35 insertions(+), 39 deletions(-)
Pushed upstream. Thanks. Btw, if possible please send the patches in the
message body instead of an attachment (use e.g. git send-email for
this). This would make your patch submissions more consistent with the
rest and ease my work (by not having to always check if I should pipe
the main message or the attachment to git am).
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-27 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 8:53 [PATCH 1/2] Optimize call history queries Rafał Michalski
2010-10-27 13:49 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox