DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
NumericType.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.IO;
19 using System.Text;
20 
22 using Deveel.Data.Sql.Objects;
23 using Deveel.Math;
24 
25 namespace Deveel.Data.Types {
26  [Serializable]
27  public sealed class NumericType : SqlType, ISizeableType {
28  public NumericType(SqlTypeCode typeCode, int size, byte scale)
29  : base("NUMERIC", typeCode) {
30  AssertIsNumeric(typeCode);
31  Size = size;
32  Scale = scale;
33  }
34 
35  public NumericType(SqlTypeCode typeCode)
36  : this(typeCode, -1) {
37  }
38 
39  public NumericType(SqlTypeCode typeCode, int size)
40  : this(typeCode, size, 0) {
41  }
42 
43  private NumericType(ObjectData data)
44  : base(data) {
45  Size = data.GetInt32("Size");
46  Scale = data.GetByte("Scale");
47  }
48 
49  public int Size { get; private set; }
50 
51  public byte Scale { get; private set; }
52 
53  public override bool IsStorable {
54  get { return true; }
55  }
56 
57  protected override void GetData(SerializeData data) {
58  data.SetValue("Size", Size);
59  data.SetValue("Scale", Scale);
60  }
61 
62  public override bool Equals(object obj) {
63  var other = obj as NumericType;
64  if (other == null)
65  return false;
66 
67  return TypeCode == other.TypeCode &&
68  Size == other.Size &&
69  Scale == other.Scale;
70  }
71 
72  public override Type GetObjectType() {
73  return typeof(SqlNumber);
74  }
75 
76  public override Type GetRuntimeType() {
77  if (TypeCode == SqlTypeCode.TinyInt)
78  return typeof(byte);
79  if (TypeCode == SqlTypeCode.SmallInt)
80  return typeof(short);
81  if (TypeCode == SqlTypeCode.Integer)
82  return typeof(int);
83  if (TypeCode == SqlTypeCode.BigInt)
84  return typeof(long);
85  if (TypeCode == SqlTypeCode.Float ||
86  TypeCode == SqlTypeCode.Real)
87  return typeof(float);
88  if (TypeCode == SqlTypeCode.Double)
89  return typeof(double);
90  if (TypeCode == SqlTypeCode.Numeric ||
91  TypeCode == SqlTypeCode.Decimal)
92  return typeof(BigDecimal);
93 
94  return base.GetRuntimeType();
95  }
96 
97  public override bool IsCacheable(ISqlObject value) {
98  return value is SqlNumber || value is SqlNull;
99  }
100 
101  public override int GetHashCode() {
102  return (TypeCode.GetHashCode() * Scale) + Size.GetHashCode();
103  }
104 
105  private static void AssertIsNumeric(SqlTypeCode typeCode) {
106  if (!IsNumericType(typeCode))
107  throw new ArgumentException(String.Format("The type '{0}' is not a valid NUMERIC type.", typeCode));
108  }
109 
110  private static int GetIntSize(SqlTypeCode sqlType) {
111  switch (sqlType) {
112  case SqlTypeCode.TinyInt:
113  return 1;
114  case SqlTypeCode.SmallInt:
115  return 2;
116  case SqlTypeCode.Integer:
117  return 4;
118  case SqlTypeCode.BigInt:
119  return 8;
120  default:
121  return 0;
122  }
123  }
124 
125 
126  private static int GetFloatSize(SqlTypeCode sqlType) {
127  switch (sqlType) {
128  default:
129  return 0;
130  case SqlTypeCode.Real:
131  return 4;
132  case SqlTypeCode.Float:
133  case SqlTypeCode.Double:
134  return 8;
135  }
136  }
137 
138  public override SqlType Wider(SqlType otherType) {
139  SqlTypeCode t1SqlType = TypeCode;
140  SqlTypeCode t2SqlType = otherType.TypeCode;
141  if (t1SqlType == SqlTypeCode.Decimal) {
142  return this;
143  }
144  if (t2SqlType == SqlTypeCode.Decimal) {
145  return otherType;
146  }
147  if (t1SqlType == SqlTypeCode.Numeric) {
148  return this;
149  }
150  if (t2SqlType == SqlTypeCode.Numeric) {
151  return otherType;
152  }
153 
154  if (t1SqlType == SqlTypeCode.Bit) {
155  return otherType; // It can't be any smaller than a Bit
156  }
157  if (t2SqlType == SqlTypeCode.Bit) {
158  return this;
159  }
160 
161  int t1IntSize = GetIntSize(t1SqlType);
162  int t2IntSize = GetIntSize(t2SqlType);
163  if (t1IntSize > 0 && t2IntSize > 0) {
164  // Both are int types, use the largest size
165  return (t1IntSize > t2IntSize) ? this : otherType;
166  }
167 
168  int t1FloatSize = GetFloatSize(t1SqlType);
169  int t2FloatSize = GetFloatSize(t2SqlType);
170  if (t1FloatSize > 0 && t2FloatSize > 0) {
171  // Both are floating types, use the largest size
172  return (t1FloatSize > t2FloatSize) ? this : otherType;
173  }
174 
175  if (t1FloatSize > t2IntSize) {
176  return this;
177  }
178  if (t2FloatSize > t1IntSize) {
179  return otherType;
180  }
181  if (t1IntSize >= t2FloatSize || t2IntSize >= t1FloatSize) {
182  // Must be a long (8 bytes) and a real (4 bytes), widen to a double
183  return new NumericType(SqlTypeCode.Double, 8, 0);
184  }
185 
186  // NOTREACHED - can't get here, the last three if statements cover
187  // all possibilities.
188  throw new InvalidOperationException("Widest type error.");
189  }
190 
191  public override bool IsComparable(SqlType type) {
192  return type is NumericType || type is BooleanType;
193  }
194 
195  public override int Compare(ISqlObject x, ISqlObject y) {
196  var n1 = (SqlNumber)x;
197  SqlNumber n2;
198 
199  if (y is SqlNumber) {
200  n2 = (SqlNumber)y;
201  } else if (y is SqlBoolean) {
202  n2 = (SqlBoolean) y ? SqlNumber.One : SqlNumber.Zero;
203  } else {
204  throw new NotSupportedException();
205  }
206 
207  return n1.CompareTo(n2);
208  }
209 
210  private static SqlDateTime ToDate(long time) {
211  return new SqlDateTime(time);
212  }
213 
214  public override bool CanCastTo(SqlType destType) {
215  return destType.TypeCode != SqlTypeCode.Array &&
216  destType.TypeCode != SqlTypeCode.ColumnType &&
217  destType.TypeCode != SqlTypeCode.RowType &&
218  destType.TypeCode != SqlTypeCode.Object;
219  }
220 
221  public override DataObject CastTo(DataObject value, SqlType destType) {
222  var n = (SqlNumber) value.Value;
223  var sqlType = destType.TypeCode;
224  ISqlObject casted;
225 
226  switch (sqlType) {
227  case (SqlTypeCode.Bit):
228  case (SqlTypeCode.Boolean):
229  casted = new SqlBoolean(n.ToBoolean());
230  break;
231  case (SqlTypeCode.TinyInt):
232  case (SqlTypeCode.SmallInt):
233  case (SqlTypeCode.Integer):
234  casted = new SqlNumber(n.ToInt32());
235  break;
236  case (SqlTypeCode.BigInt):
237  casted = new SqlNumber(n.ToInt64());
238  break;
239  case (SqlTypeCode.Float):
240  case (SqlTypeCode.Real):
241  case (SqlTypeCode.Double):
242  double d;
243  if (n.State == NumericState.NotANumber) {
244  casted = new SqlNumber(Double.NaN);
245  } else if (n.State == NumericState.PositiveInfinity) {
246  casted = new SqlNumber(Double.PositiveInfinity);
247  } else if (n.State == NumericState.NegativeInfinity) {
248  casted = new SqlNumber(Double.NegativeInfinity);
249  } else {
250  casted = new SqlNumber(n.ToDouble());
251  }
252 
253  break;
254  case (SqlTypeCode.Numeric):
255  case (SqlTypeCode.Decimal):
256  casted = n;
257  break;
258  case (SqlTypeCode.Char):
259  casted = new SqlString(n.ToString().PadRight(((StringType) destType).MaxSize));
260  break;
261  case (SqlTypeCode.VarChar):
262  case (SqlTypeCode.LongVarChar):
263  case (SqlTypeCode.String):
264  casted = new SqlString(n.ToString());
265  break;
266  case (SqlTypeCode.Date):
267  case (SqlTypeCode.Time):
268  case (SqlTypeCode.TimeStamp):
269  casted = ToDate(n.ToInt64());
270  break;
271  case (SqlTypeCode.Blob):
272  case (SqlTypeCode.Binary):
273  case (SqlTypeCode.VarBinary):
274  case (SqlTypeCode.LongVarBinary):
275  casted = new SqlBinary(n.ToByteArray());
276  break;
277  case (SqlTypeCode.Null):
278  casted = SqlNull.Value;
279  break;
280  default:
281  throw new InvalidCastException();
282  }
283 
284  return new DataObject(destType, casted);
285  }
286 
287  public override string ToString() {
288  var sb = new StringBuilder(Name);
289  if (Size != -1) {
290  sb.Append('(');
291  sb.Append(Size);
292  if (Scale > 0) {
293  sb.Append(',');
294  sb.Append(Scale);
295  }
296 
297  sb.Append(')');
298  }
299  return sb.ToString();
300  }
301 
302  public override object ConvertTo(ISqlObject obj, Type destType) {
303  if (!(obj is SqlNumber))
304  throw new ArgumentException();
305 
306  var number = (SqlNumber)obj;
307  if (number.IsNull)
308  return null;
309 
310  if (destType == typeof(byte))
311  return number.ToByte();
312  if (destType == typeof(short))
313  return number.ToInt16();
314  if (destType == typeof(int))
315  return number.ToInt32();
316  if (destType == typeof(long))
317  return number.ToInt64();
318  if (destType == typeof(float))
319  return number.ToSingle();
320  if (destType == typeof(double))
321  return number.ToDouble();
322 
323  if (destType == typeof(bool))
324  return number.ToBoolean();
325 
326  if (destType == typeof(string))
327  return number.ToString();
328 
329  return base.ConvertTo(obj, destType);
330  }
331 
332  public override ISqlObject Add(ISqlObject a, ISqlObject b) {
333  if (!(a is SqlNumber))
334  throw new ArgumentException();
335  if (b is SqlNull || b.IsNull)
336  return SqlNumber.Null;
337 
338  var num1 = (SqlNumber) a;
339  SqlNumber num2;
340 
341  if (b is SqlBoolean) {
342  if ((SqlBoolean) b) {
343  num2 = SqlNumber.One;
344  } else if (!(SqlBoolean) b) {
345  num2 = SqlNumber.Zero;
346  } else {
347  num2 = SqlNumber.Null;
348  }
349  } else if (b is SqlNumber) {
350  num2 = (SqlNumber) b;
351  } else {
352  throw new ArgumentException();
353  }
354 
355  return num1.Add(num2);
356  }
357 
358  public override ISqlObject Subtract(ISqlObject a, ISqlObject b) {
359  if (!(a is SqlNumber))
360  throw new ArgumentException();
361  if (b is SqlNull || b.IsNull)
362  return SqlNumber.Null;
363 
364  var num1 = (SqlNumber) a;
365  SqlNumber num2;
366 
367  if (b is SqlBoolean) {
368  if ((SqlBoolean) b) {
369  num2 = SqlNumber.One;
370  } else if (!(SqlBoolean) b) {
371  num2 = SqlNumber.Zero;
372  } else {
373  num2 = SqlNumber.Null;
374  }
375  } else if (b is SqlNumber) {
376  num2 = (SqlNumber) b;
377  } else {
378  throw new ArgumentException();
379  }
380 
381  return num1.Subtract(num2);
382  }
383 
384  public override ISqlObject Multiply(ISqlObject a, ISqlObject b) {
385  if (!(a is SqlNumber) ||
386  !(b is SqlNumber))
387  throw new ArgumentException();
388  if (b.IsNull)
389  return SqlNumber.Null;
390 
391  if (a.IsNull)
392  return a;
393 
394  var num1 = (SqlNumber) a;
395  var num2 = (SqlNumber) b;
396 
397  return num1.Multiply(num2);
398  }
399 
400  public override ISqlObject Divide(ISqlObject a, ISqlObject b) {
401  if (!(a is SqlNumber) ||
402  !(b is SqlNumber))
403  throw new ArgumentException();
404 
405  if (b.IsNull)
406  return SqlNumber.Null;
407 
408  if (a.IsNull)
409  return a;
410 
411  var num1 = (SqlNumber)a;
412  var num2 = (SqlNumber)b;
413 
414  return num1.Divide(num2);
415  }
416 
417  public override ISqlObject Modulus(ISqlObject a, ISqlObject b) {
418  if (!(a is SqlNumber) ||
419  !(b is SqlNumber))
420  throw new ArgumentException();
421 
422  if (b.IsNull)
423  return SqlNumber.Null;
424 
425  if (a.IsNull)
426  return a;
427 
428  var num1 = (SqlNumber) a;
429  var num2 = (SqlNumber) b;
430 
431  return num1.Modulo(num2);
432  }
433 
435  if (!(a is SqlNumber) ||
436  !(b is SqlNumber))
437  throw new ArgumentException();
438 
439  if (b.IsNull)
440  return SqlBoolean.Null;
441 
442  if (a.IsNull)
443  return SqlBoolean.Null;
444 
445  var num1 = (SqlNumber) a;
446  var num2 = (SqlNumber) b;
447 
448  return num1 < num2;
449  }
450 
452  if (!(a is SqlNumber) ||
453  !(b is SqlNumber))
454  throw new ArgumentException();
455 
456  if (b.IsNull)
457  return SqlBoolean.Null;
458 
459  if (a.IsNull)
460  return SqlBoolean.Null;
461 
462  var num1 = (SqlNumber) a;
463  var num2 = (SqlNumber) b;
464 
465  return num1 > num2;
466  }
467 
469  if (!(a is SqlNumber) ||
470  !(b is SqlNumber))
471  throw new ArgumentException();
472 
473  if (b.IsNull)
474  return SqlBoolean.Null;
475 
476  if (a.IsNull)
477  return SqlBoolean.Null;
478 
479  var num1 = (SqlNumber) a;
480  var num2 = (SqlNumber) b;
481 
482  return num1 <= num2;
483  }
484 
486  if (!(a is SqlNumber) ||
487  !(b is SqlNumber))
488  throw new ArgumentException();
489 
490  if (b.IsNull)
491  return SqlBoolean.Null;
492 
493  if (a.IsNull)
494  return SqlBoolean.Null;
495 
496  var num1 = (SqlNumber) a;
497  var num2 = (SqlNumber) b;
498 
499  return num1 >= num2;
500  }
501 
502  public override SqlBoolean IsEqualTo(ISqlObject a, ISqlObject b) {
503  if (!(a is SqlNumber) ||
504  !(b is SqlNumber))
505  throw new ArgumentException();
506 
507  if (b.IsNull)
508  return a.IsNull;
509 
510  if (a.IsNull)
511  return b.IsNull;
512 
513  var num1 = (SqlNumber) a;
514  var num2 = (SqlNumber) b;
515 
516  return num1.Equals(num2);
517  }
518 
520  return !IsEqualTo(a, b);
521  }
522 
523  public override ISqlObject Negate(ISqlObject value) {
524  if (!(value is SqlNumber))
525  throw new ArgumentException();
526 
527  var num = (SqlNumber) value;
528 
529  if (num.IsNull)
530  return num;
531 
532  return num.Negate();
533  }
534 
535  public override ISqlObject Reverse(ISqlObject value) {
536  if (!(value is SqlNumber))
537  throw new ArgumentException();
538 
539  var num = (SqlNumber)value;
540 
541  if (num.IsNull)
542  return num;
543 
544  return num.Not();
545  }
546 
547  public override ISqlObject UnaryPlus(ISqlObject value) {
548  if (!(value is SqlNumber))
549  throw new ArgumentException();
550 
551  var num = (SqlNumber)value;
552 
553  if (num.IsNull)
554  return num;
555 
556  return num.Plus();
557  }
558 
559  public override ISqlObject XOr(ISqlObject a, ISqlObject b) {
560  if (!(a is SqlNumber) ||
561  !(b is SqlNumber))
562  throw new ArgumentException();
563 
564  if (b.IsNull)
565  return SqlNumber.Null;
566 
567  if (a.IsNull)
568  return a;
569 
570  var num1 = (SqlNumber) a;
571  var num2 = (SqlNumber) b;
572 
573  return num1.XOr(num2);
574  }
575 
576  public override ISqlObject And(ISqlObject a, ISqlObject b) {
577  if (!(a is SqlNumber) ||
578  !(b is SqlNumber))
579  throw new ArgumentException();
580 
581  if (b.IsNull)
582  return SqlNumber.Null;
583 
584  if (a.IsNull)
585  return a;
586 
587  var num1 = (SqlNumber) a;
588  var num2 = (SqlNumber) b;
589 
590  return num1.And(num2);
591  }
592 
593  public override ISqlObject Or(ISqlObject a, ISqlObject b) {
594  if (!(a is SqlNumber) ||
595  !(b is SqlNumber))
596  throw new ArgumentException();
597 
598  if (b.IsNull)
599  return SqlNumber.Null;
600 
601  if (a.IsNull)
602  return a;
603 
604  var num1 = (SqlNumber) a;
605  var num2 = (SqlNumber) b;
606 
607  return num1.Or(num2);
608  }
609 
610  public override void SerializeObject(Stream stream, ISqlObject obj) {
611  var writer = new BinaryWriter(stream);
612 
613  if (obj is SqlNull) {
614  writer.Write((byte)0);
615  } else {
616  var number = (SqlNumber) obj;
617  if (obj.IsNull) {
618  writer.Write((byte) 0);
619  } else if (number.CanBeInt32) {
620  writer.Write((byte) 1);
621  writer.Write(number.ToInt32());
622  } else if (number.CanBeInt64) {
623  writer.Write((byte) 2);
624  writer.Write(number.ToInt64());
625  } else {
626  var bytes = number.ToByteArray();
627  writer.Write((byte) 3);
628  writer.Write(number.Precision);
629  writer.Write(number.Scale);
630  writer.Write(bytes.Length);
631  writer.Write(bytes);
632  }
633  }
634  }
635 
636  public override ISqlObject DeserializeObject(Stream stream) {
637  var reader = new BinaryReader(stream);
638 
639  var type = reader.ReadByte();
640  if (type == 0)
641  return SqlNumber.Null;
642 
643  if (type == 1) {
644  var value = reader.ReadInt32();
645  return new SqlNumber(value);
646  }
647  if (type == 2) {
648  var value = reader.ReadInt64();
649  return new SqlNumber(value);
650  }
651  if (type == 3) {
652  var precision = reader.ReadInt32();
653  var scale = reader.ReadInt32();
654  var length = reader.ReadInt32();
655  var bytes = reader.ReadBytes(length);
656  return new SqlNumber(bytes, scale, precision);
657  }
658 
659  throw new FormatException();
660  }
661 
662  internal override int ColumnSizeOf(ISqlObject obj) {
663  if (obj is SqlNull)
664  return 1;
665 
666  if (!(obj is SqlNumber))
667  throw new ArgumentException(String.Format("Cannot determine the size of an object of type '{0}'.", obj.GetType()));
668 
669  var number = (SqlNumber) obj;
670 
671  if (number.IsNull)
672  return 1;
673 
674  if (number.CanBeInt32)
675  return 1 + 4;
676  if (number.CanBeInt64)
677  return 1+ 8;
678 
679  // Type + Scale + Precision + Byte Count
680  var length = number.ToByteArray().Length;
681  return 1 + 4 + 4 + 4 + length;
682  }
683 
684  internal static bool IsNumericType(SqlTypeCode typeCode) {
685  return typeCode == SqlTypeCode.TinyInt ||
686  typeCode == SqlTypeCode.SmallInt ||
687  typeCode == SqlTypeCode.Integer ||
688  typeCode == SqlTypeCode.BigInt ||
689  typeCode == SqlTypeCode.Real ||
690  typeCode == SqlTypeCode.Float ||
691  typeCode == SqlTypeCode.Double ||
692  typeCode == SqlTypeCode.Decimal ||
693  typeCode == SqlTypeCode.Numeric;
694  }
695  }
696 }
override string ToString()
Definition: NumericType.cs:287
NumericType(SqlTypeCode typeCode, int size)
Definition: NumericType.cs:39
static void AssertIsNumeric(SqlTypeCode typeCode)
Definition: NumericType.cs:105
NumericState
Lists all the possible special states of a number.
Definition: NumericState.cs:21
override bool IsCacheable(ISqlObject value)
Definition: NumericType.cs:97
override int Compare(ISqlObject x, ISqlObject y)
Definition: NumericType.cs:195
override ISqlObject DeserializeObject(Stream stream)
Definition: NumericType.cs:636
A long string in the system.
override void SerializeObject(Stream stream, ISqlObject obj)
Definition: NumericType.cs:610
override DataObject CastTo(DataObject value, SqlType destType)
Converts the given object value to a SqlType specified.
Definition: NumericType.cs:221
Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength.
Definition: SqlBinary.cs:27
override SqlBoolean IsSmallerThan(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:434
static bool IsNumericType(SqlTypeCode typeCode)
Definition: NumericType.cs:684
override object ConvertTo(ISqlObject obj, Type destType)
Definition: NumericType.cs:302
void SetValue(string key, Type type, object value)
NumericType(SqlTypeCode typeCode, int size, byte scale)
Definition: NumericType.cs:28
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
SqlTypeCode TypeCode
Gets the kind of SQL type this data-type handles.
Definition: SqlType.cs:91
bool IsNull
Gets a boolean value indicating if the object is NULL.
Definition: ISqlObject.cs:28
override ISqlObject Subtract(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:358
override SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: NumericType.cs:138
override SqlBoolean IsNotEqualTo(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:519
static readonly SqlNull Value
Definition: SqlNull.cs:24
Defines the contract for a valid SQL Object
Definition: ISqlObject.cs:23
static SqlDateTime ToDate(long time)
Definition: NumericType.cs:210
override bool IsComparable(SqlType type)
Verifies if a given SqlType is comparable to this data-type.
Definition: NumericType.cs:191
override ISqlObject Divide(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:400
override ISqlObject Negate(ISqlObject value)
Definition: NumericType.cs:523
override ISqlObject Reverse(ISqlObject value)
Definition: NumericType.cs:535
static readonly SqlNumber Zero
Definition: SqlNumber.cs:29
NumericType(ObjectData data)
Definition: NumericType.cs:43
override ISqlObject XOr(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:559
override Type GetRuntimeType()
Definition: NumericType.cs:76
override ISqlObject Modulus(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:417
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
override bool CanCastTo(SqlType destType)
Verifies if this type can cast any value to the given SqlType.
Definition: NumericType.cs:214
override int ColumnSizeOf(ISqlObject obj)
Definition: NumericType.cs:662
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33
override Type GetObjectType()
Definition: NumericType.cs:72
override SqlBoolean IsGreaterOrEqualThan(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:485
override bool Equals(object obj)
Definition: NumericType.cs:62
static readonly SqlNumber Null
Definition: SqlNumber.cs:31
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static readonly SqlNumber One
Definition: SqlNumber.cs:30
static int GetIntSize(SqlTypeCode sqlType)
Definition: NumericType.cs:110
override void GetData(SerializeData data)
Definition: NumericType.cs:57
override ISqlObject And(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:576
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
override ISqlObject Multiply(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:384
override SqlBoolean IsSmallerOrEqualThan(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:468
override ISqlObject Or(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:593
override SqlBoolean IsGreatherThan(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:451
NumericType(SqlTypeCode typeCode)
Definition: NumericType.cs:35
static int GetFloatSize(SqlTypeCode sqlType)
Definition: NumericType.cs:126
override SqlBoolean IsEqualTo(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:502
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27
override ISqlObject UnaryPlus(ISqlObject value)
Definition: NumericType.cs:547
override ISqlObject Add(ISqlObject a, ISqlObject b)
Definition: NumericType.cs:332