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

◆ ConvertToSqlSingle()

static SqlSingle System.Data.Common.SqlConvert.ConvertToSqlSingle ( object value)
inlinestatic

Definition at line 142 of file SqlConvert.cs.

143 {
144 if (value == DBNull.Value)
145 {
146 return SqlSingle.Null;
147 }
148 Type type = value.GetType();
149 return DataStorage.GetStorageType(type) switch
150 {
152 StorageType.Single => (float)value,
154 StorageType.Int64 => (long)value,
155 StorageType.UInt64 => (ulong)value,
156 StorageType.SqlInt16 => (SqlInt16)value,
158 StorageType.UInt16 => (int)(ushort)value,
159 StorageType.SqlInt32 => (SqlInt32)value,
160 StorageType.Int32 => (int)value,
161 StorageType.UInt32 => (uint)value,
163 StorageType.Byte => (int)(byte)value,
164 StorageType.SqlMoney => (SqlMoney)value,
166 _ => throw ExceptionBuilder.ConvertFailed(type, typeof(SqlSingle)),
167 };
168 }
static readonly SqlSingle Null
Definition SqlSingle.cs:17

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

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