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

◆ ConvertToSqlInt32()

static SqlInt32 System.Data.Common.SqlConvert.ConvertToSqlInt32 ( object value)
inlinestatic

Definition at line 42 of file SqlConvert.cs.

43 {
44 if (value == DBNull.Value)
45 {
46 return SqlInt32.Null;
47 }
48 Type type = value.GetType();
49 return DataStorage.GetStorageType(type) switch
50 {
52 StorageType.Int32 => (int)value,
54 StorageType.Int16 => (short)value,
55 StorageType.UInt16 => (ushort)value,
56 StorageType.SqlByte => (SqlByte)value,
57 StorageType.Byte => (byte)value,
58 _ => throw ExceptionBuilder.ConvertFailed(type, typeof(SqlInt32)),
59 };
60 }
static readonly SqlInt32 Null
Definition SqlInt32.cs:19

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

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