forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlDbColumn.cs
More file actions
184 lines (157 loc) · 5.2 KB
/
NpgsqlDbColumn.cs
File metadata and controls
184 lines (157 loc) · 5.2 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
using System;
using JetBrains.Annotations;
using Npgsql.PostgresTypes;
using NpgsqlTypes;
#if !NET461
using System.Data.Common;
#endif
#pragma warning disable 1591
namespace Npgsql.Schema
{
/// <summary>
/// Provides schema information about a column.
/// </summary>
/// <remarks>
/// Note that this can correspond to a field returned in a query which isn't an actual table column
///
/// See https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getschematable(v=vs.110).aspx
/// for information on the meaning of the different fields.
/// </remarks>
public class NpgsqlDbColumn : DbColumn
{
public NpgsqlDbColumn()
{
PostgresType = UnknownBackendType.Instance;
// Not supported in PostgreSQL
IsExpression = false;
IsAliased = false;
IsHidden = false;
IsIdentity = false;
}
#region Standard fields
#nullable disable
// ReSharper disable once InconsistentNaming
public new bool? AllowDBNull
{
get => base.AllowDBNull;
protected internal set => base.AllowDBNull = value;
}
public new string BaseCatalogName
{
get => base.BaseCatalogName;
protected internal set => base.BaseCatalogName = value;
}
public new string BaseColumnName
{
get => base.BaseColumnName;
protected internal set => base.BaseColumnName = value;
}
public new string BaseSchemaName
{
get => base.BaseSchemaName;
protected internal set => base.BaseSchemaName = value;
}
public new string BaseServerName
{
get => base.BaseServerName;
protected internal set => base.BaseServerName = value;
}
public new string BaseTableName
{
get => base.BaseTableName;
protected internal set => base.BaseTableName = value;
}
public new string ColumnName
{
get => base.ColumnName;
protected internal set => base.ColumnName = value;
}
public new int? ColumnOrdinal
{
get => base.ColumnOrdinal;
protected internal set => base.ColumnOrdinal = value;
}
public new int? ColumnSize
{
get => base.ColumnSize;
protected internal set => base.ColumnSize = value;
}
public new bool? IsAutoIncrement
{
get => base.IsAutoIncrement;
protected internal set => base.IsAutoIncrement = value;
}
public new bool? IsKey
{
get => base.IsKey;
protected internal set => base.IsKey = value;
}
public new bool? IsLong
{
get => base.IsLong;
protected internal set => base.IsLong = value;
}
public new bool? IsReadOnly
{
get => base.IsReadOnly;
protected internal set => base.IsReadOnly = value;
}
public new bool? IsUnique
{
get => base.IsUnique;
protected internal set => base.IsUnique = value;
}
public new int? NumericPrecision
{
get => base.NumericPrecision;
protected internal set => base.NumericPrecision = value;
}
public new int? NumericScale
{
get => base.NumericScale;
protected internal set => base.NumericScale = value;
}
public new string UdtAssemblyQualifiedName
{
get => base.UdtAssemblyQualifiedName;
protected internal set => base.UdtAssemblyQualifiedName = value;
}
public new Type DataType
{
get => base.DataType;
protected internal set => base.DataType = value;
}
public new string DataTypeName
{
get => base.DataTypeName;
protected internal set => base.DataTypeName = value;
}
#nullable restore
#endregion Standard fields
#region Npgsql-specific fields
[PublicAPI]
public PostgresType PostgresType { get; internal set; }
[PublicAPI]
public uint TypeOID { get; internal set; }
[PublicAPI]
public uint TableOID { get; internal set; }
[PublicAPI]
public short? ColumnAttributeNumber { get; internal set; }
[PublicAPI]
public string? DefaultValue { get; internal set; }
[PublicAPI]
public NpgsqlDbType? NpgsqlDbType { get; internal set; }
public override object? this[string propertyName]
=> propertyName switch
{
nameof(PostgresType) => PostgresType,
nameof(TypeOID) => TypeOID,
nameof(TableOID) => TableOID,
nameof(ColumnAttributeNumber) => ColumnAttributeNumber,
nameof(DefaultValue) => DefaultValue,
nameof(NpgsqlDbType) => NpgsqlDbType,
_ => base[propertyName]
};
#endregion Npgsql-specific fields
}
}