Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertToSqlDecimal()

static SqlDecimal System.Data.Common.SqlConvert.ConvertToSqlDecimal ( object value)
inlinestatic

Definition at line 115 of file SqlConvert.cs.

116 {
117 if (value == DBNull.Value)
118 {
119 return SqlDecimal.Null;
120 }
121 Type type = value.GetType();
122 return DataStorage.GetStorageType(type) switch
123 {
125 StorageType.Decimal => (decimal)value,
127 StorageType.Int64 => (long)value,
128 StorageType.UInt64 => (ulong)value,
129 StorageType.SqlInt16 => (SqlInt16)value,
131 StorageType.UInt16 => (ushort)value,
133 StorageType.Int32 => (int)value,
134 StorageType.UInt32 => (uint)value,
135 StorageType.SqlByte => (SqlByte)value,
136 StorageType.Byte => (byte)value,
137 StorageType.SqlMoney => (SqlMoney)value,
138 _ => throw ExceptionBuilder.ConvertFailed(type, typeof(SqlDecimal)),
139 };
140 }
static readonly SqlDecimal Null
Definition SqlDecimal.cs:66

References System.Data.ExceptionBuilder.ConvertFailed(), System.Xml.Dictionary, System.Data.Common.DataStorage.GetStorageType(), System.Type.GetType(), System.Data.SqlTypes.SqlDecimal.Null, System.Data.Common.SqlDecimal, System.Data.Common.SqlInt32, System.Data.Common.SqlInt64, System.type, System.DBNull.Value, and System.value.

Referenced by System.Data.BinaryNode.BinaryCompare(), System.Data.Common.SqlConvert.ChangeType2(), System.Data.Common.SqlDecimalStorage.ConvertValue(), System.Data.BinaryNode.EvalBinaryOp(), and System.Data.Common.SqlDecimalStorage.Set().