]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.sql
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_fs_fs / rep-cache-db.sql
1 /* rep-cache-db.sql -- schema for use in rep-caching
2  *   This is intended for use with SQLite 3
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_CREATE_SCHEMA
25 /* A table mapping representation hashes to locations in a rev file. */
26 CREATE TABLE rep_cache (
27   hash TEXT NOT NULL PRIMARY KEY,
28   revision INTEGER NOT NULL,
29   offset INTEGER NOT NULL,
30   size INTEGER NOT NULL,
31   expanded_size INTEGER NOT NULL
32   );
33
34 PRAGMA USER_VERSION = 1;
35
36
37 -- STMT_GET_REP
38 SELECT revision, offset, size, expanded_size
39 FROM rep_cache
40 WHERE hash = ?1
41
42 -- STMT_SET_REP
43 INSERT OR FAIL INTO rep_cache (hash, revision, offset, size, expanded_size)
44 VALUES (?1, ?2, ?3, ?4, ?5)
45
46 -- STMT_GET_REPS_FOR_RANGE
47 SELECT hash, revision, offset, size, expanded_size
48 FROM rep_cache
49 WHERE revision >= ?1 AND revision <= ?2
50
51 -- STMT_GET_MAX_REV
52 SELECT MAX(revision)
53 FROM rep_cache
54
55 -- STMT_DEL_REPS_YOUNGER_THAN_REV
56 DELETE FROM rep_cache
57 WHERE revision > ?1
58
59 /* An INSERT takes an SQLite reserved lock that prevents other writes
60    but doesn't block reads.  The incomplete transaction means that no
61    permanent change is made to the database and the transaction is
62    removed when the database is closed.  */
63 -- STMT_LOCK_REP
64 BEGIN TRANSACTION;
65 INSERT INTO rep_cache VALUES ('dummy', 0, 0, 0, 0)