source: branches/3.10-stable/config/dist/mysql-queries.xml @ 7282

Last change on this file since 7282 was 7282, checked in by Nicklas Nordborg, 5 years ago

References #2049: Project-specific annotations

We need a different query in MySQL to make sure project-specific annotations are correctly referenced. There are several other similar queries in use. This was the only one that happened to fail in the TestAnnotation test. I think we need to manually try to test that the other queries are working as well. If they don't it would be good to design test cases that trigger them to be executed.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Date Id
File size: 3.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE predefined-queries SYSTEM "predefined-queries.dtd" >
3<!--
4  $Id: mysql-queries.xml 7282 2017-01-25 13:56:04Z nicklas $
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="DROP_NOT_NULL_CONSTRAINT" type="SQL">
31    <sql>
32      ALTER TABLE [{1}] MODIFY [{2}] {3} NULL
33    </sql>
34    <description>
35      An SQL query that drops a NOT NULL contraint from column (2) with data type (3)
36      in a table (1).
37    </description>
38  </query>
39
40  <query id="AB_INSERT_INTO_PARAMETERVALUES" type="SQL">
41    <sql>
42      INSERT INTO [ParameterValues] ([discriminator], [version])
43      VALUES (?, 0)
44    </sql>
45    <description>
46      SQL query for inserting rows into the ParameterValues table.
47      The primary key (id) must be auto-generated.
48      Parameters: discriminator
49    </description>
50  </query>
51
52  <query id="AB_INSERT_INTO_ANNOTATIONS" type="SQL">
53    <sql>
54      INSERT INTO [Annotations] ([version], [annotationset_id], [annotationtype_id], [unit_id], [value_id], [last_update], [source], [project_id], [override_id])
55      VALUES (0, ?, ?, ?, ?, ?, 0, ?, ?)
56    </sql>
57    <description>
58      SQL query for inserting rows into the Annotations table.
59      The primary key (id) must be auto-generated.
60      Parameters: annotationset_id, annotationtype_id, unit_id, value_id, last_updated, project_id, override_id
61    </description>
62  </query>
63 
64  <query id="AB_INSERT_INTO_ANNOTATIONSETS" type="SQL">
65    <sql>
66      INSERT INTO [AnnotationSets] ([version], [item_type], [item_id])
67      VALUES (0, {1}, ?)
68    </sql>
69    <description>
70      SQL query for inserting rows into the AnnotationSets table.
71      The primary key (id) must be auto-generated.
72      Parameters: item_id
73    </description>
74  </query>
75 
76  <query id="DBLOG_INSERT_INTO_CHANGEHISTORYDETAILS" type="SQL">
77    <sql>
78      INSERT INTO [ChangeHistoryDetails]
79        ([version], [history_id], [change_type], [item_id], [item_type], [change_info], [old_value], [new_value])
80      VALUES (0, ?, ?, ?, ?, ?, ?, ?)
81    </sql>
82    <description>
83      SQL query for inserting rows into the ChangeHistoryDetails table.
84      The primary key (id) must be auto-generated.
85      Parameters: history_id, change_type, item_id, item_type, change_info, old_value, new_value
86    </description>
87  </query>
88
89  <query id="PS_FIND_OVERRIDE_ID_FOR_PROJECT_ANNOTATION" type="SQL">
90    <sql>
91      UPDATE [Annotations]
92      SET [override_id] = COALESCE(
93        (SELECT [tmp].[id] FROM
94          (SELECT [id] FROM [Annotations]
95          WHERE [annotationset_id] = :annotationSetId
96          AND [annotationtype_id] = :annotationTypeId
97          AND [source] = 0 AND [project_id] = 0) [tmp]
98        )
99        , 0)
100      WHERE id = :annotationId
101    </sql>
102    <description>
103      Updates the "override_id" column on a newly created project-specific
104      (PRIMARY) annotation to point to the existing default annotation id
105      or 0 if no default annotation exists. To make this query work in MySQL
106      we need a double inner subselect to force a temporary table for the
107      single value we are after.
108    </description>
109  </query>
110
111</predefined-queries>
Note: See TracBrowser for help on using the repository browser.