aboutsummaryrefslogtreecommitdiffstats
path: root/subversion/libsvn_fs_x/rep-cache-db.h
blob: c212760651d5bf8cf3c5d4d27cc3ee879dc1a026 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* This file is automatically generated from rep-cache-db.sql and subversion/libsvn_fs_x/token-map.h.
 * Do not edit this file -- edit the source and rerun gen-make.py */

#define STMT_CREATE_SCHEMA 0
#define STMT_0_INFO {"STMT_CREATE_SCHEMA", NULL}
#define STMT_0 \
  "PRAGMA PAGE_SIZE = 4096; " \
  "CREATE TABLE rep_cache ( " \
  "  hash TEXT NOT NULL PRIMARY KEY, " \
  "  revision INTEGER NOT NULL, " \
  "  offset INTEGER NOT NULL, " \
  "  size INTEGER NOT NULL, " \
  "  expanded_size INTEGER NOT NULL " \
  "  ); " \
  "PRAGMA USER_VERSION = 1; " \
  ""

#define STMT_GET_REP 1
#define STMT_1_INFO {"STMT_GET_REP", NULL}
#define STMT_1 \
  "SELECT revision, offset, size, expanded_size " \
  "FROM rep_cache " \
  "WHERE hash = ?1 " \
  ""

#define STMT_SET_REP 2
#define STMT_2_INFO {"STMT_SET_REP", NULL}
#define STMT_2 \
  "INSERT OR FAIL INTO rep_cache (hash, revision, offset, size, expanded_size) " \
  "VALUES (?1, ?2, ?3, ?4, ?5) " \
  ""

#define STMT_GET_REPS_FOR_RANGE 3
#define STMT_3_INFO {"STMT_GET_REPS_FOR_RANGE", NULL}
#define STMT_3 \
  "SELECT hash, revision, offset, size, expanded_size " \
  "FROM rep_cache " \
  "WHERE revision >= ?1 AND revision <= ?2 " \
  ""

#define STMT_GET_MAX_REV 4
#define STMT_4_INFO {"STMT_GET_MAX_REV", NULL}
#define STMT_4 \
  "SELECT MAX(revision) " \
  "FROM rep_cache " \
  ""

#define STMT_DEL_REPS_YOUNGER_THAN_REV 5
#define STMT_5_INFO {"STMT_DEL_REPS_YOUNGER_THAN_REV", NULL}
#define STMT_5 \
  "DELETE FROM rep_cache " \
  "WHERE revision > ?1 " \
  ""

#define STMT_LOCK_REP 6
#define STMT_6_INFO {"STMT_LOCK_REP", NULL}
#define STMT_6 \
  "BEGIN TRANSACTION; " \
  "INSERT INTO rep_cache VALUES ('dummy', 0, 0, 0, 0) " \
  ""

#define STMT_UNLOCK_REP 7
#define STMT_7_INFO {"STMT_UNLOCK_REP", NULL}
#define STMT_7 \
  "ROLLBACK TRANSACTION; " \
  ""

#define REP_CACHE_DB_SQL_DECLARE_STATEMENTS(varname) \
  static const char * const varname[] = { \
    STMT_0, \
    STMT_1, \
    STMT_2, \
    STMT_3, \
    STMT_4, \
    STMT_5, \
    STMT_6, \
    STMT_7, \
    NULL \
  }

#define REP_CACHE_DB_SQL_DECLARE_STATEMENT_INFO(varname) \
  static const char * const varname[][2] = { \
    STMT_0_INFO, \
    STMT_1_INFO, \
    STMT_2_INFO, \
    STMT_3_INFO, \
    STMT_4_INFO, \
    STMT_5_INFO, \
    STMT_6_INFO, \
    STMT_7_INFO, \
    {NULL, NULL} \
  }