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

Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength. More...

Inheritance diagram for Deveel.Data.Sql.Objects.SqlBinary:
Deveel.Data.Sql.Objects.ISqlBinary Deveel.Data.Sql.Objects.ISqlObject

Public Member Functions

 SqlBinary (byte[] source)
 
 SqlBinary (byte[] source, int length)
 
 SqlBinary (byte[] source, int offset, int length)
 
int IComparable. CompareTo (object obj)
 
int IComparable< ISqlObject >. CompareTo (ISqlObject other)
 
bool ISqlObject. IsComparableTo (ISqlObject other)
 Checks if the current object is comparable with the given one. More...
 
IEnumerator< byte > GetEnumerator ()
 
IEnumerator IEnumerable. GetEnumerator ()
 
Stream GetInput ()
 Gets an object used to read the contents of the binary More...
 
byte[] ToByteArray ()
 Returns an array of bytes representing the contents of the binary. More...
 

Public Attributes

const int MaxLength = Int32.MaxValue - 1
 A constant value defining the maximum allowed length of bytes that this binary can handle. More...
 

Static Public Attributes

static readonly SqlBinary Null = new SqlBinary(null)
 

Properties

bool IsNull [get]
 
long Length [get]
 
- Properties inherited from Deveel.Data.Sql.Objects.ISqlBinary
long Length [get]
 Gets the raw length of the binary object. More...
 
- Properties inherited from Deveel.Data.Sql.Objects.ISqlObject
bool IsNull [get]
 Gets a boolean value indicating if the object is NULL. More...
 

Private Attributes

readonly byte[] bytes
 

Detailed Description

Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength.

Definition at line 27 of file SqlBinary.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Objects.SqlBinary.SqlBinary ( byte[]  source)
inline

Definition at line 38 of file SqlBinary.cs.

39  : this(source, source == null ? 0 : source.Length) {
40  }
Deveel.Data.Sql.Objects.SqlBinary.SqlBinary ( byte[]  source,
int  length 
)
inline

Definition at line 42 of file SqlBinary.cs.

43  : this(source, 0, length) {
44  }
Deveel.Data.Sql.Objects.SqlBinary.SqlBinary ( byte[]  source,
int  offset,
int  length 
)
inline

Definition at line 46 of file SqlBinary.cs.

47  : this() {
48  if (source == null) {
49  bytes = null;
50  } else {
51  if (length > MaxLength)
52  throw new ArgumentOutOfRangeException("length");
53 
54  bytes = new byte[length];
55  Array.Copy(source, offset, bytes, 0, length);
56  }
57  }
const int MaxLength
A constant value defining the maximum allowed length of bytes that this binary can handle...
Definition: SqlBinary.cs:36

Member Function Documentation

int IComparable. Deveel.Data.Sql.Objects.SqlBinary.CompareTo ( object  obj)
inline

Definition at line 59 of file SqlBinary.cs.

59  {
60  return (this as IComparable<ISqlObject>).CompareTo((ISqlObject) obj);
61  }
int IComparable<ISqlObject>. Deveel.Data.Sql.Objects.SqlBinary.CompareTo ( ISqlObject  other)
inline

Definition at line 63 of file SqlBinary.cs.

63  {
64  throw new NotSupportedException();
65  }
IEnumerator<byte> Deveel.Data.Sql.Objects.SqlBinary.GetEnumerator ( )
inline

Definition at line 77 of file SqlBinary.cs.

77  {
78  throw new NotImplementedException();
79  }
IEnumerator IEnumerable. Deveel.Data.Sql.Objects.SqlBinary.GetEnumerator ( )
inline

Definition at line 81 of file SqlBinary.cs.

81  {
82  return GetEnumerator();
83  }
IEnumerator< byte > GetEnumerator()
Definition: SqlBinary.cs:77
Stream Deveel.Data.Sql.Objects.SqlBinary.GetInput ( )
inline

Gets an object used to read the contents of the binary

Implements Deveel.Data.Sql.Objects.ISqlBinary.

Definition at line 91 of file SqlBinary.cs.

91  {
92  if (IsNull)
93  return Stream.Null;
94 
95  return new MemoryStream(bytes, false);
96  }
bool ISqlObject. Deveel.Data.Sql.Objects.SqlBinary.IsComparableTo ( ISqlObject  other)
inline

Checks if the current object is comparable with the given one.

Parameters
otherThe other ISqlObject to compare.
Returns
Returns true if the current object is comparable with the given one, false otherwise.

Implements Deveel.Data.Sql.Objects.ISqlObject.

Definition at line 72 of file SqlBinary.cs.

72  {
73  return false;
74  }
byte [] Deveel.Data.Sql.Objects.SqlBinary.ToByteArray ( )
inline

Returns an array of bytes representing the contents of the binary.

Returns

Definition at line 102 of file SqlBinary.cs.

102  {
103  if (bytes == null)
104  return new byte[0];
105 
106  var destArray = new byte[bytes.Length];
107  Array.Copy(bytes, 0, destArray, 0, bytes.Length);
108  return destArray;
109  }

Member Data Documentation

readonly byte [] Deveel.Data.Sql.Objects.SqlBinary.bytes
private

Definition at line 28 of file SqlBinary.cs.

const int Deveel.Data.Sql.Objects.SqlBinary.MaxLength = Int32.MaxValue - 1

A constant value defining the maximum allowed length of bytes that this binary can handle.

See also
Length

Definition at line 36 of file SqlBinary.cs.

readonly SqlBinary Deveel.Data.Sql.Objects.SqlBinary.Null = new SqlBinary(null)
static

Definition at line 29 of file SqlBinary.cs.

Property Documentation

bool Deveel.Data.Sql.Objects.SqlBinary.IsNull
get

Definition at line 68 of file SqlBinary.cs.

long Deveel.Data.Sql.Objects.SqlBinary.Length
get

Definition at line 86 of file SqlBinary.cs.


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