DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | Private Member Functions | List of all members
Deveel.Data.DataObject Class Reference

Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject value. More...

Inheritance diagram for Deveel.Data.DataObject:
Deveel.Data.Serialization.ISerializable

Public Member Functions

 DataObject (SqlType type, ISqlObject value)
 Constructs a new database data object with a specific SqlType and handling the specified ISqlObject value. More...
 
bool IsComparableTo (DataObject obj)
 Checks if the given object is comparable to this object, More...
 
int CompareTo (DataObject other)
 
override int GetHashCode ()
 
override bool Equals (object obj)
 
bool Equals (DataObject other)
 
DataObject Is (DataObject other)
 Compares to the given object to verify if is it compatible. More...
 
DataObject IsNot (DataObject other)
 Compares the given object to verify if it is not compatible with this one. More...
 
DataObject IsEqualTo (DataObject other)
 Compares to the given object to verify if is it equal to the current. More...
 
DataObject IsNotEqualTo (DataObject other)
 Compares to the given object to verify if is it not equal to the current. More...
 
DataObject IsGreaterThan (DataObject other)
 
DataObject IsSmallerThan (DataObject other)
 
DataObject IsGreterOrEqualThan (DataObject other)
 
DataObject IsSmallerOrEqualThan (DataObject other)
 
DataObject IsLike (DataObject pattern)
 When the type of this object is a string, this method verifies if the input pattern is compatible (<likes) with the input. More...
 
DataObject IsNotLike (DataObject pattern)
 
DataObject Negate ()
 Negates the current underlying value of the object. More...
 
DataObject Plus ()
 
DataObject Add (DataObject other)
 Adds the given value to this object value. More...
 
DataObject Subtract (DataObject other)
 
DataObject Multiply (DataObject other)
 
DataObject Divide (DataObject other)
 
DataObject Modulus (DataObject other)
 
DataObject Or (DataObject other)
 
DataObject And (DataObject other)
 
DataObject XOr (DataObject other)
 
DataObject Any (SqlExpressionType type, DataObject other, EvaluateContext context)
 
DataObject All (SqlExpressionType type, DataObject other, EvaluateContext context)
 
DataObject Reverse ()
 
DataObject CastTo (SqlType destType)
 Converts this object to the given SqlType. More...
 
DataObject AsBoolean ()
 Converts this object to a boolean type. More...
 
DataObject AsTinyInt ()
 
DataObject AsInteger ()
 
DataObject AsBigInt ()
 
DataObject AsVarChar ()
 
DataObject AsDate ()
 
DataObject AsTimeStamp ()
 
void SerializeValueTo (Stream stream, ISystemContext systemContext)
 

Static Public Member Functions

static DataObject Boolean (SqlBoolean value)
 
static DataObject Boolean (bool value)
 
static DataObject Number (SqlNumber value)
 
static DataObject Number (NumericType type, SqlNumber value)
 
static DataObject Number (NumericType type, int value)
 
static DataObject Number (NumericType type, long value)
 
static DataObject TinyInt (byte value)
 
static DataObject SmallInt (short value)
 
static DataObject Integer (int value)
 
static DataObject BigInt (long value)
 
static DataObject Float (float value)
 
static DataObject Double (double value)
 
static DataObject String (string s)
 
static DataObject String (SqlString s)
 
static DataObject Date (DateTimeOffset value)
 
static DataObject Date (SqlDateTime value)
 
static DataObject TimeStamp (SqlDateTime value)
 
static DataObject Date (SqlTypeCode typeCode, SqlDateTime value)
 
static DataObject Time (SqlDateTime value)
 
static DataObject VarChar (string s)
 
static DataObject VarChar (SqlString s)
 
static DataObject Null (SqlType type)
 
static DataObject Null ()
 
static DataObject Binary (SqlBinary binary)
 
static DataObject Binary (byte[] binary)
 
static DataObject Create (object value)
 
static DataObject operator== (DataObject a, DataObject b)
 The equality operation between two DataObject instances. More...
 
static DataObject operator== (DataObject a, DBNull b)
 
static DataObject operator!= (DataObject a, DBNull b)
 
static DataObject operator!= (DataObject a, DataObject b)
 The inequality operation between two DataObject instances. More...
 
static DataObject operator+ (DataObject a, DataObject b)
 The addition operator between two numeric values. More...
 
static DataObject operator- (DataObject a, DataObject b)
 The subtraction operator between two numeric values. More...
 
static DataObject operator/ (DataObject a, DataObject b)
 
static DataObject operator* (DataObject a, DataObject b)
 
static DataObject operator% (DataObject a, DataObject b)
 
static DataObject operator& (DataObject a, DataObject b)
 
static bool operator true (DataObject a)
 
static bool operator false (DataObject a)
 
static DataObject operator| (DataObject a, DataObject b)
 
static DataObject operator^ (DataObject a, DataObject b)
 
static DataObject operator! (DataObject value)
 
static DataObject operator- (DataObject value)
 
static DataObject operator~ (DataObject value)
 
static DataObject operator+ (DataObject value)
 
static implicit operator bool (DataObject value)
 
static implicit operator int (DataObject value)
 
static implicit operator long (DataObject value)
 
static implicit operator string (DataObject value)
 
static implicit operator DateTime? (DataObject value)
 
static implicit operator DateTime (DataObject value)
 
static implicit operator DBNull (DataObject value)
 
static void Serialize (DataObject obj, BinaryWriter writer)
 
static DataObject Deserialize (BinaryReader reader, ITypeResolver resolver)
 

Static Public Attributes

static readonly DataObject BooleanTrue = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.True)
 The representation of a BOOLEAN true as DataObject More...
 
static readonly DataObject BooleanFalse = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.False)
 The representation of a BOOLEAN false as DataObject More...
 
static readonly DataObject BooleanNull = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.Null)
 The null representation of a BOOLEAN object. More...
 

Properties

SqlType Type [get, private set]
 Gets the SqlType that defines the object properties More...
 
ISqlObject Value [get, private set]
 Gets the underlined value that is handled. More...
 
bool IsNull [get]
 Gets a value that indicates if this object is materialized as null. More...
 
int CacheUsage [get]
 
bool IsCacheable [get]
 
int Size [get]
 

Private Member Functions

 DataObject (ObjectData data)
 
void ISerializable. GetData (SerializeData data)
 
int CompareToNotNull (DataObject other)
 
int IComparable. CompareTo (object obj)
 

Detailed Description

Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject value.

Definition at line 35 of file DataObject.cs.

Constructor & Destructor Documentation

Deveel.Data.DataObject.DataObject ( SqlType  type,
ISqlObject  value 
)
inline

Constructs a new database data object with a specific SqlType and handling the specified ISqlObject value.

Parameters
typeThe specific SqlType that is used by this object to shape the data and compute operations.
valueThe innermost value of the object to be handled.
Exceptions
ArgumentNullExceptionIf the specified type is null.

Definition at line 61 of file DataObject.cs.

61  {
62  if (type == null)
63  throw new ArgumentNullException("type");
64 
65  Type = type;
66  Value = value;
67  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Deveel.Data.DataObject.DataObject ( ObjectData  data)
inlineprivate

Definition at line 69 of file DataObject.cs.

69  {
70  Type = data.GetValue<SqlType>("Type");
71  Value = data.GetValue<ISqlObject>("Value");
72  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Defines the contract for a valid SQL Object
Definition: ISqlObject.cs:23
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33

Member Function Documentation

DataObject Deveel.Data.DataObject.Add ( DataObject  other)
inline

Adds the given value to this object value.

Parameters
otherThe object that handles the value to be added to this one.
Returns
Returns an instance of DataObject that is the result of he addition of this value to the provided value, or null if this object or the other object is null.

Definition at line 383 of file DataObject.cs.

383  {
384  if (IsNull)
385  return this;
386 
387  var widerType = Type.Wider(other.Type);
388  var result = widerType.Add(Value, other.Value);
389  return new DataObject(widerType, result);
390  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
virtual ISqlObject Add(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:192
DataObject Deveel.Data.DataObject.All ( SqlExpressionType  type,
DataObject  other,
EvaluateContext  context 
)
inline

Definition at line 462 of file DataObject.cs.

462  {
463  if (IsNull)
464  return this;
465 
466  return GroupOperatorHelper.EvaluateAll(type, this, other, context);
467  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
static DataObject EvaluateAll(SqlExpressionType plainType, DataObject ob1, DataObject ob2, EvaluateContext context)
DataObject Deveel.Data.DataObject.And ( DataObject  other)
inline

Definition at line 437 of file DataObject.cs.

437  {
438  if (IsNull)
439  return this;
440 
441  var widerType = Type.Wider(other.Type);
442  var result = widerType.And(Value, other.Value);
443  return new DataObject(widerType, result);
444  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
virtual ISqlObject And(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:258
DataObject Deveel.Data.DataObject.Any ( SqlExpressionType  type,
DataObject  other,
EvaluateContext  context 
)
inline

Definition at line 455 of file DataObject.cs.

455  {
456  if (IsNull)
457  return this;
458 
459  return GroupOperatorHelper.EvaluateAny(type, this, other, context);
460  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
static DataObject EvaluateAny(SqlExpressionType plainType, DataObject ob1, DataObject ob2, EvaluateContext context)
DataObject Deveel.Data.DataObject.AsBigInt ( )
inline

Definition at line 524 of file DataObject.cs.

524  {
525  return CastTo(PrimitiveTypes.Numeric(SqlTypeCode.BigInt));
526  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
DataObject Deveel.Data.DataObject.AsBoolean ( )
inline

Converts this object to a boolean type.

This method is a shortcut to the original CastTo method with a BooleanType parameter.

Returns
Returns an instance of DataObject that is compatible with a boolean type.
See also
CastTo, PrimitiveTypes.Boolean(), BooleanType

Definition at line 512 of file DataObject.cs.

512  {
513  return CastTo(PrimitiveTypes.Boolean());
514  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
static BooleanType Boolean()
DataObject Deveel.Data.DataObject.AsDate ( )
inline

Definition at line 532 of file DataObject.cs.

532  {
533  return CastTo(PrimitiveTypes.Date());
534  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
DataObject Deveel.Data.DataObject.AsInteger ( )
inline

Definition at line 520 of file DataObject.cs.

520  {
521  return CastTo(PrimitiveTypes.Numeric(SqlTypeCode.Integer));
522  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
DataObject Deveel.Data.DataObject.AsTimeStamp ( )
inline

Definition at line 536 of file DataObject.cs.

536  {
537  return CastTo(PrimitiveTypes.TimeStamp());
538  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
DataObject Deveel.Data.DataObject.AsTinyInt ( )
inline

Definition at line 516 of file DataObject.cs.

516  {
517  return CastTo(PrimitiveTypes.TinyInt());
518  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
static NumericType TinyInt(int size)
DataObject Deveel.Data.DataObject.AsVarChar ( )
inline

Definition at line 528 of file DataObject.cs.

528  {
529  return CastTo(PrimitiveTypes.String(SqlTypeCode.VarChar));
530  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.BigInt ( long  value)
inlinestatic

Definition at line 580 of file DataObject.cs.

580  {
581  return Number(PrimitiveTypes.Numeric(SqlTypeCode.BigInt), value);
582  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.Binary ( SqlBinary  binary)
inlinestatic

Definition at line 638 of file DataObject.cs.

638  {
639  return new DataObject(new BinaryType(SqlTypeCode.Binary), binary);
640  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.Binary ( byte[]  binary)
inlinestatic

Definition at line 642 of file DataObject.cs.

642  {
643  return Binary(new SqlBinary(binary));
644  }
static DataObject Binary(SqlBinary binary)
Definition: DataObject.cs:638
Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength.
Definition: SqlBinary.cs:27
static DataObject Deveel.Data.DataObject.Boolean ( SqlBoolean  value)
inlinestatic

Definition at line 544 of file DataObject.cs.

544  {
545  return new DataObject(PrimitiveTypes.Boolean(), value);
546  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static BooleanType Boolean()
static DataObject Deveel.Data.DataObject.Boolean ( bool  value)
inlinestatic

Definition at line 548 of file DataObject.cs.

548  {
549  return Boolean((SqlBoolean)value);
550  }
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
DataObject Deveel.Data.DataObject.CastTo ( SqlType  destType)
inline

Converts this object to the given SqlType.

Parameters
destTypeThe destination SqlType to cast this object to.
Returns
Returns an instance of DataObject that has a Type equals to the given SqlType and Value as a ISqlObject compatible with the given type.

Definition at line 488 of file DataObject.cs.

488  {
489  if (!Type.CanCastTo(destType))
490  throw new InvalidCastException();
491 
492  if (Type.Equals(destType))
493  return this;
494 
495  return Type.CastTo(this, destType);
496  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual bool CanCastTo(SqlType destType)
Verifies if this type can cast any value to the given SqlType.
Definition: SqlType.cs:153
virtual DataObject CastTo(DataObject value, SqlType destType)
Converts the given object value to a SqlType specified.
Definition: SqlType.cs:180
override bool Equals(object obj)
Definition: SqlType.cs:373
int Deveel.Data.DataObject.CompareTo ( DataObject  other)
inline

Definition at line 131 of file DataObject.cs.

131  {
132  // If this is null
133  if (IsNull) {
134  // and value is null return 0 return less
135  if (other.IsNull)
136  return 0;
137  return -1;
138  }
139  // If this is not null and value is null return +1
140  if (ReferenceEquals(null, other) ||
141  other.IsNull)
142  return 1;
143 
144  // otherwise both are non null so compare normally.
145  return CompareToNotNull(other);
146  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
int CompareToNotNull(DataObject other)
Definition: DataObject.cs:148
int IComparable. Deveel.Data.DataObject.CompareTo ( object  obj)
inlineprivate

Definition at line 164 of file DataObject.cs.

164  {
165  return CompareTo((DataObject)obj);
166  }
int CompareTo(DataObject other)
Definition: DataObject.cs:131
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
int Deveel.Data.DataObject.CompareToNotNull ( DataObject  other)
inlineprivate

Definition at line 148 of file DataObject.cs.

148  {
149  var type = Type;
150  // Strings must be handled as a special case.
151  if (type is StringType) {
152  // We must determine the locale to compare against and use that.
153  var stype = (StringType)type;
154  // If there is no locale defined for this type we use the locale in the
155  // given type.
156  if (stype.Locale == null) {
157  type = other.Type;
158  }
159  }
160  return type.Compare(Value, other.Value);
161 
162  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual int Compare(ISqlObject x, ISqlObject y)
Definition: SqlType.cs:358
static DataObject Deveel.Data.DataObject.Create ( object  value)
inlinestatic

Definition at line 646 of file DataObject.cs.

646  {
647  // Numeric values ...
648  if (value is bool)
649  return Boolean((bool) value);
650  if (value is byte)
651  return TinyInt((byte) value);
652  if (value is short)
653  return SmallInt((short) value);
654  if (value is int)
655  return Integer((int) value);
656  if (value is long)
657  return BigInt((long) value);
658  if (value is float)
659  return Float((float) value);
660  if (value is double)
661  return Double((double) value);
662 
663  if (value is SqlNumber) {
664  var num = (SqlNumber) value;
665  if (num.IsNull)
666  return Null(PrimitiveTypes.Numeric());
667 
668  if (num.CanBeInt32)
669  return Integer(num.ToInt32());
670  if (num.CanBeInt64)
671  return BigInt(num.ToInt64());
672 
673  return Number(num);
674  }
675 
676  // String values ...
677  if (value is string)
678  return String((string) value);
679  if (value is SqlString) {
680  var s = (SqlString) value;
681  if (s.IsNull)
682  return Null(PrimitiveTypes.String());
683 
684  return String(s);
685  }
686 
687  throw new NotSupportedException("Cannot build an object from the given value.");
688  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Integer(int value)
Definition: DataObject.cs:576
static DataObject Double(double value)
Definition: DataObject.cs:588
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static DataObject String(string s)
Definition: DataObject.cs:592
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
static DataObject Null()
Definition: DataObject.cs:634
static NumericType Numeric()
static DataObject TinyInt(byte value)
Definition: DataObject.cs:568
static DataObject BigInt(long value)
Definition: DataObject.cs:580
static DataObject SmallInt(short value)
Definition: DataObject.cs:572
static DataObject Float(float value)
Definition: DataObject.cs:584
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27
static DataObject Deveel.Data.DataObject.Date ( DateTimeOffset  value)
inlinestatic

Definition at line 600 of file DataObject.cs.

600  {
601  var offset = new SqlDayToSecond(value.Offset.Days, value.Offset.Hours, value.Offset.Minutes, value.Offset.Seconds, value.Offset.Milliseconds);
602  var sqlDate = new SqlDateTime(value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second, value.Millisecond, offset);
603  return Date(sqlDate);
604  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
static DataObject Deveel.Data.DataObject.Date ( SqlDateTime  value)
inlinestatic

Definition at line 606 of file DataObject.cs.

606  {
607  return Date(SqlTypeCode.Date, value);
608  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.Date ( SqlTypeCode  typeCode,
SqlDateTime  value 
)
inlinestatic

Definition at line 614 of file DataObject.cs.

614  {
615  return new DataObject(PrimitiveTypes.DateTime(typeCode), value);
616  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static DataObject Deveel.Data.DataObject.Deserialize ( BinaryReader  reader,
ITypeResolver  resolver 
)
inlinestatic

Definition at line 935 of file DataObject.cs.

935  {
936  // TODO: this is messy and ugly: must review the whole object and type serialization logic...
937  var status = reader.ReadByte();
938  if (status == 0)
939  return null;
940 
941  var type = TypeSerializer.Deserialize(reader.BaseStream, resolver);
942  var obj = type.DeserializeObject(reader.BaseStream);
943 
944  return new DataObject(type, obj);
945  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static SqlType Deserialize(BinaryReader reader, ITypeResolver resolver)
virtual ISqlObject DeserializeObject(Stream stream)
Definition: SqlType.cs:404
DataObject Deveel.Data.DataObject.Divide ( DataObject  other)
inline

Definition at line 410 of file DataObject.cs.

410  {
411  if (IsNull)
412  return this;
413 
414  var widerType = Type.Wider(other.Type);
415  var result = widerType.Divide(Value, other.Value);
416  return new DataObject(widerType, result);
417  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual ISqlObject Divide(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:204
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
static DataObject Deveel.Data.DataObject.Double ( double  value)
inlinestatic

Definition at line 588 of file DataObject.cs.

588  {
589  return Number(PrimitiveTypes.Numeric(SqlTypeCode.Double), new SqlNumber(value));
590  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
override bool Deveel.Data.DataObject.Equals ( object  obj)
inline

Definition at line 179 of file DataObject.cs.

179  {
180  if (!(obj is DataObject))
181  return false;
182 
183  return Equals((DataObject) obj);
184  }
override bool Equals(object obj)
Definition: DataObject.cs:179
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
bool Deveel.Data.DataObject.Equals ( DataObject  other)
inline

Definition at line 187 of file DataObject.cs.

187  {
188  if (ReferenceEquals(other, null))
189  return IsNull;
190 
191  var result = IsEqualTo(other);
192  if (result.IsNull)
193  return IsNull;
194 
195  return result.AsBoolean();
196  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
DataObject IsEqualTo(DataObject other)
Compares to the given object to verify if is it equal to the current.
Definition: DataObject.cs:251
static DataObject Deveel.Data.DataObject.Float ( float  value)
inlinestatic

Definition at line 584 of file DataObject.cs.

584  {
585  return Number(PrimitiveTypes.Numeric(SqlTypeCode.Float), new SqlNumber(value));
586  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
void ISerializable. Deveel.Data.DataObject.GetData ( SerializeData  data)
inlineprivate

Implements Deveel.Data.Serialization.ISerializable.

Definition at line 112 of file DataObject.cs.

112  {
113  data.SetValue("Type", Type);
114  data.SetValue("Value", Value);
115  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
void SetValue(string key, Type type, object value)
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
override int Deveel.Data.DataObject.GetHashCode ( )
inline

Definition at line 169 of file DataObject.cs.

169  {
170  unchecked {
171  var code = Type.GetHashCode()*23;
172  if (Value != null)
173  code = code ^ Value.GetHashCode();
174  return code;
175  }
176  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
override int GetHashCode()
Definition: SqlType.cs:382
static DataObject Deveel.Data.DataObject.Integer ( int  value)
inlinestatic

Definition at line 576 of file DataObject.cs.

576  {
577  return Number(PrimitiveTypes.Numeric(SqlTypeCode.Integer), value);
578  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
DataObject Deveel.Data.DataObject.Is ( DataObject  other)
inline

Compares to the given object to verify if is it compatible.

Parameters
otherThe other object to verify.
Returns
Returns an instance of DataObject that defines if the given object is compatible with the current one.
See also
IsComparableTo, SqlType.IsComparable

Definition at line 208 of file DataObject.cs.

208  {
209  if (IsNull && other.IsNull)
210  return BooleanTrue;
211  if (IsComparableTo(other))
212  return Boolean(CompareTo(other) == 0);
213 
214  return BooleanFalse;
215  }
static readonly DataObject BooleanFalse
The representation of a BOOLEAN false as DataObject
Definition: DataObject.cs:44
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
static readonly DataObject BooleanTrue
The representation of a BOOLEAN true as DataObject
Definition: DataObject.cs:39
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
int CompareTo(DataObject other)
Definition: DataObject.cs:131
bool Deveel.Data.DataObject.IsComparableTo ( DataObject  obj)
inline

Checks if the given object is comparable to this object,

Parameters
objThe object to compare.
Returns
Returns true if the given object is comparable to this object, or false otherwise.

Definition at line 126 of file DataObject.cs.

126  {
127  return Type.IsComparable(obj.Type);
128  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual bool IsComparable(SqlType type)
Verifies if a given SqlType is comparable to this data-type.
Definition: SqlType.cs:137
DataObject Deveel.Data.DataObject.IsEqualTo ( DataObject  other)
inline

Compares to the given object to verify if is it equal to the current.

Parameters
otherThe other object to verify.

This method returns a boolean value of true or false only if the current object and the other object are not null.

Returns
Returns an instance of DataObject that defines if the given object is equal to the current one, or a boolean null if it was impossible to determine the types.
See also
IsComparableTo, SqlType.IsComparable

Definition at line 251 of file DataObject.cs.

251  {
252  if (IsComparableTo(other) && !IsNull && !other.IsNull)
253  return Boolean(Type.IsEqualTo(Value, other.Value));
254 
255  return BooleanNull;
256  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
virtual SqlBoolean IsEqualTo(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:216
DataObject Deveel.Data.DataObject.IsGreaterThan ( DataObject  other)
inline

Definition at line 280 of file DataObject.cs.

280  {
281  if (IsComparableTo(other) && !IsNull && !other.IsNull)
282  return Boolean(Type.IsGreatherThan(Value, other.Value));
283 
284  return BooleanNull;
285  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
virtual SqlBoolean IsGreatherThan(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:230
DataObject Deveel.Data.DataObject.IsGreterOrEqualThan ( DataObject  other)
inline

Definition at line 294 of file DataObject.cs.

294  {
295  if (IsComparableTo(other) && !IsNull && !other.IsNull)
296  return Boolean(Type.IsGreaterOrEqualThan(Value, other.Value));
297 
298  return BooleanNull;
299  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
virtual SqlBoolean IsGreaterOrEqualThan(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:244
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.IsLike ( DataObject  pattern)
inline

When the type of this object is a string, this method verifies if the input pattern is compatible (<likes) with the input.

Parameters
patternThe input string object pattern used to verify the likeness with the underlying string object..
Returns
This operation can be computed only if Type represents a StringType and the input pattern also.

Returns an instance of DataObject that represents a true or false if the underlying string value matches or not the provided pattern. If this object or the provided pattern are not strings, this method returns a boolean null.

Definition at line 324 of file DataObject.cs.

324  {
325  if (IsNull || !(Type is StringType))
326  return BooleanNull;
327 
328  if (!(pattern.Type is StringType) ||
329  pattern.IsNull)
330  return BooleanNull;
331 
332  var valueString = (ISqlString) Value;
333  var patternString = (ISqlString) pattern.Value;
334  return Boolean((Type as StringType).IsLike(valueString, patternString));
335  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.IsNot ( DataObject  other)
inline

Compares the given object to verify if it is not compatible with this one.

Parameters
otherThe other object to compare.

This method is equivalent to calling Is and then Negate to obtain the inverse value.

Returns
Returns an instance of DataObject that defines if the given object is not compatible with the current one.
See also
Is, Negate

Definition at line 232 of file DataObject.cs.

232  {
233  return Is(other).Negate();
234  }
DataObject Is(DataObject other)
Compares to the given object to verify if is it compatible.
Definition: DataObject.cs:208
DataObject Negate()
Negates the current underlying value of the object.
Definition: DataObject.cs:359
DataObject Deveel.Data.DataObject.IsNotEqualTo ( DataObject  other)
inline

Compares to the given object to verify if is it not equal to the current.

Parameters
otherThe other object to compare.

This method returns a boolean value of true or false only if the current object and the other object are not null.

Returns
Returns an instance of DataObject that defines if the given object is equal to the current one, or a boolean null if it was impossible to determine the types.
See also
IsComparableTo, SqlType.IsComparable

Definition at line 273 of file DataObject.cs.

273  {
274  if (IsComparableTo(other) && !IsNull && !other.IsNull)
275  return Boolean(Type.IsNotEqualTo(Value, other.Value));
276 
277  return BooleanNull;
278  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual SqlBoolean IsNotEqualTo(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:223
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.IsNotLike ( DataObject  pattern)
inline

Definition at line 337 of file DataObject.cs.

337  {
338  if (IsNull || !(Type is StringType))
339  return BooleanNull;
340 
341  var valueString = (ISqlString)Value;
342  var patternString = (ISqlString)pattern.Value;
343  return Boolean((Type as StringType).IsNotLike(valueString, patternString));
344  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.IsSmallerOrEqualThan ( DataObject  other)
inline

Definition at line 301 of file DataObject.cs.

301  {
302  if (IsComparableTo(other) && !IsNull && !other.IsNull)
303  return Boolean(Type.IsSmallerOrEqualThan(Value, other.Value));
304 
305  return BooleanNull;
306  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
virtual SqlBoolean IsSmallerOrEqualThan(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:251
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.IsSmallerThan ( DataObject  other)
inline

Definition at line 287 of file DataObject.cs.

287  {
288  if (IsComparableTo(other) && !IsNull && !other.IsNull)
289  return Boolean(Type.IsSmallerThan(Value, other.Value));
290 
291  return BooleanNull;
292  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Boolean(SqlBoolean value)
Definition: DataObject.cs:544
bool IsComparableTo(DataObject obj)
Checks if the given object is comparable to this object,
Definition: DataObject.cs:126
virtual SqlBoolean IsSmallerThan(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:237
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject Deveel.Data.DataObject.Modulus ( DataObject  other)
inline

Definition at line 419 of file DataObject.cs.

419  {
420  if (IsNull)
421  return this;
422 
423  var widerType = Type.Wider(other.Type);
424  var result = widerType.Modulus(Value, other.Value);
425  return new DataObject(widerType, result);
426  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
virtual ISqlObject Modulus(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:208
DataObject Deveel.Data.DataObject.Multiply ( DataObject  other)
inline

Definition at line 401 of file DataObject.cs.

401  {
402  if (IsNull)
403  return this;
404 
405  var widerType = Type.Wider(other.Type);
406  var result = widerType.Multiply(Value, other.Value);
407  return new DataObject(widerType, result);
408  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual ISqlObject Multiply(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:200
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
DataObject Deveel.Data.DataObject.Negate ( )
inline

Negates the current underlying value of the object.

The value negation is delegated to the underlying SqlType implementation set to this object: this means not all the objects will handle negation, but instead they will return a

See also
SqlNull

value.

Returns
This returns an instance of DataObject whose Value is the negation of the current handled value.
See also
SqlType.Negate

Definition at line 359 of file DataObject.cs.

359  {
360  if (IsNull)
361  return this;
362 
363  return new DataObject(Type, Type.Negate(Value));
364  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual ISqlObject Negate(ISqlObject value)
Definition: SqlType.cs:212
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static DataObject Deveel.Data.DataObject.Null ( SqlType  type)
inlinestatic

Definition at line 630 of file DataObject.cs.

630  {
631  return new DataObject(type, SqlNull.Value);
632  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static readonly SqlNull Value
Definition: SqlNull.cs:24
static DataObject Deveel.Data.DataObject.Null ( )
inlinestatic

Definition at line 634 of file DataObject.cs.

634  {
635  return Null(new NullType(SqlTypeCode.Null));
636  }
static DataObject Null()
Definition: DataObject.cs:634
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
A data type that represents the NULL value of a given SQL data type.
Definition: NullType.cs:29
static DataObject Deveel.Data.DataObject.Number ( SqlNumber  value)
inlinestatic

Definition at line 552 of file DataObject.cs.

552  {
553  return Number(PrimitiveTypes.Numeric(), value);
554  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
static DataObject Deveel.Data.DataObject.Number ( NumericType  type,
SqlNumber  value 
)
inlinestatic

Definition at line 556 of file DataObject.cs.

556  {
557  return new DataObject(type, value);
558  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static DataObject Deveel.Data.DataObject.Number ( NumericType  type,
int  value 
)
inlinestatic

Definition at line 560 of file DataObject.cs.

560  {
561  return new DataObject(type, new SqlNumber(value));
562  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static DataObject Deveel.Data.DataObject.Number ( NumericType  type,
long  value 
)
inlinestatic

Definition at line 564 of file DataObject.cs.

564  {
565  return new DataObject(type, new SqlNumber(value));
566  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
static implicit Deveel.Data.DataObject.operator bool ( DataObject  value)
inlinestatic

Definition at line 866 of file DataObject.cs.

866  {
867  if (ReferenceEquals(value, null) || value.IsNull)
868  throw new InvalidCastException("Cannot convert a NULL value to a boolean.");
869 
870  return (SqlBoolean) value.AsBoolean().Value;
871  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
DataObject AsBoolean()
Converts this object to a boolean type.
Definition: DataObject.cs:512
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static implicit Deveel.Data.DataObject.operator DateTime ( DataObject  value)
inlinestatic

Definition at line 901 of file DataObject.cs.

901  {
902  if (ReferenceEquals(value, null) || value.IsNull)
903  throw new InvalidCastException("Cannot convert NULL value to a non-nullable date time.");
904 
905  return ((SqlDateTime)value.AsDate().Value).ToDateTime();
906  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
DataObject AsDate()
Definition: DataObject.cs:532
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static implicit Deveel.Data.DataObject.operator DateTime? ( DataObject  value)
inlinestatic

Definition at line 894 of file DataObject.cs.

894  {
895  if (ReferenceEquals(value, null) || value.IsNull)
896  return null;
897 
898  return ((SqlDateTime) value.AsDate().Value).ToDateTime();
899  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
DataObject AsDate()
Definition: DataObject.cs:532
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static implicit Deveel.Data.DataObject.operator DBNull ( DataObject  value)
inlinestatic

Definition at line 909 of file DataObject.cs.

909  {
910  if (ReferenceEquals(value, null) || value.IsNull)
911  return DBNull.Value;
912 
913  throw new InvalidCastException("Cannot convert non-nullable value to DBNull.");
914  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
static bool Deveel.Data.DataObject.operator false ( DataObject  a)
inlinestatic

Definition at line 824 of file DataObject.cs.

824  {
826  }
static readonly DataObject BooleanFalse
The representation of a BOOLEAN false as DataObject
Definition: DataObject.cs:44
DataObject IsEqualTo(DataObject other)
Compares to the given object to verify if is it equal to the current.
Definition: DataObject.cs:251
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
static implicit Deveel.Data.DataObject.operator int ( DataObject  value)
inlinestatic

Definition at line 873 of file DataObject.cs.

873  {
874  if (ReferenceEquals(value, null) || value.IsNull)
875  throw new InvalidCastException("Cannot convert NULL value to integer.");
876 
877  return ((SqlNumber)value.AsInteger().Value).ToInt32();
878  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
DataObject AsInteger()
Definition: DataObject.cs:520
static implicit Deveel.Data.DataObject.operator long ( DataObject  value)
inlinestatic

Definition at line 880 of file DataObject.cs.

880  {
881  if (ReferenceEquals(value, null) || value.IsNull)
882  throw new InvalidCastException("Cannot convert NULL to long integer");
883 
884  return ((SqlNumber) value.AsBigInt().Value).ToInt64();
885  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
DataObject AsBigInt()
Definition: DataObject.cs:524
static implicit Deveel.Data.DataObject.operator string ( DataObject  value)
inlinestatic

Definition at line 887 of file DataObject.cs.

887  {
888  if (ReferenceEquals(value, null) || value.IsNull)
889  return null;
890 
891  return ((SqlString) value.AsVarChar().Value).Value;
892  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
DataObject AsVarChar()
Definition: DataObject.cs:528
static bool Deveel.Data.DataObject.operator true ( DataObject  a)
inlinestatic

Definition at line 820 of file DataObject.cs.

820  {
821  return a.IsEqualTo(DataObject.BooleanTrue);
822  }
static readonly DataObject BooleanTrue
The representation of a BOOLEAN true as DataObject
Definition: DataObject.cs:39
DataObject IsEqualTo(DataObject other)
Compares to the given object to verify if is it equal to the current.
Definition: DataObject.cs:251
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
static DataObject Deveel.Data.DataObject.operator! ( DataObject  value)
inlinestatic

Definition at line 846 of file DataObject.cs.

846  {
847  return value.Negate();
848  }
DataObject Negate()
Negates the current underlying value of the object.
Definition: DataObject.cs:359
static DataObject Deveel.Data.DataObject.operator!= ( DataObject  a,
DBNull  b 
)
inlinestatic

Definition at line 721 of file DataObject.cs.

721  {
722  return !(a == b);
723  }

The inequality operation between two DataObject instances.

Parameters
aThe first operand.
bThe second operand.
Returns
Returns an instance of DataObject that indicates the boolean inequality state of the two operands provided.
See also
IsNotEqualTo

Definition at line 737 of file DataObject.cs.

737  {
738  if (Equals(a, null) && Equals(b, null))
739  return BooleanNull;
740  if (Equals(a, null) || Equals(b, null))
741  return BooleanNull;
742 
743  return a.IsNotEqualTo(b);
744  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
DataObject IsNotEqualTo(DataObject other)
Compares to the given object to verify if is it not equal to the current.
Definition: DataObject.cs:273
static DataObject Deveel.Data.DataObject.operator% ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 802 of file DataObject.cs.

802  {
803  if (Equals(a, null) && Equals(b, null))
804  return Null();
805  if (Equals(a, null))
806  return Null();
807 
808  return a.Modulus(b);
809  }
override bool Equals(object obj)
Definition: DataObject.cs:179
DataObject Modulus(DataObject other)
Definition: DataObject.cs:419
static DataObject Null()
Definition: DataObject.cs:634
static DataObject Deveel.Data.DataObject.operator& ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 811 of file DataObject.cs.

811  {
812  if (Equals(a, null) && Equals(b, null))
813  return Null();
814  if (Equals(a, null))
815  return Null();
816 
817  return a.And(b);
818  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
DataObject And(DataObject other)
Definition: DataObject.cs:437
static DataObject Deveel.Data.DataObject.operator* ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 793 of file DataObject.cs.

793  {
794  if (Equals(a, null) && Equals(b, null))
795  return Null();
796  if (Equals(a, null))
797  return Null();
798 
799  return a.Multiply(b);
800  }
DataObject Multiply(DataObject other)
Definition: DataObject.cs:401
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
static DataObject Deveel.Data.DataObject.operator+ ( DataObject  a,
DataObject  b 
)
inlinestatic

The addition operator between two numeric values.

Parameters
aThe first operand.
bThe second operand.
Returns
Returns an instance of DataObject that is the numeric result of the addition of the two operands
See also
Add

Definition at line 756 of file DataObject.cs.

756  {
757  if (Equals(a, null) && Equals(b, null))
758  return Null();
759  if (Equals(a, null))
760  return Null();
761 
762  return a.Add(b);
763  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
DataObject Add(DataObject other)
Adds the given value to this object value.
Definition: DataObject.cs:383
static DataObject Deveel.Data.DataObject.operator+ ( DataObject  value)
inlinestatic

Definition at line 858 of file DataObject.cs.

858  {
859  return value.Plus();
860  }
static DataObject Deveel.Data.DataObject.operator- ( DataObject  a,
DataObject  b 
)
inlinestatic

The subtraction operator between two numeric values.

Parameters
aThe first operand.
bThe second operand.
Returns
Returns an instance of DataObject that is the numeric result of the subtraction of the two operands
See also
Subtract

Definition at line 775 of file DataObject.cs.

775  {
776  if (Equals(a, null) && Equals(b, null))
777  return Null();
778  if (Equals(a, null))
779  return Null();
780 
781  return a.Subtract(b);
782  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
DataObject Subtract(DataObject other)
Definition: DataObject.cs:392
static DataObject Deveel.Data.DataObject.operator- ( DataObject  value)
inlinestatic

Definition at line 850 of file DataObject.cs.

850  {
851  return value.Negate();
852  }
DataObject Negate()
Negates the current underlying value of the object.
Definition: DataObject.cs:359
static DataObject Deveel.Data.DataObject.operator/ ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 784 of file DataObject.cs.

784  {
785  if (Equals(a, null) && Equals(b, null))
786  return Null();
787  if (Equals(a, null))
788  return Null();
789 
790  return a.Divide(b);
791  }
override bool Equals(object obj)
Definition: DataObject.cs:179
DataObject Divide(DataObject other)
Definition: DataObject.cs:410
static DataObject Null()
Definition: DataObject.cs:634
static DataObject Deveel.Data.DataObject.operator== ( DataObject  a,
DataObject  b 
)
inlinestatic

The equality operation between two DataObject instances.

Parameters
aThe first operand.
bThe second operand.
Returns
Returns an instance of DataObject that indicates the boolean equality state of the two operands provided.
See also
IsEqualTo

Definition at line 704 of file DataObject.cs.

704  {
705  if (Equals(a, null) && Equals(b, null))
706  return BooleanNull;
707  if (Equals(a, null) || Equals(b, null))
708  return BooleanNull;
709 
710  return a.IsEqualTo(b);
711  }
override bool Equals(object obj)
Definition: DataObject.cs:179
DataObject IsEqualTo(DataObject other)
Compares to the given object to verify if is it equal to the current.
Definition: DataObject.cs:251
static readonly DataObject BooleanNull
The null representation of a BOOLEAN object.
Definition: DataObject.cs:49
static DataObject Deveel.Data.DataObject.operator== ( DataObject  a,
DBNull  b 
)
inlinestatic

Definition at line 714 of file DataObject.cs.

714  {
715  if (Equals(a, null) || a.IsNull)
716  return BooleanTrue;
717 
718  return BooleanFalse;
719  }
static readonly DataObject BooleanFalse
The representation of a BOOLEAN false as DataObject
Definition: DataObject.cs:44
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
override bool Equals(object obj)
Definition: DataObject.cs:179
static readonly DataObject BooleanTrue
The representation of a BOOLEAN true as DataObject
Definition: DataObject.cs:39
static DataObject Deveel.Data.DataObject.operator^ ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 837 of file DataObject.cs.

837  {
838  if (Equals(a, null) && Equals(b, null))
839  return Null();
840  if (Equals(a, null))
841  return Null();
842 
843  return a.XOr(b);
844  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
DataObject XOr(DataObject other)
Definition: DataObject.cs:446
static DataObject Deveel.Data.DataObject.operator| ( DataObject  a,
DataObject  b 
)
inlinestatic

Definition at line 828 of file DataObject.cs.

828  {
829  if (Equals(a, null) && Equals(b, null))
830  return Null();
831  if (Equals(a, null))
832  return Null();
833 
834  return a.Or(b);
835  }
override bool Equals(object obj)
Definition: DataObject.cs:179
static DataObject Null()
Definition: DataObject.cs:634
DataObject Or(DataObject other)
Definition: DataObject.cs:428
static DataObject Deveel.Data.DataObject.operator~ ( DataObject  value)
inlinestatic

Definition at line 854 of file DataObject.cs.

854  {
855  return value.Reverse();
856  }
DataObject Reverse()
Definition: DataObject.cs:469
DataObject Deveel.Data.DataObject.Or ( DataObject  other)
inline

Definition at line 428 of file DataObject.cs.

428  {
429  if (IsNull)
430  return this;
431 
432  var widerType = Type.Wider(other.Type);
433  var result = widerType.Or(Value, other.Value);
434  return new DataObject(widerType, result);
435  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
virtual ISqlObject Or(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:262
DataObject Deveel.Data.DataObject.Plus ( )
inline

Definition at line 366 of file DataObject.cs.

366  {
367  if (IsNull)
368  return this;
369 
370  return new DataObject(Type, Type.UnaryPlus(Value));
371  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual ISqlObject UnaryPlus(ISqlObject value)
Definition: SqlType.cs:270
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
DataObject Deveel.Data.DataObject.Reverse ( )
inline

Definition at line 469 of file DataObject.cs.

469  {
470  if (IsNull)
471  return this;
472 
473  return new DataObject(Type, Type.Reverse(Value));
474  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual ISqlObject Reverse(ISqlObject value)
Definition: SqlType.cs:274
static void Deveel.Data.DataObject.Serialize ( DataObject  obj,
BinaryWriter  writer 
)
inlinestatic

Definition at line 924 of file DataObject.cs.

924  {
925  if (Equals(obj, null)) {
926  writer.Write((byte)0);
927  return;
928  }
929 
930  writer.Write((byte)1);
931  TypeSerializer.SerializeTo(writer, obj.Type);
932  obj.Type.SerializeObject(writer.BaseStream, obj.Value);
933  }
static void SerializeTo(BinaryWriter writer, SqlType type)
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
override bool Equals(object obj)
Definition: DataObject.cs:179
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual void SerializeObject(Stream stream, ISqlObject obj)
Definition: SqlType.cs:399
void Deveel.Data.DataObject.SerializeValueTo ( Stream  stream,
ISystemContext  systemContext 
)
inline

Definition at line 920 of file DataObject.cs.

920  {
921  Type.SerializeObject(stream, Value);
922  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual void SerializeObject(Stream stream, ISqlObject obj)
Definition: SqlType.cs:399
static DataObject Deveel.Data.DataObject.SmallInt ( short  value)
inlinestatic

Definition at line 572 of file DataObject.cs.

572  {
573  return Number(PrimitiveTypes.Numeric(SqlTypeCode.SmallInt), value);
574  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.String ( string  s)
inlinestatic

Definition at line 592 of file DataObject.cs.

592  {
593  return String(new SqlString(s));
594  }
static DataObject String(string s)
Definition: DataObject.cs:592
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27
static DataObject Deveel.Data.DataObject.String ( SqlString  s)
inlinestatic

Definition at line 596 of file DataObject.cs.

596  {
597  return new DataObject(PrimitiveTypes.String(SqlTypeCode.String), s);
598  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
DataObject Deveel.Data.DataObject.Subtract ( DataObject  other)
inline

Definition at line 392 of file DataObject.cs.

392  {
393  if (IsNull)
394  return this;
395 
396  var widerType = Type.Wider(other.Type);
397  var result = widerType.Subtract(Value, other.Value);
398  return new DataObject(widerType, result);
399  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
virtual ISqlObject Subtract(ISqlObject a, ISqlObject b)
Definition: SqlType.cs:196
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305
static DataObject Deveel.Data.DataObject.Time ( SqlDateTime  value)
inlinestatic

Definition at line 618 of file DataObject.cs.

618  {
619  return Date(SqlTypeCode.Time, value);
620  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.TimeStamp ( SqlDateTime  value)
inlinestatic

Definition at line 610 of file DataObject.cs.

610  {
611  return Date(SqlTypeCode.TimeStamp, value);
612  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.TinyInt ( byte  value)
inlinestatic

Definition at line 568 of file DataObject.cs.

568  {
569  return Number(PrimitiveTypes.Numeric(SqlTypeCode.TinyInt), value);
570  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Number(SqlNumber value)
Definition: DataObject.cs:552
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static DataObject Deveel.Data.DataObject.VarChar ( string  s)
inlinestatic

Definition at line 622 of file DataObject.cs.

622  {
623  return VarChar(new SqlString(s));
624  }
static DataObject VarChar(string s)
Definition: DataObject.cs:622
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27
static DataObject Deveel.Data.DataObject.VarChar ( SqlString  s)
inlinestatic

Definition at line 626 of file DataObject.cs.

626  {
627  return new DataObject(PrimitiveTypes.String(SqlTypeCode.VarChar), s);
628  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
DataObject Deveel.Data.DataObject.XOr ( DataObject  other)
inline

Definition at line 446 of file DataObject.cs.

446  {
447  if (IsNull)
448  return this;
449 
450  var widerType = Type.Wider(other.Type);
451  var result = widerType.XOr(Value, other.Value);
452  return new DataObject(widerType, result);
453  }
DataObject(SqlType type, ISqlObject value)
Constructs a new database data object with a specific SqlType and handling the specified ISqlObject v...
Definition: DataObject.cs:61
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
virtual ISqlObject XOr(ISqlObject x, ISqlObject y)
Definition: SqlType.cs:266
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
virtual SqlType Wider(SqlType otherType)
Gets the one data-type between this and the other one given that handles the wider range of values...
Definition: SqlType.cs:305

Member Data Documentation

readonly DataObject Deveel.Data.DataObject.BooleanFalse = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.False)
static

The representation of a BOOLEAN false as DataObject

Definition at line 44 of file DataObject.cs.

readonly DataObject Deveel.Data.DataObject.BooleanNull = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.Null)
static

The null representation of a BOOLEAN object.

Definition at line 49 of file DataObject.cs.

readonly DataObject Deveel.Data.DataObject.BooleanTrue = new DataObject(PrimitiveTypes.Boolean(), SqlBoolean.True)
static

The representation of a BOOLEAN true as DataObject

Definition at line 39 of file DataObject.cs.

Property Documentation

int Deveel.Data.DataObject.CacheUsage
getpackage

Definition at line 100 of file DataObject.cs.

bool Deveel.Data.DataObject.IsCacheable
getpackage

Definition at line 104 of file DataObject.cs.

bool Deveel.Data.DataObject.IsNull
get

Gets a value that indicates if this object is materialized as null.

See also
SqlNull.Value, ISqlObject.IsNull

Definition at line 91 of file DataObject.cs.

int Deveel.Data.DataObject.Size
getpackage

Definition at line 108 of file DataObject.cs.

SqlType Deveel.Data.DataObject.Type
getprivate set

Gets the SqlType that defines the object properties

See also
SqlType

Definition at line 78 of file DataObject.cs.

ISqlObject Deveel.Data.DataObject.Value
getprivate set

Gets the underlined value that is handled.

See also
ISqlObject

Definition at line 84 of file DataObject.cs.


The documentation for this class was generated from the following file: