1/* wc-test-queries.sql -- queries used to verify wc metadata from
2 *                        the C tests.
3 *
4 * ====================================================================
5 *    Licensed to the Apache Software Foundation (ASF) under one
6 *    or more contributor license agreements.  See the NOTICE file
7 *    distributed with this work for additional information
8 *    regarding copyright ownership.  The ASF licenses this file
9 *    to you under the Apache License, Version 2.0 (the
10 *    "License"); you may not use this file except in compliance
11 *    with the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 *    Unless required by applicable law or agreed to in writing,
16 *    software distributed under the License is distributed on an
17 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 *    KIND, either express or implied.  See the License for the
19 *    specific language governing permissions and limitations
20 *    under the License.
21 * ====================================================================
22 */
23
24-- STMT_SELECT_NODES_INFO
25SELECT op_depth, n.presence, n.local_relpath, revision,
26       repos_path, file_external, def_local_relpath, moved_to, moved_here,
27       properties
28FROM nodes n
29LEFT OUTER JOIN externals e
30            ON n.wc_id = e.wc_id
31                AND n.local_relpath = e.local_relpath
32WHERE n.wc_id = ?1
33  AND (n.local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(n.local_relpath, ?2))
34
35-- STMT_SELECT_ACTUAL_INFO
36SELECT local_relpath
37FROM actual_node
38WHERE wc_id = ?1
39  AND conflict_data is NOT NULL
40  AND (local_relpath = ?2 OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
41
42-- STMT_DELETE_NODES
43DELETE FROM nodes;
44
45-- STMT_INSERT_NODE
46INSERT INTO nodes (local_relpath, op_depth, presence, repos_path,
47                   revision, parent_relpath, moved_to, moved_here,
48                   properties, wc_id, repos_id, kind,
49                   depth)
50           VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, 1,
51                   CASE WHEN ?3 != 'base-deleted' THEN 1 END,
52                   'dir',
53                   CASE WHEN ?3 in ('normal', 'incomplete')
54                        THEN 'infinity' END)
55
56-- STMT_DELETE_ACTUAL
57DELETE FROM actual_node;
58
59-- STMT_INSERT_ACTUAL
60INSERT INTO actual_node (local_relpath, parent_relpath, changelist, wc_id)
61                VALUES (?1, ?2, ?3, 1)
62
63-- STMT_ENSURE_EMPTY_PRISTINE
64INSERT OR IGNORE INTO pristine (checksum, md5_checksum, size, refcount)
65  VALUES ('$sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709',
66          '$md5 $d41d8cd98f00b204e9800998ecf8427e',
67          0, 0)
68
69-- STMT_NODES_SET_FILE
70UPDATE nodes
71   SET kind = 'file',
72       checksum = '$sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709',
73       depth = NULL
74WHERE wc_id = 1 and local_relpath = ?1
75
76-- STMT_SELECT_ALL_ACTUAL
77SELECT local_relpath FROM actual_node WHERE wc_id = 1
78
79