Skip to content

Commit 639fe73

Browse files
committed
docs
1 parent eb03591 commit 639fe73

File tree

3 files changed

+35
-25
lines changed

3 files changed

+35
-25
lines changed

readme.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ graph TD
5353
The ETag is calculated from a combination several parts
5454

5555

56-
#### AssemblyWriteTime
56+
### AssemblyWriteTime
5757

5858
The last write time of the web entry point assembly
5959

@@ -67,18 +67,25 @@ AssemblyWriteTime = File.GetLastWriteTime(webAssemblyLocation).Ticks.ToString();
6767
<!-- endSnippet -->
6868

6969

70-
#### SQL timestamp
70+
### SQL timestamp
7171

72-
<!-- snippet: SqlServerTimestamp -->
73-
<a id='snippet-SqlServerTimestamp'></a>
74-
```cs
75-
select log_end_lsn from sys.dm_db_log_stats(db_id())
72+
73+
#### SQL Server
74+
75+
```sql
76+
select log_end_lsn
77+
from sys.dm_db_log_stats(db_id())
78+
```
79+
80+
81+
#### Postgres
82+
83+
```sql
84+
select pg_last_committed_xact();
7685
```
77-
<sup><a href='/src/Delta/DeltaExtensions_Sql.cs#L45-L47' title='Snippet source file'>snippet source</a> | <a href='#snippet-SqlServerTimestamp' title='Start of snippet'>anchor</a></sup>
78-
<!-- endSnippet -->
7986

8087

81-
#### Suffix
88+
### Suffix
8289

8390
An optional string suffix that is dynamically calculated at runtime based on the current `HttpContext`.
8491

readme.source.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,32 @@ graph TD
4646
The ETag is calculated from a combination several parts
4747

4848

49-
#### AssemblyWriteTime
49+
### AssemblyWriteTime
5050

5151
The last write time of the web entry point assembly
5252

5353
snippet: AssemblyWriteTime
5454

5555

56-
#### SQL timestamp
56+
### SQL timestamp
5757

58-
snippet: SqlServerTimestamp
58+
59+
#### SQL Server
60+
61+
```sql
62+
select log_end_lsn
63+
from sys.dm_db_log_stats(db_id())
64+
```
65+
66+
67+
#### Postgres
68+
69+
```sql
70+
select pg_last_committed_xact();
71+
```
5972

6073

61-
#### Suffix
74+
### Suffix
6275

6376
An optional string suffix that is dynamically calculated at runtime based on the current `HttpContext`.
6477

src/Delta/DeltaExtensions_Sql.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ static async Task<string> ExecuteTimestampQuery(DbCommand command, Cancel cancel
4040
var name = command.GetType().Name;
4141
if (name == "SqlCommand")
4242
{
43-
command.CommandText =
44-
$"""
45-
-- begin-snippet: SqlServerTimestamp
46-
select log_end_lsn from sys.dm_db_log_stats(db_id())
47-
-- end-snippet
48-
""";
43+
command.CommandText = $"select log_end_lsn from sys.dm_db_log_stats(db_id())";
4944
await using var reader = await command.ExecuteReaderAsync(CommandBehavior.SingleRow, cancel);
5045
var readAsync = await reader.ReadAsync(cancel);
5146
// for empty transaction log
@@ -59,12 +54,7 @@ select log_end_lsn from sys.dm_db_log_stats(db_id())
5954

6055
if (name == "NpgsqlCommand")
6156
{
62-
command.CommandText =
63-
"""
64-
-- begin-snippet: PostgresTimestamp
65-
select pg_last_committed_xact();
66-
-- end-snippet
67-
""";
57+
command.CommandText = "select pg_last_committed_xact();";
6858
var results = (object?[]?) await command.ExecuteScalarAsync(cancel);
6959

7060
// null on first run after SET track_commit_timestamp to 'on'

0 commit comments

Comments
 (0)