Fossil SCM

Make use of WITHOUT ROWID in new repositories.

drh 2013-11-11 19:18 UTC trunk
Commit ad982260909012067e7f25e4b3a6e7618db85217
+4 -4
--- src/allrepo.c
+++ src/allrepo.c
@@ -243,21 +243,21 @@
243243
}
244244
verify_all_options();
245245
zFossil = quoteFilename(g.nameOfExe);
246246
if( useCheckouts ){
247247
db_prepare(&q,
248
- "SELECT substr(name, 7) COLLATE nocase, max(rowid)"
248
+ "SELECT DISTINCT substr(name, 7) COLLATE nocase"
249249
" FROM global_config"
250250
" WHERE substr(name, 1, 6)=='ckout:'"
251
- " GROUP BY 1 ORDER BY 1"
251
+ " ORDER BY 1"
252252
);
253253
}else{
254254
db_prepare(&q,
255
- "SELECT substr(name, 6) COLLATE nocase, max(rowid)"
255
+ "SELECT DISTINCT substr(name, 6) COLLATE nocase"
256256
" FROM global_config"
257257
" WHERE substr(name, 1, 5)=='repo:'"
258
- " GROUP BY 1 ORDER BY 1"
258
+ " ORDER BY 1"
259259
);
260260
}
261261
bag_init(&outOfDate);
262262
while( db_step(&q)==SQLITE_ROW ){
263263
const char *zFilename = db_column_text(&q, 0);
264264
--- src/allrepo.c
+++ src/allrepo.c
@@ -243,21 +243,21 @@
243 }
244 verify_all_options();
245 zFossil = quoteFilename(g.nameOfExe);
246 if( useCheckouts ){
247 db_prepare(&q,
248 "SELECT substr(name, 7) COLLATE nocase, max(rowid)"
249 " FROM global_config"
250 " WHERE substr(name, 1, 6)=='ckout:'"
251 " GROUP BY 1 ORDER BY 1"
252 );
253 }else{
254 db_prepare(&q,
255 "SELECT substr(name, 6) COLLATE nocase, max(rowid)"
256 " FROM global_config"
257 " WHERE substr(name, 1, 5)=='repo:'"
258 " GROUP BY 1 ORDER BY 1"
259 );
260 }
261 bag_init(&outOfDate);
262 while( db_step(&q)==SQLITE_ROW ){
263 const char *zFilename = db_column_text(&q, 0);
264
--- src/allrepo.c
+++ src/allrepo.c
@@ -243,21 +243,21 @@
243 }
244 verify_all_options();
245 zFossil = quoteFilename(g.nameOfExe);
246 if( useCheckouts ){
247 db_prepare(&q,
248 "SELECT DISTINCT substr(name, 7) COLLATE nocase"
249 " FROM global_config"
250 " WHERE substr(name, 1, 6)=='ckout:'"
251 " ORDER BY 1"
252 );
253 }else{
254 db_prepare(&q,
255 "SELECT DISTINCT substr(name, 6) COLLATE nocase"
256 " FROM global_config"
257 " WHERE substr(name, 1, 5)=='repo:'"
258 " ORDER BY 1"
259 );
260 }
261 bag_init(&outOfDate);
262 while( db_step(&q)==SQLITE_ROW ){
263 const char *zFilename = db_column_text(&q, 0);
264
+3 -3
--- src/rebuild.c
+++ src/rebuild.c
@@ -41,14 +41,14 @@
4141
@ -- Shunned artifacts do not exist in the blob table. Hence they
4242
@ -- have not artifact ID (rid) and we thus must store their full
4343
@ -- UUID.
4444
@ --
4545
@ CREATE TABLE IF NOT EXISTS shun(
46
-@ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
46
+@ uuid TEXT PRIMARY KEY,-- UUID of artifact to be shunned. Canonical form
4747
@ mtime INTEGER, -- When added. Seconds since 1970
4848
@ scom TEXT -- Optional text explaining why the shun occurred
49
-@ );
49
+@ ) WITHOUT ROWID;
5050
@
5151
@ -- Artifacts that should not be pushed are stored in the "private"
5252
@ -- table.
5353
@ --
5454
@ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
@@ -63,11 +63,11 @@
6363
@ --
6464
@ CREATE TABLE IF NOT EXISTS concealed(
6565
@ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
6666
@ mtime INTEGER, -- Time created. Seconds since 1970
6767
@ content TEXT -- Content intended to be concealed
68
-@ );
68
+@ ) WITHOUT ROWID;
6969
;
7070
static const char zSchemaUpdates2[] =
7171
@ -- An entry in this table describes a database query that generates a
7272
@ -- table of tickets.
7373
@ --
7474
--- src/rebuild.c
+++ src/rebuild.c
@@ -41,14 +41,14 @@
41 @ -- Shunned artifacts do not exist in the blob table. Hence they
42 @ -- have not artifact ID (rid) and we thus must store their full
43 @ -- UUID.
44 @ --
45 @ CREATE TABLE IF NOT EXISTS shun(
46 @ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
47 @ mtime INTEGER, -- When added. Seconds since 1970
48 @ scom TEXT -- Optional text explaining why the shun occurred
49 @ );
50 @
51 @ -- Artifacts that should not be pushed are stored in the "private"
52 @ -- table.
53 @ --
54 @ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
@@ -63,11 +63,11 @@
63 @ --
64 @ CREATE TABLE IF NOT EXISTS concealed(
65 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
66 @ mtime INTEGER, -- Time created. Seconds since 1970
67 @ content TEXT -- Content intended to be concealed
68 @ );
69 ;
70 static const char zSchemaUpdates2[] =
71 @ -- An entry in this table describes a database query that generates a
72 @ -- table of tickets.
73 @ --
74
--- src/rebuild.c
+++ src/rebuild.c
@@ -41,14 +41,14 @@
41 @ -- Shunned artifacts do not exist in the blob table. Hence they
42 @ -- have not artifact ID (rid) and we thus must store their full
43 @ -- UUID.
44 @ --
45 @ CREATE TABLE IF NOT EXISTS shun(
46 @ uuid TEXT PRIMARY KEY,-- UUID of artifact to be shunned. Canonical form
47 @ mtime INTEGER, -- When added. Seconds since 1970
48 @ scom TEXT -- Optional text explaining why the shun occurred
49 @ ) WITHOUT ROWID;
50 @
51 @ -- Artifacts that should not be pushed are stored in the "private"
52 @ -- table.
53 @ --
54 @ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
@@ -63,11 +63,11 @@
63 @ --
64 @ CREATE TABLE IF NOT EXISTS concealed(
65 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
66 @ mtime INTEGER, -- Time created. Seconds since 1970
67 @ content TEXT -- Content intended to be concealed
68 @ ) WITHOUT ROWID;
69 ;
70 static const char zSchemaUpdates2[] =
71 @ -- An entry in this table describes a database query that generates a
72 @ -- table of tickets.
73 @ --
74
+11 -11
--- src/schema.c
+++ src/schema.c
@@ -28,11 +28,11 @@
2828
@ -- ~/.fossil file and that stores information about the users setup.
2929
@ --
3030
@ CREATE TABLE global_config(
3131
@ name TEXT PRIMARY KEY,
3232
@ value TEXT
33
-@ );
33
+@ ) WITHOUT ROWID;
3434
@
3535
@ -- Identifier for this file type.
3636
@ -- The integer is the same as 'FSLG'.
3737
@ PRAGMA application_id=252006675;
3838
;
@@ -133,11 +133,11 @@
133133
@ CREATE TABLE config(
134134
@ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
135135
@ value CLOB, -- Content of the named parameter
136136
@ mtime DATE, -- last modified. seconds since 1970
137137
@ CHECK( typeof(name)='text' AND length(name)>=1 )
138
-@ );
138
+@ ) WITHOUT ROWID;
139139
@
140140
@ -- Artifacts that should not be processed are identified in the
141141
@ -- "shun" table. Artifacts that are control-file forgeries or
142142
@ -- spam or artifacts whose contents violate administrative policy
143143
@ -- can be shunned in order to prevent them from contaminating
@@ -146,14 +146,14 @@
146146
@ -- Shunned artifacts do not exist in the blob table. Hence they
147147
@ -- have not artifact ID (rid) and we thus must store their full
148148
@ -- UUID.
149149
@ --
150150
@ CREATE TABLE shun(
151
-@ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
151
+@ uuid TEXT PRIMARY KEY,-- UUID of artifact to be shunned. Canonical form
152152
@ mtime DATE, -- When added. seconds since 1970
153153
@ scom TEXT -- Optional text explaining why the shun occurred
154
-@ );
154
+@ ) WITHOUT ROWID;
155155
@
156156
@ -- Artifacts that should not be pushed are stored in the "private"
157157
@ -- table. Private artifacts are omitted from the "unclustered" and
158158
@ -- "unsent" tables.
159159
@ --
@@ -181,11 +181,11 @@
181181
@ --
182182
@ CREATE TABLE concealed(
183183
@ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
184184
@ mtime DATE, -- Time created. Seconds since 1970
185185
@ content TEXT -- Content intended to be concealed
186
-@ );
186
+@ ) WITHOUT ROWID;
187187
@
188188
@ -- The application ID helps the unix "file" command to identify the
189189
@ -- database as a fossil repository.
190190
@ PRAGMA application_id=252006673;
191191
;
@@ -250,12 +250,12 @@
250250
@ CREATE TABLE plink(
251251
@ pid INTEGER REFERENCES blob, -- Parent manifest
252252
@ cid INTEGER REFERENCES blob, -- Child manifest
253253
@ isprim BOOLEAN, -- pid is the primary parent of cid
254254
@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
255
-@ UNIQUE(pid, cid)
256
-@ );
255
+@ PRIMARY KEY(pid, cid)
256
+@ ) WITHOUT ROWID;
257257
@ CREATE INDEX plink_i2 ON plink(cid,pid);
258258
@
259259
@ -- A "leaf" checkin is a checkin that has no children in the same
260260
@ -- branch. The set of all leaves is easily computed with a join,
261261
@ -- between the plink and tagxref tables, but it is a slower join for
@@ -356,12 +356,12 @@
356356
@ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
357357
@ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
358358
@ value TEXT, -- Value of the tag. Might be NULL.
359359
@ mtime TIMESTAMP, -- Time of addition or removal. Julian day
360360
@ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
361
-@ UNIQUE(rid, tagid)
362
-@ );
361
+@ PRIMARY KEY(rid, tagid)
362
+@ ) WITHOUT ROWID;
363363
@ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
364364
@
365365
@ -- When a hyperlink occurs from one artifact to another (for example
366366
@ -- when a check-in comment refers to a ticket) an entry is made in
367367
@ -- the following table for that hyperlink. This table is used to
@@ -370,12 +370,12 @@
370370
@ CREATE TABLE backlink(
371371
@ target TEXT, -- Where the hyperlink points to
372372
@ srctype INT, -- 0: check-in 1: ticket 2: wiki
373373
@ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
374374
@ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day.
375
-@ UNIQUE(target, srctype, srcid)
376
-@ );
375
+@ PRIMARY KEY(target, srctype, srcid)
376
+@ ) WITHOUT ROWID;
377377
@ CREATE INDEX backlink_src ON backlink(srcid, srctype);
378378
@
379379
@ -- Each attachment is an entry in the following table. Only
380380
@ -- the most recent attachment (identified by the D card) is saved.
381381
@ --
382382
--- src/schema.c
+++ src/schema.c
@@ -28,11 +28,11 @@
28 @ -- ~/.fossil file and that stores information about the users setup.
29 @ --
30 @ CREATE TABLE global_config(
31 @ name TEXT PRIMARY KEY,
32 @ value TEXT
33 @ );
34 @
35 @ -- Identifier for this file type.
36 @ -- The integer is the same as 'FSLG'.
37 @ PRAGMA application_id=252006675;
38 ;
@@ -133,11 +133,11 @@
133 @ CREATE TABLE config(
134 @ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
135 @ value CLOB, -- Content of the named parameter
136 @ mtime DATE, -- last modified. seconds since 1970
137 @ CHECK( typeof(name)='text' AND length(name)>=1 )
138 @ );
139 @
140 @ -- Artifacts that should not be processed are identified in the
141 @ -- "shun" table. Artifacts that are control-file forgeries or
142 @ -- spam or artifacts whose contents violate administrative policy
143 @ -- can be shunned in order to prevent them from contaminating
@@ -146,14 +146,14 @@
146 @ -- Shunned artifacts do not exist in the blob table. Hence they
147 @ -- have not artifact ID (rid) and we thus must store their full
148 @ -- UUID.
149 @ --
150 @ CREATE TABLE shun(
151 @ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
152 @ mtime DATE, -- When added. seconds since 1970
153 @ scom TEXT -- Optional text explaining why the shun occurred
154 @ );
155 @
156 @ -- Artifacts that should not be pushed are stored in the "private"
157 @ -- table. Private artifacts are omitted from the "unclustered" and
158 @ -- "unsent" tables.
159 @ --
@@ -181,11 +181,11 @@
181 @ --
182 @ CREATE TABLE concealed(
183 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
184 @ mtime DATE, -- Time created. Seconds since 1970
185 @ content TEXT -- Content intended to be concealed
186 @ );
187 @
188 @ -- The application ID helps the unix "file" command to identify the
189 @ -- database as a fossil repository.
190 @ PRAGMA application_id=252006673;
191 ;
@@ -250,12 +250,12 @@
250 @ CREATE TABLE plink(
251 @ pid INTEGER REFERENCES blob, -- Parent manifest
252 @ cid INTEGER REFERENCES blob, -- Child manifest
253 @ isprim BOOLEAN, -- pid is the primary parent of cid
254 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
255 @ UNIQUE(pid, cid)
256 @ );
257 @ CREATE INDEX plink_i2 ON plink(cid,pid);
258 @
259 @ -- A "leaf" checkin is a checkin that has no children in the same
260 @ -- branch. The set of all leaves is easily computed with a join,
261 @ -- between the plink and tagxref tables, but it is a slower join for
@@ -356,12 +356,12 @@
356 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
357 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
358 @ value TEXT, -- Value of the tag. Might be NULL.
359 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
360 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
361 @ UNIQUE(rid, tagid)
362 @ );
363 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
364 @
365 @ -- When a hyperlink occurs from one artifact to another (for example
366 @ -- when a check-in comment refers to a ticket) an entry is made in
367 @ -- the following table for that hyperlink. This table is used to
@@ -370,12 +370,12 @@
370 @ CREATE TABLE backlink(
371 @ target TEXT, -- Where the hyperlink points to
372 @ srctype INT, -- 0: check-in 1: ticket 2: wiki
373 @ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
374 @ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day.
375 @ UNIQUE(target, srctype, srcid)
376 @ );
377 @ CREATE INDEX backlink_src ON backlink(srcid, srctype);
378 @
379 @ -- Each attachment is an entry in the following table. Only
380 @ -- the most recent attachment (identified by the D card) is saved.
381 @ --
382
--- src/schema.c
+++ src/schema.c
@@ -28,11 +28,11 @@
28 @ -- ~/.fossil file and that stores information about the users setup.
29 @ --
30 @ CREATE TABLE global_config(
31 @ name TEXT PRIMARY KEY,
32 @ value TEXT
33 @ ) WITHOUT ROWID;
34 @
35 @ -- Identifier for this file type.
36 @ -- The integer is the same as 'FSLG'.
37 @ PRAGMA application_id=252006675;
38 ;
@@ -133,11 +133,11 @@
133 @ CREATE TABLE config(
134 @ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
135 @ value CLOB, -- Content of the named parameter
136 @ mtime DATE, -- last modified. seconds since 1970
137 @ CHECK( typeof(name)='text' AND length(name)>=1 )
138 @ ) WITHOUT ROWID;
139 @
140 @ -- Artifacts that should not be processed are identified in the
141 @ -- "shun" table. Artifacts that are control-file forgeries or
142 @ -- spam or artifacts whose contents violate administrative policy
143 @ -- can be shunned in order to prevent them from contaminating
@@ -146,14 +146,14 @@
146 @ -- Shunned artifacts do not exist in the blob table. Hence they
147 @ -- have not artifact ID (rid) and we thus must store their full
148 @ -- UUID.
149 @ --
150 @ CREATE TABLE shun(
151 @ uuid TEXT PRIMARY KEY,-- UUID of artifact to be shunned. Canonical form
152 @ mtime DATE, -- When added. seconds since 1970
153 @ scom TEXT -- Optional text explaining why the shun occurred
154 @ ) WITHOUT ROWID;
155 @
156 @ -- Artifacts that should not be pushed are stored in the "private"
157 @ -- table. Private artifacts are omitted from the "unclustered" and
158 @ -- "unsent" tables.
159 @ --
@@ -181,11 +181,11 @@
181 @ --
182 @ CREATE TABLE concealed(
183 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
184 @ mtime DATE, -- Time created. Seconds since 1970
185 @ content TEXT -- Content intended to be concealed
186 @ ) WITHOUT ROWID;
187 @
188 @ -- The application ID helps the unix "file" command to identify the
189 @ -- database as a fossil repository.
190 @ PRAGMA application_id=252006673;
191 ;
@@ -250,12 +250,12 @@
250 @ CREATE TABLE plink(
251 @ pid INTEGER REFERENCES blob, -- Parent manifest
252 @ cid INTEGER REFERENCES blob, -- Child manifest
253 @ isprim BOOLEAN, -- pid is the primary parent of cid
254 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
255 @ PRIMARY KEY(pid, cid)
256 @ ) WITHOUT ROWID;
257 @ CREATE INDEX plink_i2 ON plink(cid,pid);
258 @
259 @ -- A "leaf" checkin is a checkin that has no children in the same
260 @ -- branch. The set of all leaves is easily computed with a join,
261 @ -- between the plink and tagxref tables, but it is a slower join for
@@ -356,12 +356,12 @@
356 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
357 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
358 @ value TEXT, -- Value of the tag. Might be NULL.
359 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
360 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
361 @ PRIMARY KEY(rid, tagid)
362 @ ) WITHOUT ROWID;
363 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
364 @
365 @ -- When a hyperlink occurs from one artifact to another (for example
366 @ -- when a check-in comment refers to a ticket) an entry is made in
367 @ -- the following table for that hyperlink. This table is used to
@@ -370,12 +370,12 @@
370 @ CREATE TABLE backlink(
371 @ target TEXT, -- Where the hyperlink points to
372 @ srctype INT, -- 0: check-in 1: ticket 2: wiki
373 @ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
374 @ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day.
375 @ PRIMARY KEY(target, srctype, srcid)
376 @ ) WITHOUT ROWID;
377 @ CREATE INDEX backlink_src ON backlink(srcid, srctype);
378 @
379 @ -- Each attachment is an entry in the following table. Only
380 @ -- the most recent attachment (identified by the D card) is saved.
381 @ --
382
+1 -1
--- src/undo.c
+++ src/undo.c
@@ -220,11 +220,11 @@
220220
void undo_begin(void){
221221
int cid;
222222
const char *zDb = db_name("localdb");
223223
static const char zSql[] =
224224
@ CREATE TABLE %s.undo(
225
- @ pathname TEXT UNIQUE, -- Name of the file
225
+ @ pathname TEXT PRIMARY KEY, -- Name of the file
226226
@ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable
227227
@ existsflag BOOLEAN, -- True if the file exists
228228
@ isExe BOOLEAN, -- True if the file is executable
229229
@ isLink BOOLEAN, -- True if the file is symlink
230230
@ content BLOB -- Saved content
231231
--- src/undo.c
+++ src/undo.c
@@ -220,11 +220,11 @@
220 void undo_begin(void){
221 int cid;
222 const char *zDb = db_name("localdb");
223 static const char zSql[] =
224 @ CREATE TABLE %s.undo(
225 @ pathname TEXT UNIQUE, -- Name of the file
226 @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable
227 @ existsflag BOOLEAN, -- True if the file exists
228 @ isExe BOOLEAN, -- True if the file is executable
229 @ isLink BOOLEAN, -- True if the file is symlink
230 @ content BLOB -- Saved content
231
--- src/undo.c
+++ src/undo.c
@@ -220,11 +220,11 @@
220 void undo_begin(void){
221 int cid;
222 const char *zDb = db_name("localdb");
223 static const char zSql[] =
224 @ CREATE TABLE %s.undo(
225 @ pathname TEXT PRIMARY KEY, -- Name of the file
226 @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable
227 @ existsflag BOOLEAN, -- True if the file exists
228 @ isExe BOOLEAN, -- True if the file is executable
229 @ isLink BOOLEAN, -- True if the file is symlink
230 @ content BLOB -- Saved content
231

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button