Login
Changes To SQLSnippets
Login

Changes to "SQLSnippets" between 2014-02-08 20:07:23 and 2014-02-09 14:37:14

191
192
193
194
195
196
197
198

199
200
201
202
203
204
205
206
207
208

209

210
















211
212
213
214
215
216
217
191
192
193
194
195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235







-
+










+

+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







WHERE b.rid=a.rid
;
</pre></nowiki>


<h2>Checkout-vs-repo Overview</h2>

And overview of info similar to that provided by <tt>fossil changes</tt> and similar commands:
An overview of info similar to that provided by <tt>fossil changes</tt> and similar commands:

<nowiki><pre>
SELECT id,vid,vfile.mrid, deleted, chnged, uuid, size, mtime, pathname
FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid
WHERE vid=BLOB_RID_OF_CHECKIN_VERSION
and chnged
ORDER BY pathname
</pre></nowiki>


<h2>Ancestry of a File</h2>

An overview of info the ancestry of a file:

<nowiki><pre>
SELECT
b.uuid as manifestUuid,
datetime(p.mtime) as manifestTime,
--       ml.*,
b.size AS manifestSize,
fn.name AS filename
FROM mlink ml, filename fn, blob b, plink p
WHERE ml.fnid=fn.fnid
AND fn.name='f-timeline.c' -- CHANGE THIS NAME
AND ml.mid=b.rid
AND p.cid=ml.mid
ORDER BY manifestTime DESC;
</pre></nowiki>

Not yet sure how it behaves across branches, and it certainly doesn't track renames.

<h2>Recursion Example</h2>

See also: [http://www.sqlite.org/draft/lang_with.html]

The following is adapted from a sqlite mailing list post by Petite Abeille on 20140203, not directly applicable to fossil but which is an interesting example nonetheless and which can certainly be used as a model for generating fossil-related data: