Class MySqlDataType
Represents a DB data type.
public sealed class MySqlDataType : ISqlDataType, IEquatable<MySqlDataType>, IComparable<MySqlDataType>, IComparable
- Inheritance
-
MySqlDataType
- Implements
- Inherited Members
Remarks
MySqlDialect implementation.
Fields
BigInt
Represents the BIGINT type.
public static readonly MySqlDataType BigInt
Field Value
Binary
Represents the BINARY type with default 255 length.
public static readonly MySqlDataType Binary
Field Value
Blob
Represents the LONGBLOB type.
public static readonly MySqlDataType Blob
Field Value
Bool
Represents the BOOL type.
public static readonly MySqlDataType Bool
Field Value
Char
Represents the CHAR type with default 255 length.
public static readonly MySqlDataType Char
Field Value
Date
Represents the DATE type.
public static readonly MySqlDataType Date
Field Value
DateTime
Represents the DATETIME(6) type.
public static readonly MySqlDataType DateTime
Field Value
Decimal
Represents the DECIMAL type with default 29 scale and 10 precision.
public static readonly MySqlDataType Decimal
Field Value
Double
Represents the DOUBLE type.
public static readonly MySqlDataType Double
Field Value
Float
Represents the FLOAT type.
public static readonly MySqlDataType Float
Field Value
Int
Represents the INT type.
public static readonly MySqlDataType Int
Field Value
SmallInt
Represents the SMALLINT type.
public static readonly MySqlDataType SmallInt
Field Value
Text
Represents the LONGTEXT type.
public static readonly MySqlDataType Text
Field Value
Time
Represents the TIME(6) type.
public static readonly MySqlDataType Time
Field Value
TinyInt
Represents the TINYINT type.
public static readonly MySqlDataType TinyInt
Field Value
UnsignedBigInt
Represents the BIGINT UNSIGNED type.
public static readonly MySqlDataType UnsignedBigInt
Field Value
UnsignedInt
Represents the INT UNSIGNED type.
public static readonly MySqlDataType UnsignedInt
Field Value
UnsignedSmallInt
Represents the SMALLINT UNSIGNED type.
public static readonly MySqlDataType UnsignedSmallInt
Field Value
UnsignedTinyInt
Represents the TINYINT UNSIGNED type.
public static readonly MySqlDataType UnsignedTinyInt
Field Value
VarBinary
Represents the VARBINARY type with default 65535 maximum length.
public static readonly MySqlDataType VarBinary
Field Value
VarChar
Represents the VARCHAR type with default 65535 maximum length.
public static readonly MySqlDataType VarChar
Field Value
Properties
DbType
DbType of this data type.
public DbType DbType { get; }
Property Value
Dialect
Specifies the SQL dialect of this data type.
public SqlDialect Dialect { get; }
Property Value
Name
DB name of this data type.
public string Name { get; }
Property Value
ParameterDefinitions
Collection of parameter definitions for this data type.
public ReadOnlySpan<SqlDataTypeParameter> ParameterDefinitions { get; }
Property Value
Parameters
Collection of applied parameters to this data type.
public ReadOnlySpan<int> Parameters { get; }
Property Value
Value
Underlying value.
public MySqlDbType Value { get; }
Property Value
- MySqlDbType
Methods
CompareTo(MySqlDataType?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
[Pure]
public int CompareTo(MySqlDataType? other)
Parameters
other
MySqlDataTypeAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
[Pure]
public int CompareTo(object? obj)
Parameters
obj
objectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes obj
in the sort order.Zero This instance occurs in the same position in the sort order as obj
.Greater than zero This instance follows obj
in the sort order.
Exceptions
- ArgumentException
obj
is not the same type as this instance.
CreateBinary(int)
Creates a new BINARY type.
[Pure]
public static MySqlDataType CreateBinary(int length)
Parameters
length
intDesired length.
Returns
- MySqlDataType
MySqlDataType instance that represents the desired BINARY type.
Exceptions
- SqlDataTypeException
When
length
is not in [0, 255] range.
CreateChar(int)
Creates a new CHAR type.
[Pure]
public static MySqlDataType CreateChar(int length)
Parameters
length
intDesired length.
Returns
- MySqlDataType
MySqlDataType instance that represents the desired CHAR type.
Exceptions
- SqlDataTypeException
When
length
is not in [0, 255] range.
CreateDecimal(int, int)
Creates a new DECIMAL type.
[Pure]
public static MySqlDataType CreateDecimal(int precision, int scale)
Parameters
Returns
- MySqlDataType
MySqlDataType instance that represents the desired DECIMAL type.
Exceptions
- SqlDataTypeException
When
precision
is not in [0, 65] range or whenscale
is not in [0, 30] range.
CreateVarBinary(int)
Creates a new VARBINARY type.
[Pure]
public static MySqlDataType CreateVarBinary(int maxLength)
Parameters
maxLength
intDesired maximum length.
Returns
- MySqlDataType
MySqlDataType instance that represents the desired VARBINARY type.
Exceptions
- SqlDataTypeException
When
maxLength
is not in [0, 65535] range.
CreateVarChar(int)
Creates a new VARCHAR type.
[Pure]
public static MySqlDataType CreateVarChar(int maxLength)
Parameters
maxLength
intDesired maximum length.
Returns
- MySqlDataType
MySqlDataType instance that represents the desired VARCHAR type.
Exceptions
- SqlDataTypeException
When
maxLength
is not in [0, 65535] range.
Custom(string, MySqlDbType, DbType)
Creates a new custom type.
[Pure]
public static MySqlDataType Custom(string name, MySqlDbType value, DbType dbType)
Parameters
name
stringDB name of this data type.
value
MySqlDbTypeUnderlying value.
dbType
DbTypeDbType of this data type.
Returns
- MySqlDataType
New MySqlDataType instance.
Equals(MySqlDataType?)
Indicates whether the current object is equal to another object of the same type.
[Pure]
public bool Equals(MySqlDataType? other)
Parameters
other
MySqlDataTypeAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
[Pure]
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
[Pure]
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string representation of this MySqlDataType instance.
[Pure]
public override string ToString()
Returns
- string
String representation.
Operators
operator ==(MySqlDataType?, MySqlDataType?)
Checks if a
is equal to b
.
[Pure]
public static bool operator ==(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when operands are equal, otherwise false.
operator >(MySqlDataType?, MySqlDataType?)
Checks if a
is greater than b
.
[Pure]
public static bool operator >(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when
a
is greater thanb
, otherwise false.
operator >=(MySqlDataType?, MySqlDataType?)
Checks if a
is greater than or equal to b
.
[Pure]
public static bool operator >=(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when
a
is greater than or equal tob
, otherwise false.
implicit operator MySqlDbType(MySqlDataType)
Converts this instance to the underlying value type. Returns Value of t
.
[Pure]
public static implicit operator MySqlDbType(MySqlDataType t)
Parameters
t
MySqlDataTypeData type to convert.
Returns
- MySqlDbType
Value of
t
.
operator !=(MySqlDataType?, MySqlDataType?)
Checks if a
is not equal to b
.
[Pure]
public static bool operator !=(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when operands are not equal, otherwise false.
operator <(MySqlDataType?, MySqlDataType?)
Checks if a
is less than b
.
[Pure]
public static bool operator <(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when
a
is less thanb
, otherwise false.
operator <=(MySqlDataType?, MySqlDataType?)
Checks if a
is less than or equal to b
.
[Pure]
public static bool operator <=(MySqlDataType? a, MySqlDataType? b)
Parameters
a
MySqlDataTypeFirst operand.
b
MySqlDataTypeSecond operand.
Returns
- bool
true when
a
is less than or equal tob
, otherwise false.