source: trunk/config/dist/mysql-queries.xml @ 4508

Last change on this file since 4508 was 4508, checked in by Jari Häkkinen, 13 years ago

Addresses #1106. Missed to change reference wherefrom retrive GPLv3 license text. And some other changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.0 KB
Line 
1<?xml version="1.0" ?>
2<!DOCTYPE predefined-queries SYSTEM "predefined-queries.dtd" >
3<!--
4  $Id: mysql-queries.xml 4508 2008-09-11 20:00:35Z jari $
5
6  Copyright (C) 2006 Nicklas Nordborg
7
8  This file is part of BASE - BioArray Software Environment.
9  Available at http://base.thep.lu.se/
10
11  BASE is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License
13  as published by the Free Software Foundation; either version 3
14  of the License, or (at your option) any later version.
15
16  BASE is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with BASE. If not, see <http://www.gnu.org/licenses/>.
23-->
24<!--
25  This file contains HQL and SQL queries that have been modified
26  specifically for the MySQL database and overrides the queries
27  found in the common-queries.xml file.
28-->
29<predefined-queries>
30  <query id="COUNT_UNREAD_MESSAGES_FOR_USER" type="HQL">
31    <sql>
32      SELECT count(*)
33      FROM MessageData msg
34      WHERE msg.to = :user AND msg.read = 0 AND msg.removed = 0
35    </sql>
36    <description>
37      A Hibernate query that counts the number of
38      unread messages for a given user. The default query use 'false'
39      instead of '0' which doesn't work for MySQL.
40    </description>
41  </query>
42 
43  <query id="LOAD_CONTEXT_NAMES" type="HQL">
44    <sql>
45      SELECT ctx.id, ctx.name
46      FROM ContextData ctx
47      WHERE ctx.client = :client AND
48      (ctx.user = :user OR ctx.public = 1)
49      AND ctx.itemType = :itemType
50      AND ctx.subContext = :subContext
51      ORDER BY ctx.name
52    </sql>
53    <description>
54      A Hibernate query that selects the id and name of all contexts for
55      a user and item type. The names should be sorted in ascending order.
56      The default query use 'true' instead of '1' which doesn't work for MySQL.
57    </description>
58  </query>
59 
60  <query id="GET_REMOVED_ITEMS" type="HQL">
61    <sql>
62      SELECT trash
63      FROM net.sf.basedb.core.data.RemovableData trash
64      WHERE trash.removed = 1
65    </sql>
66    <description>
67      A Hibernate query that loads all items flagged for deletion.
68      The default query use 'true' instead of '1' which doesn't work for MySQL.
69    </description>
70  </query> 
71
72  <query id="DELETE_UNUSED_ANYTOANY_TO" type="HQL">
73    <sql>
74      DELETE FROM AnyToAnyData ata
75      WHERE ata.toId = :toId AND ata.toType = :toType AND ata.usingTo = 0
76    </sql>
77    <description>
78      A Hibernate query that deletes all any-to-any links leading in to
79      an item that doesn't count as using the item.
80      The default query use 'false' instead of '0' which doesn't work for MySQL.
81    </description>
82  </query>
83 
84  <query id="COUNT_USED_ANYTOANY_TO" type="HQL">
85    <sql>
86      SELECT count(*)
87      FROM AnyToAnyData ana
88      WHERE ana.toId = :toId AND ana.toType = :toType AND ana.usingTo = 1
89    </sql>
90    <description>
91      A Hibernate query that counts the number of any-to-any links
92      to a given item that counts as using the item.
93      The default query use 'true' instead of '1' which doesn't work for MySQL.
94    </description>
95  </query>
96 
97  <query id="COPY_PLUGINCONFIGURATION_PARAMETERS" type="SQL">
98    <sql>
99      INSERT INTO `VersionedPluginConfigurationValues`
100      (`pluginconfiguration_id`, `name`, `parameter_version`, `value_id`)
101      SELECT `pluginconfiguration_id`, `name`, 1, `value_id`
102      FROM `PluginConfigurationValues`
103    </sql>
104    <description>
105      A SQL query that creates versioned parameters from unversioned.
106    </description>
107  </query>
108 
109  <query id="DELETE_UNVERSIONED_PLUGINCONFIGURATION_PARAMETERS" type="SQL">
110    <sql>
111      DELETE FROM `PluginConfigurationValues`
112    </sql>
113    <description>
114      A SQL query that deletes unversioned plugin configuration parameters.
115    </description>
116  </query>
117
118  <query id="CHANGE_FILE_DISCRIMINATOR" type="SQL">
119    <sql>
120      UPDATE `ParameterValues`
121      SET `discriminator` = 10
122      WHERE `discriminator` = 9
123    </sql>
124    <description>
125      An SQL query that changes the discriminator for file
126      parameters
127    </description>
128  </query>
129
130  <query id="COPY_FILE_PARAMETERS" type="SQL">
131    <sql>
132      INSERT INTO `ItemValues` (`id`, `data_class`, `data_class_id`)
133      SELECT `id`, 'net.sf.basedb.core.data.FileData', `value`
134      FROM `FileValues`
135    </sql>
136    <description>
137      An SQL query that copies file parameter values into
138      the item parameter values table.
139    </description>
140  </query>
141
142  <query id="DELETE_FILE_PARAMETERS" type="SQL">
143    <sql>
144      DELETE FROM `FileValues`
145    </sql>
146    <description>
147      An SQL query that deletes old file parameter values (after they have been copied).
148    </description>
149  </query>
150
151  <query id="UPDATE_PROPERTY_FILTER" type="SQL">
152    <sql>
153      UPDATE IGNORE [PropertyFilters]
154      SET [property] = :newProperty
155      WHERE [property] = :oldProperty
156    </sql>
157    <description>
158      An SQL query that changes the property for all PropertyFilters
159      which filters on a given property. It must ignore any filter that 
160      causes a duplicate key violation if a filter with the new
161      property already exists for any context.
162    </description>
163  </query>
164
165
166</predefined-queries>
Note: See TracBrowser for help on using the repository browser.