25 namespace Deveel.Data.Sql.Tables {
48 if (
String.IsNullOrEmpty(columnName))
49 throw new ArgumentNullException(
"columnName");
50 if (columnType == null)
51 throw new ArgumentNullException(
"columnType");
55 ColumnName = columnName;
59 ColumnName = data.
GetString(
"ColumnName");
79 public string ColumnName {
get;
private set; }
109 public bool HasSize {
116 return sizeable == null ? -1 : sizeable.
Size;
120 public bool HasScale {
127 return numericType == null ? -1 : numericType.
Scale;
136 public bool IsIndexable {
144 public bool IsNotNull {
get; set; }
157 public bool HasDefaultExpression {
158 get {
return DefaultExpression != null; }
161 public string IndexType {
get;
internal set; }
165 data.
SetValue(
"ColumnName", ColumnName);
167 data.
SetValue(
"IsNotNull", IsNotNull);
168 data.
SetValue(
"Default", DefaultExpression);
169 data.
SetValue(
"IndexType", IndexType);
179 writer.Write(columnInfo.
IsNotNull ? (byte)1 : (byte)0);
182 writer.Write((byte)1);
185 writer.Write((byte)0);
190 var writer =
new BinaryWriter(stream, encoding);
191 Serialize(columnInfo, writer);
195 Serialize(columnInfo, stream, Encoding.Unicode);
199 var reader =
new BinaryReader(stream, Encoding.Unicode);
200 return Deserialize(reader, typeResolver);
204 var version = reader.ReadInt32();
206 throw new FormatException(
"Invalid version of the Column-Info");
208 var columnName = reader.ReadString();
211 var notNull = reader.ReadByte() == 1;
213 var columnInfo =
new ColumnInfo(columnName, columnType);
214 columnInfo.IsNotNull = notNull;
216 var hasDefault = reader.ReadByte() == 1;
Defines the metadata properties of a column within a table of a database.
static void SerializeTo(BinaryWriter writer, SqlType type)
void GetData(SerializeData data)
A long string in the system.
static void Serialize(ColumnInfo columnInfo, Stream stream, Encoding encoding)
ColumnInfo(ObjectData data)
bool IsNotNull
Gets or sets a boolean value indicating if the column values are constrained to be ony NOT NULL...
static SqlType Deserialize(BinaryReader reader, ITypeResolver resolver)
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
virtual bool IsIndexable
Indicates if the values handled by the type can be part of an index.
static void Serialize(SqlExpression expression, BinaryWriter writer)
ObjectName TableName
Gets the fully qualified name of the table that is ensured to be unique within the system...
static SqlExpression Deserialize(BinaryReader reader)
static void Serialize(ColumnInfo columnInfo, Stream stream)
static ColumnInfo Deserialize(Stream stream, ITypeResolver typeResolver)
static void Serialize(ColumnInfo columnInfo, BinaryWriter writer)
Defines the properties of a specific SQL Type and handles the values compatible.
string ColumnName
Gets the name of the column.
SqlExpression DefaultExpression
Gets or sets a SqlExpression used as a DEFAULT when a constraint for the column is to SET DEFAULT...
SqlType ColumnType
Gets the SqlType that cells within a table for this column will handle.
int IndexOfColumn(string columnName)
Gets the offset of the column with the given name.
ColumnInfo(string columnName, SqlType columnType)
Constructs a new column with the given name and type.
bool GetBoolean(string key)
object GetValue(string key)
static ColumnInfo Deserialize(BinaryReader reader, ITypeResolver typeResolver)
Defines the base class for instances that represent SQL expression tree nodes.
Defines the metadata properties of a table existing within a database.
string GetString(string key)