/
Common.cs
81 lines (76 loc) · 2.16 KB
/
Common.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
namespace Npgsql;
/// <summary>
/// Base class for all classes which represent a message sent by the PostgreSQL backend.
/// </summary>
interface IBackendMessage
{
BackendMessageCode Code { get; }
}
enum BackendMessageCode : byte
{
AuthenticationRequest = (byte)'R',
BackendKeyData = (byte)'K',
BindComplete = (byte)'2',
CloseComplete = (byte)'3',
CommandComplete = (byte)'C',
CopyData = (byte)'d',
CopyDone = (byte)'c',
CopyBothResponse = (byte)'W',
CopyInResponse = (byte)'G',
CopyOutResponse = (byte)'H',
DataRow = (byte)'D',
EmptyQueryResponse = (byte)'I',
ErrorResponse = (byte)'E',
FunctionCall = (byte)'F',
FunctionCallResponse = (byte)'V',
NoData = (byte)'n',
NoticeResponse = (byte)'N',
NotificationResponse = (byte)'A',
ParameterDescription = (byte)'t',
ParameterStatus = (byte)'S',
ParseComplete = (byte)'1',
PasswordPacket = (byte)' ',
PortalSuspended = (byte)'s',
ReadyForQuery = (byte)'Z',
RowDescription = (byte)'T',
}
static class FrontendMessageCode
{
internal const byte Describe = (byte)'D';
internal const byte Sync = (byte)'S';
internal const byte Execute = (byte)'E';
internal const byte Parse = (byte)'P';
internal const byte Bind = (byte)'B';
internal const byte Close = (byte)'C';
internal const byte Query = (byte)'Q';
internal const byte CopyData = (byte)'d';
internal const byte CopyDone = (byte)'c';
internal const byte CopyFail = (byte)'f';
internal const byte Terminate = (byte)'X';
internal const byte Password = (byte)'p';
}
enum StatementOrPortal : byte
{
Statement = (byte)'S',
Portal = (byte)'P'
}
/// <summary>
/// Specifies the type of SQL statement, e.g. SELECT
/// </summary>
public enum StatementType
{
#pragma warning disable 1591
Unknown,
Select,
Insert,
Delete,
Update,
CreateTableAs,
Move,
Fetch,
Copy,
Other,
Merge,
Call
#pragma warning restore 1591
}