18 using System.Globalization;
24 namespace Deveel.Data.Types {
31 var numericType = (NumericType) type;
32 writer.Write(numericType.Size);
33 writer.Write(numericType.Scale);
35 var stringType = (StringType) type;
36 writer.Write(stringType.MaxSize);
38 if (stringType.Locale != null) {
39 writer.Write((byte) 1);
40 writer.Write(stringType.Locale.Name);
42 writer.Write((byte) 0);
45 var binaryType = (BinaryType) type;
47 writer.Write(binaryType.MaxSize);
54 throw new NotSupportedException(
String.Format(
"The data type '{0}' cannot be serialized.", type.GetType().FullName));
57 var userType = (UserType) type;
58 writer.Write((byte) 1);
59 writer.Write(userType.FullName.FullName);
63 var arrayType = (ArrayType) type;
64 writer.Write(arrayType.Length);
66 throw new NotSupportedException();
71 var writer =
new BinaryWriter(stream, Encoding.Unicode);
72 SerializeTo(writer, type);
87 var maxSize = reader.ReadInt32();
89 CultureInfo locale = null;
90 var hasLocale = reader.ReadByte() == 1;
92 var name = reader.ReadString();
93 locale =
new CultureInfo(name);
101 var size = reader.ReadInt32();
102 var scale = reader.ReadByte();
108 var size = reader.ReadInt32();
120 var size = reader.ReadInt32();
127 throw new NotSupportedException();
131 var reader =
new BinaryReader(stream, Encoding.Unicode);
132 return Deserialize(reader, typeResolver);
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static void SerializeTo(BinaryWriter writer, SqlType type)
static bool IsBooleanType(SqlTypeCode sqlType)
A long string in the system.
static BooleanType Boolean()
static SqlType Deserialize(BinaryReader reader, ITypeResolver resolver)
static void SerializeTo(Stream stream, SqlType type)
static BinaryType Binary(int maxSize)
static bool IsNumericType(SqlTypeCode typeCode)
SqlTypeCode TypeCode
Gets the kind of SQL type this data-type handles.
static bool IsDateType(SqlTypeCode sqlType)
static bool IsStringType(SqlTypeCode typeCode)
static bool IsBinaryType(SqlTypeCode sqlType)
static SqlType Deserialize(Stream stream, ITypeResolver typeResolver)
static NumericType Numeric()
static IntervalType Interval(SqlTypeCode sqlType)
static DateType DateTime()
Defines the properties of a specific SQL Type and handles the values compatible.
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
static StringType String()
bool IsPrimitive
Gets a value indicating if this data-type is primitive.
A data type that represents the NULL value of a given SQL data type.
static bool IsIntervalType(SqlTypeCode sqlType)