[mythtv] Strange QUERY_RECORDINGS results
Nigel Pearson
nigel at ind.tansu.com.au
Thu Oct 23 03:37:39 UTC 2008
The backend does a query roughly like this
for ' 26 QUERY_RECORDINGS Recording':
mysql> SELECT
recorded.chanid,recorded.starttime,recorded.endtime,recorded.title
FROM recorded WHERE recorded.endtime >= NOW() AND recorded.starttime
<= NOW();
Empty set (0.01 sec)
When I separate the conditionals:
mysql> select
recorded.chanid,recorded.starttime,recorded.endtime,recorded.title
from recorded where recorded.endtime >= NOW();
+--------+---------------------+---------------------
+------------------------+
| chanid | starttime | endtime |
title |
+--------+---------------------+---------------------
+------------------------+
| 1066 | 2008-10-23 13:32:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:00:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:34:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:38:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:40:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:48:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-10-23 13:50:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
+--------+---------------------+---------------------
+------------------------+
7 rows in set (0.00 sec)
mysql> select
recorded.chanid,recorded.starttime,recorded.endtime,recorded.title
from recorded where recorded.starttime <= NOW();
+--------+---------------------+---------------------
+--------------------------------+
| chanid | starttime | endtime |
title |
+--------+---------------------+---------------------
+--------------------------------+
| 1001 | 2006-01-01 10:00:00 | 2006-01-01 10:30:00 | Hairy
Maclary |
| 1001 | 2006-01-01 11:00:00 | 2006-01-01 11:30:00 | Planet
Earth |
| 1001 | 2006-01-01 06:00:00 | 2006-01-01 06:30:00 | Star Trek:
Enterprise |
| 1001 | 2006-01-01 07:00:00 | 2006-01-01 07:30:00 | HD
test |
| 1001 | 2006-01-01 08:00:00 | 2006-01-01 08:30:00 | HD
test |
| 1001 | 2006-01-01 09:00:00 | 2006-01-01 09:30:00 | HD
test |
| 1066 | 2008-10-22 12:00:00 | 2008-10-22 13:00:00 | Dr.
Phil |
| 1066 | 2008-10-21 12:00:00 | 2008-10-21 13:00:00 | Dr.
Phil |
| 1066 | 2008-10-22 17:00:00 | 2008-10-22 17:05:00 | Ten News at
Five |
| 1066 | 2008-10-22 13:00:00 | 2008-10-22 14:00:00 | The Oprah
Winfrey Show |
| 1066 | 2008-09-01 16:23:47 | 2008-09-01 16:30:00 |
Scope |
| 1066 | 2008-10-22 16:58:00 | 2008-10-22 17:00:00 | The Bold and
the Beautiful |
| 1002 | 2008-06-09 21:27:00 | 1970-01-01 11:00:00 | CSI:
NY |
| 1003 | 2008-06-09 21:30:00 | 1970-01-01 11:00:00 | Boston
Legal |
| 1004 | 2008-02-06 18:27:00 | 2008-02-06 19:24:00 | Nigella
Feasts |
| 1066 | 2008-09-10 13:00:00 | 2008-09-10 13:30:00 | The Oprah
Winfrey Show |
| 1039 | 2008-09-19 17:30:00 | 2008-09-19 17:55:00 | Rough
Science |
| 1039 | 2008-09-22 19:30:00 | 2008-09-22 20:30:00 | Top
Gear |
| 1039 | 2008-09-29 19:30:00 | 2008-09-29 20:30:00 | Top
Gear |
| 1063 | 2008-10-20 21:30:00 | 2008-10-20 22:30:00 | Cold
Case |
| 1039 | 2008-10-20 19:30:00 | 2008-10-20 20:30:00 | Top Gear
Australia |
| 1066 | 2008-10-20 12:44:00 | 2008-10-20 13:00:00 | Dr.
Phil |
| 1066 | 2008-10-20 12:00:00 | 2008-10-20 13:00:00 | Dr.
Phil |
+--------+---------------------+---------------------
+--------------------------------+
23 rows in set (0.00 sec)
So, I tried parenthesising the two conditionals:
mysql> select
recorded.chanid,recorded.starttime,recorded.endtime,recorded.title
from recorded where (recorded.endtime >= NOW() AND recorded.starttime
<= NOW());
+--------+---------------------+---------------------
+------------------------+
| chanid | starttime | endtime |
title |
+--------+---------------------+---------------------
+------------------------+
| 1066 | 2008-10-23 13:00:00 | 2008-10-23 14:00:00 | The Oprah
Winfrey Show |
+--------+---------------------+---------------------
+------------------------+
1 row in set (0.00 sec)
which gives me the one recording I expect. So, there needs to be extra
parentheses about line 1200 of programs/mythbackend/mainserver.cpp,
right?
--
Nigel Pearson, nigel at ind.tansu.com.au|Excuse me, have you seen a |
Telstra Net. Eng., Sydney, Australia | blowfish driving a sports car?|
Office: 9202 3900 Fax: 9261 3912 | (points ... mutters) |
Mobile: 0408 664435 Home: 9792 6998 | Bloody Torchwood! |
More information about the mythtv-dev
mailing list