System\Data\Common\DataStorage.cs (106)
116internal readonly StorageType _storageTypeCode;
130protected DataStorage(DataColumn column, Type type, object? defaultValue, StorageType storageType)
135protected DataStorage(DataColumn column, Type type, object? defaultValue, object nullValue, StorageType storageType)
140protected DataStorage(DataColumn column, Type type, object? defaultValue, object nullValue, bool isICloneable, StorageType storageType)
151_isStringType = ((StorageType.String == _storageTypeCode) || (StorageType.SqlString == _storageTypeCode));
295public static DataStorage CreateStorage(DataColumn column, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType, StorageType typeCode)
298if ((StorageType.Empty == typeCode) && (null != dataType))
312case StorageType.Empty: throw ExceptionBuilder.InvalidStorageType(TypeCode.Empty);
313case StorageType.DBNull: throw ExceptionBuilder.InvalidStorageType((TypeCode)2); // TypeCode.DBNull);
314case StorageType.Object: return new ObjectStorage(column, dataType!);
315case StorageType.Boolean: return new BooleanStorage(column);
316case StorageType.Char: return new CharStorage(column);
317case StorageType.SByte: return new SByteStorage(column);
318case StorageType.Byte: return new ByteStorage(column);
319case StorageType.Int16: return new Int16Storage(column);
320case StorageType.UInt16: return new UInt16Storage(column);
321case StorageType.Int32: return new Int32Storage(column);
322case StorageType.UInt32: return new UInt32Storage(column);
323case StorageType.Int64: return new Int64Storage(column);
324case StorageType.UInt64: return new UInt64Storage(column);
325case StorageType.Single: return new SingleStorage(column);
326case StorageType.Double: return new DoubleStorage(column);
327case StorageType.Decimal: return new DecimalStorage(column);
328case StorageType.DateTime: return new DateTimeStorage(column);
329case StorageType.TimeSpan: return new TimeSpanStorage(column);
330case StorageType.String: return new StringStorage(column);
331case StorageType.Guid: return new ObjectStorage(column, dataType!);
333case StorageType.ByteArray: return new ObjectStorage(column, dataType!);
334case StorageType.CharArray: return new ObjectStorage(column, dataType!);
335case StorageType.Type: return new ObjectStorage(column, dataType!);
336case StorageType.DateTimeOffset: return new DateTimeOffsetStorage(column);
337case StorageType.BigInteger: return new BigIntegerStorage(column);
338case StorageType.Uri: return new ObjectStorage(column, dataType!);
340case StorageType.SqlBinary: return new SqlBinaryStorage(column);
341case StorageType.SqlBoolean: return new SqlBooleanStorage(column);
342case StorageType.SqlByte: return new SqlByteStorage(column);
343case StorageType.SqlBytes: return new SqlBytesStorage(column);
344case StorageType.SqlChars: return new SqlCharsStorage(column);
345case StorageType.SqlDateTime: return new SqlDateTimeStorage(column);
346case StorageType.SqlDecimal: return new SqlDecimalStorage(column);
347case StorageType.SqlDouble: return new SqlDoubleStorage(column);
348case StorageType.SqlGuid: return new SqlGuidStorage(column);
349case StorageType.SqlInt16: return new SqlInt16Storage(column);
350case StorageType.SqlInt32: return new SqlInt32Storage(column);
351case StorageType.SqlInt64: return new SqlInt64Storage(column);
352case StorageType.SqlMoney: return new SqlMoneyStorage(column);
353case StorageType.SqlSingle: return new SqlSingleStorage(column);
354case StorageType.SqlString: return new SqlStringStorage(column);
358goto case StorageType.Object;
362internal static StorageType GetStorageType(Type? dataType)
368return (StorageType)i;
374return (StorageType)tcode;
376return StorageType.Empty;
379internal static Type GetTypeStorage(StorageType storageType)
381Debug.Assert(storageType != StorageType.Empty);
390internal static bool IsTypeCustomType(StorageType typeCode)
392return ((StorageType.Object == typeCode) || (StorageType.Empty == typeCode) || (StorageType.CharArray == typeCode));
395internal static bool IsSqlType(StorageType storageType)
397return (StorageType.SqlBinary <= storageType);
402for (int i = (int)StorageType.SqlBinary; i < s_storageClassType.Length; ++i)
412private static bool DetermineIfValueType(StorageType typeCode, Type dataType)
417case StorageType.Boolean:
418case StorageType.Char:
419case StorageType.SByte:
420case StorageType.Byte:
421case StorageType.Int16:
422case StorageType.UInt16:
423case StorageType.Int32:
424case StorageType.UInt32:
425case StorageType.Int64:
426case StorageType.UInt64:
427case StorageType.Single:
428case StorageType.Double:
429case StorageType.Decimal:
430case StorageType.DateTime:
431case StorageType.DateTimeOffset:
432case StorageType.BigInteger:
433case StorageType.TimeSpan:
434case StorageType.Guid:
435case StorageType.SqlBinary:
436case StorageType.SqlBoolean:
437case StorageType.SqlByte:
438case StorageType.SqlDateTime:
439case StorageType.SqlDecimal:
440case StorageType.SqlDouble:
441case StorageType.SqlGuid:
442case StorageType.SqlInt16:
443case StorageType.SqlInt32:
444case StorageType.SqlInt64:
445case StorageType.SqlMoney:
446case StorageType.SqlSingle:
447case StorageType.SqlString:
451case StorageType.String:
452case StorageType.ByteArray:
453case StorageType.CharArray:
454case StorageType.Type:
455case StorageType.Uri:
456case StorageType.SqlBytes:
457case StorageType.SqlChars:
470StorageType typeCode,
487else if (StorageType.Empty != typeCode)
522internal static bool ImplementsINullableValue(StorageType typeCode, Type dataType)
525return ((StorageType.Empty == typeCode) && dataType.IsGenericType && (dataType.GetGenericTypeDefinition() == typeof(System.Nullable<>)));
System\Data\Common\SQLConvert.cs (258)
20StorageType stype = DataStorage.GetStorageType(valueType);
24StorageType.SqlByte => (SqlByte)value,
25StorageType.Byte => (byte)value,
38StorageType stype = DataStorage.GetStorageType(valueType);
41StorageType.Byte => (byte)value,
42StorageType.Int16 => (short)value,
43StorageType.SqlByte => (SqlByte)value,
44StorageType.SqlInt16 => (SqlInt16)value,
57StorageType stype = DataStorage.GetStorageType(valueType);
60StorageType.SqlInt32 => (SqlInt32)value,
61StorageType.Int32 => (int)value,
62StorageType.SqlInt16 => (SqlInt16)value,
63StorageType.Int16 => (short)value,
64StorageType.UInt16 => (ushort)value,
65StorageType.SqlByte => (SqlByte)value,
66StorageType.Byte => (byte)value,
80StorageType stype = DataStorage.GetStorageType(valueType);
83StorageType.SqlInt64 => (SqlInt64)value,
84StorageType.Int64 => (long)value,
85StorageType.SqlInt16 => (SqlInt16)value,
86StorageType.Int16 => (short)value,
87StorageType.UInt16 => (ushort)value,
88StorageType.SqlInt32 => (SqlInt32)value,
89StorageType.Int32 => (int)value,
90StorageType.UInt32 => (uint)value,
91StorageType.SqlByte => (SqlByte)value,
92StorageType.Byte => (byte)value,
105StorageType stype = DataStorage.GetStorageType(valueType);
109StorageType.SqlDouble => (SqlDouble)value,
110StorageType.Double => (double)value,
111StorageType.SqlInt64 => (SqlInt64)value,
112StorageType.Int64 => (long)value,
113StorageType.UInt64 => (ulong)value,
114StorageType.SqlInt16 => (SqlInt16)value,
115StorageType.Int16 => (short)value,
116StorageType.UInt16 => (ushort)value,
117StorageType.SqlInt32 => (SqlInt32)value,
118StorageType.Int32 => (int)value,
119StorageType.UInt32 => (uint)value,
120StorageType.SqlByte => (SqlByte)value,
121StorageType.Byte => (byte)value,
122StorageType.SqlSingle => (SqlSingle)value,
123StorageType.Single => (float)value,
124StorageType.SqlMoney => (SqlMoney)value,
125StorageType.SqlDecimal => (SqlDecimal)value,
138StorageType stype = DataStorage.GetStorageType(valueType);
142StorageType.SqlDecimal => (SqlDecimal)value,
143StorageType.Decimal => (decimal)value,
144StorageType.SqlInt64 => (SqlInt64)value,
145StorageType.Int64 => (long)value,
146StorageType.UInt64 => (ulong)value,
147StorageType.SqlInt16 => (SqlInt16)value,
148StorageType.Int16 => (short)value,
149StorageType.UInt16 => (ushort)value,
150StorageType.SqlInt32 => (SqlInt32)value,
151StorageType.Int32 => (int)value,
152StorageType.UInt32 => (uint)value,
153StorageType.SqlByte => (SqlByte)value,
154StorageType.Byte => (byte)value,
155StorageType.SqlMoney => (SqlMoney)value,
168StorageType stype = DataStorage.GetStorageType(valueType);
172StorageType.SqlSingle => (SqlSingle)value,
173StorageType.Single => (float)value,
174StorageType.SqlInt64 => (SqlInt64)value,
175StorageType.Int64 => (long)value,
176StorageType.UInt64 => (ulong)value,
177StorageType.SqlInt16 => (SqlInt16)value,
178StorageType.Int16 => (short)value,
179StorageType.UInt16 => (ushort)value,
180StorageType.SqlInt32 => (SqlInt32)value,
181StorageType.Int32 => (int)value,
182StorageType.UInt32 => (uint)value,
183StorageType.SqlByte => (SqlByte)value,
184StorageType.Byte => (byte)value,
185StorageType.SqlMoney => (SqlMoney)value,
186StorageType.SqlDecimal => (SqlDecimal)value,
199StorageType stype = DataStorage.GetStorageType(valueType);
203StorageType.SqlMoney => (SqlMoney)value,
204StorageType.Decimal => (decimal)value,
205StorageType.SqlInt64 => (SqlInt64)value,
206StorageType.Int64 => (long)value,
207StorageType.UInt64 => (ulong)value,
208StorageType.SqlInt16 => (SqlInt16)value,
209StorageType.Int16 => (short)value,
210StorageType.UInt16 => (ushort)value,
211StorageType.SqlInt32 => (SqlInt32)value,
212StorageType.Int32 => (int)value,
213StorageType.UInt32 => (uint)value,
214StorageType.SqlByte => (SqlByte)value,
215StorageType.Byte => (byte)value,
229StorageType stype = DataStorage.GetStorageType(valueType);
233StorageType.SqlDateTime => (SqlDateTime)value,
234StorageType.DateTime => (DateTime)value,
247StorageType stype = DataStorage.GetStorageType(valueType);
251StorageType.SqlBoolean => (SqlBoolean)value,
252StorageType.Boolean => (bool)value,
265StorageType stype = DataStorage.GetStorageType(valueType);
269StorageType.SqlGuid => (SqlGuid)value,
270StorageType.Guid => (Guid)value,
283StorageType stype = DataStorage.GetStorageType(valueType);
287StorageType.SqlBinary => (SqlBinary)value,
288StorageType.ByteArray => (byte[])value,
301StorageType stype = DataStorage.GetStorageType(valueType);
305StorageType.SqlString => (SqlString)value,
306StorageType.String => (string)value,
319StorageType stype = DataStorage.GetStorageType(valueType);
322StorageType.SqlChars => (SqlChars)value,
335StorageType stype = DataStorage.GetStorageType(valueType);
338StorageType.SqlBytes => (SqlBytes)value,
364public static object ChangeType2(object value, StorageType stype, Type type, IFormatProvider formatProvider)
368case StorageType.SqlBinary:
370case StorageType.SqlBoolean:
372case StorageType.SqlByte:
374case StorageType.SqlBytes:
376case StorageType.SqlChars:
378case StorageType.SqlDateTime:
380case StorageType.SqlDecimal:
382case StorageType.SqlDouble:
384case StorageType.SqlGuid:
386case StorageType.SqlInt16:
388case StorageType.SqlInt32:
390case StorageType.SqlInt64:
392case StorageType.SqlMoney:
394case StorageType.SqlSingle:
396case StorageType.SqlString:
410StorageType vtype = DataStorage.GetStorageType(valueType);
414case StorageType.SqlBinary:
415case StorageType.SqlBoolean:
416case StorageType.SqlByte:
417case StorageType.SqlBytes:
418case StorageType.SqlChars:
419case StorageType.SqlDateTime:
420case StorageType.SqlDecimal:
421case StorageType.SqlDouble:
422case StorageType.SqlGuid:
423case StorageType.SqlInt16:
424case StorageType.SqlInt32:
425case StorageType.SqlInt64:
426case StorageType.SqlMoney:
427case StorageType.SqlSingle:
428case StorageType.SqlString:
431if (StorageType.String == stype)
435case StorageType.Boolean:
437case StorageType.Char:
439case StorageType.SByte:
441case StorageType.Byte:
443case StorageType.Int16:
445case StorageType.UInt16:
447case StorageType.Int32:
449case StorageType.UInt32:
451case StorageType.Int64:
453case StorageType.UInt64:
455case StorageType.Single:
457case StorageType.Double:
459case StorageType.Decimal:
461case StorageType.DateTime:
464case StorageType.TimeSpan:
466case StorageType.Guid:
468case StorageType.String:
470case StorageType.CharArray:
472case StorageType.DateTimeOffset:
474case StorageType.BigInteger:
491else if (StorageType.TimeSpan == stype)
496StorageType.String => XmlConvert.ToTimeSpan((string)value),
497StorageType.Int32 => new TimeSpan((int)value),
498StorageType.Int64 => new TimeSpan((long)value),
502else if (StorageType.DateTimeOffset == stype)
506else if (StorageType.String == vtype)
510case StorageType.String:
512case StorageType.Boolean:
516case StorageType.Char:
518case StorageType.SByte:
520case StorageType.Byte:
522case StorageType.Int16:
524case StorageType.UInt16:
526case StorageType.Int32:
528case StorageType.UInt32:
530case StorageType.Int64:
532case StorageType.UInt64:
534case StorageType.Single:
536case StorageType.Double:
538case StorageType.Decimal:
540case StorageType.DateTime:
543case StorageType.TimeSpan:
545case StorageType.Guid:
547case StorageType.Uri:
562StorageType destinationType = DataStorage.GetStorageType(type);
564StorageType vtype = DataStorage.GetStorageType(valueType);
568case StorageType.SqlBinary:
570case StorageType.SqlBoolean:
572case StorageType.SqlByte:
574case StorageType.SqlBytes:
576case StorageType.SqlChars:
578case StorageType.SqlDateTime:
580case StorageType.SqlDecimal:
582case StorageType.SqlDouble:
584case StorageType.SqlGuid:
586case StorageType.SqlInt16:
588case StorageType.SqlInt32:
590case StorageType.SqlInt64:
592case StorageType.SqlMoney:
594case StorageType.SqlSingle:
596case StorageType.SqlString:
603case StorageType.Boolean:
607case StorageType.Char:
609case StorageType.SByte:
611case StorageType.Byte:
613case StorageType.Int16:
615case StorageType.UInt16:
617case StorageType.Int32:
619case StorageType.UInt32:
621case StorageType.Int64:
623case StorageType.UInt64:
625case StorageType.Single:
627case StorageType.Double:
629case StorageType.Decimal:
631case StorageType.DateTime:
633case StorageType.Guid:
635case StorageType.Uri:
637case StorageType.DateTimeOffset:
639case StorageType.TimeSpan:
642StorageType.String => XmlConvert.ToTimeSpan((string)value),
643StorageType.Int32 => new TimeSpan((int)value),
644StorageType.Int64 => new TimeSpan((long)value),
656case StorageType.SqlBinary:
658case StorageType.SqlBoolean:
660case StorageType.SqlByte:
662case StorageType.SqlBytes:
664case StorageType.SqlChars:
666case StorageType.SqlDateTime:
668case StorageType.SqlDecimal:
670case StorageType.SqlDouble:
672case StorageType.SqlGuid:
674case StorageType.SqlInt16:
676case StorageType.SqlInt32:
678case StorageType.SqlInt64:
680case StorageType.SqlMoney:
682case StorageType.SqlSingle:
684case StorageType.SqlString:
686case StorageType.Boolean:
688case StorageType.Char:
690case StorageType.SByte:
692case StorageType.Byte:
694case StorageType.Int16:
696case StorageType.UInt16:
698case StorageType.Int32:
700case StorageType.UInt32:
702case StorageType.Int64:
704case StorageType.UInt64:
706case StorageType.Single:
708case StorageType.Double:
710case StorageType.Decimal:
712case StorageType.DateTime:
714case StorageType.TimeSpan:
716case StorageType.Guid:
718case StorageType.String:
720case StorageType.CharArray:
722case StorageType.DateTimeOffset:
System\Data\Filter\BinaryNode.cs (284)
161internal int BinaryCompare(object vLeft, object vRight, StorageType resultType, int op)
166internal int BinaryCompare(object vLeft, object vRight, StorageType resultType, int op, CompareInfo? comparer)
175case StorageType.SByte:
176case StorageType.Int16:
177case StorageType.Int32:
178case StorageType.Byte:
179case StorageType.UInt16:
181case StorageType.Int64:
182case StorageType.UInt32:
183case StorageType.UInt64:
184case StorageType.Decimal:
186case StorageType.Char:
188case StorageType.Double:
190case StorageType.Single:
192case StorageType.DateTime:
194case StorageType.DateTimeOffset:
197case StorageType.String:
199case StorageType.Guid:
201case StorageType.Boolean:
214case StorageType.SByte:
215case StorageType.Int16:
216case StorageType.Int32:
217case StorageType.Byte:
218case StorageType.UInt16:
219case StorageType.SqlByte:
220case StorageType.SqlInt16:
221case StorageType.SqlInt32:
223case StorageType.Int64:
224case StorageType.UInt32:
225case StorageType.SqlInt64:
227case StorageType.UInt64:
228case StorageType.SqlDecimal:
230case StorageType.SqlDouble:
232case StorageType.SqlSingle:
234case StorageType.SqlString:
236case StorageType.SqlGuid:
238case StorageType.SqlBoolean:
249case StorageType.SqlBinary:
251case StorageType.SqlDateTime:
253case StorageType.SqlMoney:
287StorageType resultType;
304StorageType leftStorage = DataStorage.GetStorageType(typeofLeft);
305StorageType rightStorage = DataStorage.GetStorageType(typeofRight);
333if (StorageType.Empty == resultType)
341resultType = StorageType.Empty; // shouldn't we make it boolean?
354case StorageType.Byte:
359case StorageType.SByte:
364case StorageType.Int16:
369case StorageType.UInt16:
374case StorageType.Int32:
379case StorageType.UInt32:
384case StorageType.UInt64:
389case StorageType.Int64:
394case StorageType.Decimal:
399case StorageType.Single:
404case StorageType.Double:
409case StorageType.String:
410case StorageType.Char:
415case StorageType.DateTime:
433case StorageType.TimeSpan:
438case StorageType.SqlInt16:
443case StorageType.SqlInt32:
448case StorageType.SqlInt64:
453case StorageType.SqlDouble:
458case StorageType.SqlSingle:
463case StorageType.SqlDecimal:
468case StorageType.SqlMoney:
473case StorageType.SqlByte:
478case StorageType.SqlString:
483case StorageType.SqlDateTime:
512case StorageType.Byte:
517case StorageType.SqlByte:
522case StorageType.SByte:
527case StorageType.Int16:
532case StorageType.SqlInt16:
537case StorageType.UInt16:
542case StorageType.Int32:
547case StorageType.SqlInt32:
552case StorageType.UInt32:
557case StorageType.Int64:
562case StorageType.SqlInt64:
567case StorageType.UInt64:
572case StorageType.Decimal:
577case StorageType.SqlDecimal:
582case StorageType.Single:
587case StorageType.SqlSingle:
592case StorageType.Double:
597case StorageType.SqlDouble:
602case StorageType.SqlMoney:
607case StorageType.DateTime:
612case StorageType.TimeSpan:
622case StorageType.SqlDateTime:
651case StorageType.Byte:
656case StorageType.SqlByte:
661case StorageType.SByte:
666case StorageType.Int16:
671case StorageType.SqlInt16:
676case StorageType.UInt16:
681case StorageType.Int32:
686case StorageType.SqlInt32:
691case StorageType.UInt32:
696case StorageType.Int64:
701case StorageType.SqlInt64:
706case StorageType.UInt64:
711case StorageType.Decimal:
716case StorageType.SqlDecimal:
721case StorageType.Single:
726case StorageType.SqlSingle:
731case StorageType.SqlMoney:
736case StorageType.Double:
741case StorageType.SqlDouble:
757case StorageType.Byte:
762case StorageType.SqlByte:
767case StorageType.SByte:
772case StorageType.Int16:
777case StorageType.SqlInt16:
782case StorageType.UInt16:
787case StorageType.Int32:
792case StorageType.SqlInt32:
797case StorageType.UInt32:
802case StorageType.UInt64:
807case StorageType.Int64:
812case StorageType.SqlInt64:
817case StorageType.Decimal:
822case StorageType.SqlDecimal:
827case StorageType.Single:
832case StorageType.SqlSingle:
837case StorageType.SqlMoney:
842case StorageType.Double:
848case StorageType.SqlDouble:
1044if (resultType == StorageType.UInt64)
1052if (resultType == StorageType.SqlInt32)
1056else if (resultType == StorageType.SqlInt16)
1060else if (resultType == StorageType.SqlByte)
1182private static DataTypePrecedence GetPrecedence(StorageType storageType)
1186case StorageType.Boolean: return DataTypePrecedence.Boolean;
1187case StorageType.Char: return DataTypePrecedence.Char;
1188case StorageType.SByte: return DataTypePrecedence.SByte;
1189case StorageType.Byte: return DataTypePrecedence.Byte;
1190case StorageType.Int16: return DataTypePrecedence.Int16;
1191case StorageType.UInt16: return DataTypePrecedence.UInt16;
1192case StorageType.Int32: return DataTypePrecedence.Int32;
1193case StorageType.UInt32: return DataTypePrecedence.UInt32;
1194case StorageType.Int64: return DataTypePrecedence.Int64;
1195case StorageType.UInt64: return DataTypePrecedence.UInt64;
1196case StorageType.Single: return DataTypePrecedence.Single;
1197case StorageType.Double: return DataTypePrecedence.Double;
1198case StorageType.Decimal: return DataTypePrecedence.Decimal;
1199case StorageType.DateTime: return DataTypePrecedence.DateTime;
1200case StorageType.DateTimeOffset: return DataTypePrecedence.DateTimeOffset;
1201case StorageType.TimeSpan: return DataTypePrecedence.TimeSpan;
1202case StorageType.String: return DataTypePrecedence.String;
1203case StorageType.SqlBinary: return DataTypePrecedence.SqlBinary;
1204case StorageType.SqlBoolean: return DataTypePrecedence.SqlBoolean;
1205case StorageType.SqlByte: return DataTypePrecedence.SqlByte;
1206case StorageType.SqlBytes: return DataTypePrecedence.SqlBytes;
1207case StorageType.SqlChars: return DataTypePrecedence.SqlChars;
1208case StorageType.SqlDateTime: return DataTypePrecedence.SqlDateTime;
1209case StorageType.SqlDecimal: return DataTypePrecedence.SqlDecimal;
1210case StorageType.SqlDouble: return DataTypePrecedence.SqlDouble;
1211case StorageType.SqlGuid: return DataTypePrecedence.SqlGuid;
1212case StorageType.SqlInt16: return DataTypePrecedence.SqlInt16;
1213case StorageType.SqlInt32: return DataTypePrecedence.SqlInt32;
1214case StorageType.SqlInt64: return DataTypePrecedence.SqlInt64;
1215case StorageType.SqlMoney: return DataTypePrecedence.SqlMoney;
1216case StorageType.SqlSingle: return DataTypePrecedence.SqlSingle;
1217case StorageType.SqlString: return DataTypePrecedence.SqlString;
1219case StorageType.Empty:
1220case StorageType.Object:
1221case StorageType.DBNull:
1226private static StorageType GetPrecedenceType(DataTypePrecedence code)
1230case DataTypePrecedence.Error: return StorageType.Empty;
1231case DataTypePrecedence.SByte: return StorageType.SByte;
1232case DataTypePrecedence.Byte: return StorageType.Byte;
1233case DataTypePrecedence.Int16: return StorageType.Int16;
1234case DataTypePrecedence.UInt16: return StorageType.UInt16;
1235case DataTypePrecedence.Int32: return StorageType.Int32;
1236case DataTypePrecedence.UInt32: return StorageType.UInt32;
1237case DataTypePrecedence.Int64: return StorageType.Int64;
1238case DataTypePrecedence.UInt64: return StorageType.UInt64;
1239case DataTypePrecedence.Decimal: return StorageType.Decimal;
1240case DataTypePrecedence.Single: return StorageType.Single;
1241case DataTypePrecedence.Double: return StorageType.Double;
1243case DataTypePrecedence.Boolean: return StorageType.Boolean;
1244case DataTypePrecedence.String: return StorageType.String;
1245case DataTypePrecedence.Char: return StorageType.Char;
1247case DataTypePrecedence.DateTimeOffset: return StorageType.DateTimeOffset;
1248case DataTypePrecedence.DateTime: return StorageType.DateTime;
1249case DataTypePrecedence.TimeSpan: return StorageType.TimeSpan;
1251case DataTypePrecedence.SqlDateTime: return StorageType.SqlDateTime;
1252case DataTypePrecedence.SqlDouble: return StorageType.SqlDouble;
1253case DataTypePrecedence.SqlSingle: return StorageType.SqlSingle;
1254case DataTypePrecedence.SqlDecimal: return StorageType.SqlDecimal;
1255case DataTypePrecedence.SqlInt64: return StorageType.SqlInt64;
1256case DataTypePrecedence.SqlInt32: return StorageType.SqlInt32;
1257case DataTypePrecedence.SqlInt16: return StorageType.SqlInt16;
1258case DataTypePrecedence.SqlByte: return StorageType.SqlByte;
1259case DataTypePrecedence.SqlBoolean: return StorageType.SqlBoolean;
1260case DataTypePrecedence.SqlString: return StorageType.SqlString;
1261case DataTypePrecedence.SqlGuid: return StorageType.SqlGuid;
1262case DataTypePrecedence.SqlBinary: return StorageType.SqlBinary;
1263case DataTypePrecedence.SqlMoney: return StorageType.SqlMoney;
1270private static bool IsMixed(StorageType left, StorageType right)
1276private static bool IsMixedSql(StorageType left, StorageType right)
1282internal static StorageType ResultType(StorageType left, StorageType right, bool lc, bool rc, int op)
1284if ((left == StorageType.Guid) && (right == StorageType.Guid) && Operators.IsRelational(op))
1286if ((left == StorageType.String) && (right == StorageType.Guid) && Operators.IsRelational(op))
1288if ((left == StorageType.Guid) && (right == StorageType.String) && Operators.IsRelational(op))
1294return StorageType.Empty;
1300return StorageType.Empty;
1305if (left == StorageType.Boolean && right == StorageType.Boolean)
1306return StorageType.Boolean;
1308return StorageType.Empty;
1310if ((left == StorageType.DateTimeOffset) || (right == StorageType.DateTimeOffset))
1315if (Operators.IsRelational(op) && left == StorageType.DateTimeOffset && right == StorageType.DateTimeOffset)
1316return StorageType.DateTimeOffset;
1317return StorageType.Empty;
1320if ((op == Operators.Plus) && ((left == StorageType.String) || (right == StorageType.String)))
1321return StorageType.String;
1325StorageType result = GetPrecedenceType(higherPrec);
1329if (result != StorageType.String && result != StorageType.Char)
1332return StorageType.Empty;
1334return StorageType.Empty;
1342return StorageType.Double;
1372internal static StorageType ResultSqlType(StorageType left, StorageType right, int op)
1377return StorageType.Empty;
1383return StorageType.Empty;
1388if ((left != StorageType.Boolean && left != StorageType.SqlBoolean) || (right != StorageType.Boolean && right != StorageType.SqlBoolean))
1389return StorageType.Empty;
1390if (left == StorageType.Boolean && right == StorageType.Boolean)
1391return StorageType.Boolean;
1392return StorageType.SqlBoolean;
1397if ((left == StorageType.SqlString) || (right == StorageType.SqlString))
1398return StorageType.SqlString;
1399if ((left == StorageType.String) || (right == StorageType.String))
1400return StorageType.String;
1403if ((left == StorageType.SqlBinary && right != StorageType.SqlBinary) || (left != StorageType.SqlBinary && right == StorageType.SqlBinary))
1404return StorageType.Empty;
1406if ((left == StorageType.SqlGuid && right != StorageType.SqlGuid) || (left != StorageType.SqlGuid && right == StorageType.SqlGuid))
1407return StorageType.Empty;
1411return StorageType.Empty;
1416return StorageType.Empty;
1423if (left == StorageType.TimeSpan)
1425if (right == StorageType.TimeSpan)
1427return StorageType.Empty; // for plus or minus operations for time types, one of them MUST be time span
1431return StorageType.Empty; // we just have relational operations amoung time types
1439StorageType result;
1445if (result != StorageType.String && result != StorageType.Char && result != StorageType.SqlString)
1448return StorageType.Empty;
1450return StorageType.Empty;
1457return StorageType.SqlDouble;
1460if (result == StorageType.SqlMoney)
1462if ((left != StorageType.SqlMoney) && (right != StorageType.SqlMoney))
1463result = StorageType.SqlDecimal;
1550string rightStr = (string)SqlConvert.ChangeType2(vRight, StorageType.String, typeof(string), FormatProvider);
System\Data\Filter\FunctionNode.cs (17)
317StorageType storageType;
337StorageType.Boolean => (bool)argumentValues[0],
338StorageType.Int32 => ((int)argumentValues[0] != 0),
339StorageType.Double => ((double)argumentValues[0] != 0.0),
340StorageType.String => bool.Parse((string)argumentValues[0]),
487StorageType mytype = DataStorage.GetStorageType(type);
490if (mytype == StorageType.DateTimeOffset)
492if (storageType == StorageType.String)
498if (StorageType.Object != mytype)
500if ((mytype == StorageType.Guid) && (storageType == StorageType.String))
505if (StorageType.Single == storageType)
507return SqlConvert.ChangeType2((float)SqlConvert.ChangeType2(argumentValues[0], StorageType.Single, typeof(float), FormatProvider), mytype, type, FormatProvider);
509else if (StorageType.Double == storageType)
511return SqlConvert.ChangeType2((double)SqlConvert.ChangeType2(argumentValues[0], StorageType.Double, typeof(double), FormatProvider), mytype, type, FormatProvider);
513else if (StorageType.Decimal == storageType)
515return SqlConvert.ChangeType2((decimal)SqlConvert.ChangeType2(argumentValues[0], StorageType.Decimal, typeof(decimal), FormatProvider), mytype, type, FormatProvider);