Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
52 lines (42 loc) · 2.04 KB

File metadata and controls

52 lines (42 loc) · 2.04 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using System.IO;
using System.Text;
using Npgsql.Internal;
using Npgsql.Util;
namespace Npgsql;
static class PregeneratedMessages
{
static PregeneratedMessages()
{
// This is the only use of a write buffer without a connector, for in-memory construction of
// pregenerated messages.
using var buf = new NpgsqlWriteBuffer(null, new MemoryStream(), null, NpgsqlWriteBuffer.MinimumSize, Encoding.ASCII);
BeginTransRepeatableRead = Generate(buf, "BEGIN ISOLATION LEVEL REPEATABLE READ");
BeginTransSerializable = Generate(buf, "BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE");
BeginTransReadCommitted = Generate(buf, "BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED");
BeginTransReadUncommitted = Generate(buf, "BEGIN TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
CommitTransaction = Generate(buf, "COMMIT");
RollbackTransaction = Generate(buf, "ROLLBACK");
DiscardAll = Generate(buf, "DISCARD ALL");
}
internal static byte[] Generate(NpgsqlWriteBuffer buf, string query)
{
NpgsqlWriteBuffer.AssertASCIIOnly(query);
var queryByteLen = buf.TextEncoding.GetByteCount(query);
buf.WriteByte(FrontendMessageCode.Query);
buf.WriteInt32(4 + // Message length (including self excluding code)
queryByteLen + // Query byte length
1); // Null terminator
buf.WriteString(query, queryByteLen, false).Wait();
buf.WriteByte(0);
var bytes = buf.GetContents();
buf.Clear();
return bytes;
}
internal static readonly byte[] BeginTransRepeatableRead;
internal static readonly byte[] BeginTransSerializable;
internal static readonly byte[] BeginTransReadCommitted;
internal static readonly byte[] BeginTransReadUncommitted;
internal static readonly byte[] CommitTransaction;
internal static readonly byte[] RollbackTransaction;
internal static readonly byte[] DiscardAll;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.