-
Notifications
You must be signed in to change notification settings - Fork 35
SQL log
PRAGMA branch_log [--strict] [{range}]
PRAGMA branch_log
↳ returns all the logs from the current branch up to current commit
PRAGMA branch_log test
↳ returns all the logs from the test branch
PRAGMA branch_log test.25
↳ returns only the logs from the test branch's commit 25
PRAGMA branch_log test.12-25
↳ returns the logs from the test branch from commit 12 up to commit 25
PRAGMA branch_log test.12-*
↳ returns the logs from the test branch from commit 12 up to the last commit
PRAGMA branch_log test.*-25
↳ returns the logs from the test branch from the first commit up to commit 25
PRAGMA branch_log -n 5
↳ returns 5 log items from the current branch starting at the last commit
PRAGMA branch_log test -n 5
↳ returns 5 log items from the test branch starting at the last commit
PRAGMA branch_log --strict test
↳ returns only the logs that were generated on the test branch. no logs from source branches are returned
By default, it returns one SQL command on each result row in the same order as they were executed:
+--------+--------+-------------+
| branch | commit | SQL command |
+--------+--------+-------------+
| master | 1 | CREATE TABL |
| master | 2 | INSERT INTO |
| test | 3 | INSERT INTO |
| test | 3 | UPDATE x1 S |
| test | 3 | INSERT INTO |
+--------+--------+-------------+
It can also return one commit on each result row, joining the SQL commands on a single column in one of these formats:
Example:
PRAGMA branch_log test --netstring
+--------+--------+--------------+
| branch | commit | SQL commands |
+--------+--------+--------------+
| master | 3 | 2:AB,3:CDE, |
| test | 4 | 1:A,1:B,1:C, |
| test | 5 | 3:ABC, |
+--------+--------+--------------+
Example:
PRAGMA branch_log test --delimited
+--------+--------+--------------+
| branch | commit | SQL commands |
+--------+--------+--------------+
| master | 3 | AAA;BBB; |
| test | 4 | AA;BBB;CC;D; |
| test | 5 | AAAAA; |
+--------+--------+--------------+
We can also choose another string as a delimiter. It can contain special characters like \t
, \n
or \xff
(2 digits in hexadecimal)
PRAGMA branch_log test --delimited[;\n]