1746 |
15 Jun 07 |
gregory |
1 |
<?xml version="1.0" ?> |
1746 |
15 Jun 07 |
gregory |
2 |
<!DOCTYPE predefined-queries SYSTEM "predefined-queries.dtd" > |
1746 |
15 Jun 07 |
gregory |
3 |
<!-- |
1746 |
15 Jun 07 |
gregory |
$Id: mysql-queries.xml 441 2006-08-10 10:19:22Z jari $ |
1746 |
15 Jun 07 |
gregory |
5 |
|
1916 |
31 Aug 07 |
jari |
Copyright (C) 2007 Gregory Vincic |
1746 |
15 Jun 07 |
gregory |
7 |
|
1746 |
15 Jun 07 |
gregory |
This file is part of Proteios. |
1746 |
15 Jun 07 |
gregory |
Available at http://www.proteios.org/ |
1746 |
15 Jun 07 |
gregory |
10 |
|
1746 |
15 Jun 07 |
gregory |
Proteios is free software; you can redistribute it and/or |
1746 |
15 Jun 07 |
gregory |
modify it under the terms of the GNU General Public License |
1746 |
15 Jun 07 |
gregory |
as published by the Free Software Foundation; either version 2 |
1746 |
15 Jun 07 |
gregory |
of the License, or (at your option) any later version. |
1746 |
15 Jun 07 |
gregory |
15 |
|
1746 |
15 Jun 07 |
gregory |
Proteios is distributed in the hope that it will be useful, |
1746 |
15 Jun 07 |
gregory |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1746 |
15 Jun 07 |
gregory |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1746 |
15 Jun 07 |
gregory |
GNU General Public License for more details. |
1746 |
15 Jun 07 |
gregory |
20 |
|
1746 |
15 Jun 07 |
gregory |
You should have received a copy of the GNU General Public License |
1746 |
15 Jun 07 |
gregory |
along with this program; if not, write to the Free Software |
1746 |
15 Jun 07 |
gregory |
Foundation, Inc., 59 Temple Place - Suite 330, |
1746 |
15 Jun 07 |
gregory |
Boston, MA 02111-1307, USA. |
1746 |
15 Jun 07 |
gregory |
25 |
--> |
1746 |
15 Jun 07 |
gregory |
26 |
<!-- |
1746 |
15 Jun 07 |
gregory |
This file contains HQL and SQL queries that have been modified |
1746 |
15 Jun 07 |
gregory |
specifically for the MySQL database and overrides the queries |
1746 |
15 Jun 07 |
gregory |
found in the common-queries.xml file. |
1746 |
15 Jun 07 |
gregory |
30 |
--> |
1746 |
15 Jun 07 |
gregory |
31 |
<predefined-queries> |
1746 |
15 Jun 07 |
gregory |
32 |
<query id="COUNT_UNREAD_MESSAGES_FOR_USER" type="HQL"> |
1746 |
15 Jun 07 |
gregory |
33 |
<sql> |
1746 |
15 Jun 07 |
gregory |
34 |
SELECT count(*) |
1746 |
15 Jun 07 |
gregory |
35 |
FROM MessageData msg |
1746 |
15 Jun 07 |
gregory |
36 |
WHERE msg.to = :user AND msg.read = 0 AND msg.removed = 0 |
1746 |
15 Jun 07 |
gregory |
37 |
</sql> |
1746 |
15 Jun 07 |
gregory |
38 |
<description> |
1746 |
15 Jun 07 |
gregory |
39 |
A Hibernate query that counts the number of |
1746 |
15 Jun 07 |
gregory |
40 |
unread messages for a given user. The default query use 'false' |
1746 |
15 Jun 07 |
gregory |
41 |
instead of '0' which doesn't work for MySQL. |
1746 |
15 Jun 07 |
gregory |
42 |
</description> |
1746 |
15 Jun 07 |
gregory |
43 |
</query> |
1746 |
15 Jun 07 |
gregory |
44 |
|
1746 |
15 Jun 07 |
gregory |
45 |
<query id="LOAD_CONTEXT_NAMES" type="HQL"> |
1746 |
15 Jun 07 |
gregory |
46 |
<sql> |
1746 |
15 Jun 07 |
gregory |
47 |
SELECT ctx.id, ctx.name |
1746 |
15 Jun 07 |
gregory |
48 |
FROM ContextData ctx |
1746 |
15 Jun 07 |
gregory |
49 |
WHERE ctx.client = :client AND |
1746 |
15 Jun 07 |
gregory |
50 |
(ctx.user = :user OR ctx.public = 1) |
1746 |
15 Jun 07 |
gregory |
51 |
AND ctx.itemType = :itemType |
1746 |
15 Jun 07 |
gregory |
52 |
AND ctx.subContext = :subContext |
1746 |
15 Jun 07 |
gregory |
53 |
ORDER BY ctx.name |
1746 |
15 Jun 07 |
gregory |
54 |
</sql> |
1746 |
15 Jun 07 |
gregory |
55 |
<description> |
1746 |
15 Jun 07 |
gregory |
56 |
A Hibernate query that selects the id and name of all contexts for |
1746 |
15 Jun 07 |
gregory |
57 |
a user and item type. The names should be sorted in ascending order. |
1746 |
15 Jun 07 |
gregory |
58 |
The default query use 'true' instead of '1' which doesn't work for MySQL. |
1746 |
15 Jun 07 |
gregory |
59 |
</description> |
1746 |
15 Jun 07 |
gregory |
60 |
</query> |
1746 |
15 Jun 07 |
gregory |
61 |
|
1746 |
15 Jun 07 |
gregory |
62 |
</predefined-queries> |