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

Static Public Member Functions

static DataObject XmlType (DataObject obj)
 
static SqlXmlNode XmlType (ISqlBinary binary)
 
static SqlXmlNode XmlType (ISqlString s)
 
static DataObject AppendChild (DataObject obj, DataObject xpath, DataObject value)
 
static SqlXmlNode AppendChild (SqlXmlNode node, string xpath, SqlXmlNode value)
 
static DataObject Extract (DataObject obj, DataObject xpath)
 
static SqlXmlNode Extract (SqlXmlNode node, string xpath)
 
static DataObject ExtractValue (DataObject obj, DataObject xpath)
 
static ISqlObject ExtractValue (SqlXmlNode node, string xpath)
 
static DataObject Delete (DataObject obj, DataObject xpath)
 
static SqlXmlNode Delete (SqlXmlNode node, string xpath)
 
static DataObject Exists (DataObject obj, DataObject xpath)
 
static DataObject Exists (DataObject obj, string xpath)
 
static DataObject InsertChild (DataObject obj, DataObject xpath, DataObject child, DataObject value)
 
static SqlXmlNode InsertChild (SqlXmlNode node, string xpath, SqlXmlNode child, SqlXmlNode value)
 
static DataObject InsertBefore (DataObject obj, DataObject xpath, DataObject value)
 
static DataObject InsertBefore (DataObject obj, string xpath, DataObject value)
 
static SqlXmlNode Update (SqlXmlNode node, string xpath, DataObject value)
 
static DataObject Update (DataObject obj, DataObject xpath, DataObject value)
 

Properties

static IRoutineResolver Resolver [get]
 

Static Private Member Functions

static string GetXPath (DataObject xpath)
 
static SqlXmlNode GetXmlNode (DataObject node)
 

Detailed Description

Definition at line 10 of file XmlFunctions.cs.

Member Function Documentation

static DataObject Deveel.Data.Xml.XmlFunctions.AppendChild ( DataObject  obj,
DataObject  xpath,
DataObject  value 
)
inlinestatic

Definition at line 101 of file XmlFunctions.cs.

101  {
102  var result = AppendChild(GetXmlNode(obj), GetXPath(xpath), GetXmlNode(value));
103  return new DataObject(XmlNodeType.XmlType, result);
104  }
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static SqlXmlNode GetXmlNode(DataObject node)
Definition: XmlFunctions.cs:22
static DataObject AppendChild(DataObject obj, DataObject xpath, DataObject value)
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.AppendChild ( SqlXmlNode  node,
string  xpath,
SqlXmlNode  value 
)
inlinestatic

Definition at line 107 of file XmlFunctions.cs.

107  {
108  return node.AppendChild(xpath, value);
109  }
SqlXmlNode AppendChild(string xpath, SqlXmlNode value)
Definition: SqlXmlNode.cs:190
static DataObject Deveel.Data.Xml.XmlFunctions.Delete ( DataObject  obj,
DataObject  xpath 
)
inlinestatic

Definition at line 138 of file XmlFunctions.cs.

138  {
139  var result = Delete(GetXmlNode(obj), GetXPath(xpath));
140  return new DataObject(XmlNodeType.XmlType, result);
141  }
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static SqlXmlNode GetXmlNode(DataObject node)
Definition: XmlFunctions.cs:22
static DataObject Delete(DataObject obj, DataObject xpath)
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.Delete ( SqlXmlNode  node,
string  xpath 
)
inlinestatic

Definition at line 143 of file XmlFunctions.cs.

143  {
144  return node.Delete(xpath);
145  }
SqlXmlNode Delete(string xpath)
Definition: SqlXmlNode.cs:194
static DataObject Deveel.Data.Xml.XmlFunctions.Exists ( DataObject  obj,
DataObject  xpath 
)
inlinestatic

Definition at line 147 of file XmlFunctions.cs.

147  {
148  return Exists(obj, GetXPath(xpath));
149  }
static DataObject Exists(DataObject obj, DataObject xpath)
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static DataObject Deveel.Data.Xml.XmlFunctions.Exists ( DataObject  obj,
string  xpath 
)
inlinestatic

Definition at line 151 of file XmlFunctions.cs.

151  {
152  throw new NotImplementedException();
153  }
static DataObject Deveel.Data.Xml.XmlFunctions.Extract ( DataObject  obj,
DataObject  xpath 
)
inlinestatic

Definition at line 111 of file XmlFunctions.cs.

111  {
112  var result = Extract(GetXmlNode(obj), GetXPath(xpath));
113  return new DataObject(XmlNodeType.XmlType, result);
114  }
static DataObject Extract(DataObject obj, DataObject xpath)
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static SqlXmlNode GetXmlNode(DataObject node)
Definition: XmlFunctions.cs:22
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.Extract ( SqlXmlNode  node,
string  xpath 
)
inlinestatic

Definition at line 116 of file XmlFunctions.cs.

116  {
117  return node.Extract(xpath);
118  }
SqlXmlNode Extract(string xpath)
Definition: SqlXmlNode.cs:121
static DataObject Deveel.Data.Xml.XmlFunctions.ExtractValue ( DataObject  obj,
DataObject  xpath 
)
inlinestatic

Definition at line 120 of file XmlFunctions.cs.

120  {
121  var result = ExtractValue(GetXmlNode(obj), GetXPath(xpath));
122 
123  SqlType resultType = PrimitiveTypes.String();
124  if (result is ISqlBinary)
125  resultType = PrimitiveTypes.Binary();
126  else if (result is SqlNumber)
127  resultType = PrimitiveTypes.Numeric();
128 
129  // TODO: Support more types
130 
131  return new DataObject(resultType, result);
132  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static BinaryType Binary(int maxSize)
static DataObject ExtractValue(DataObject obj, DataObject xpath)
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static NumericType Numeric()
static SqlXmlNode GetXmlNode(DataObject node)
Definition: XmlFunctions.cs:22
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33
Defines the required contract of a SQL BINARY object
Definition: ISqlBinary.cs:25
static ISqlObject Deveel.Data.Xml.XmlFunctions.ExtractValue ( SqlXmlNode  node,
string  xpath 
)
inlinestatic

Definition at line 134 of file XmlFunctions.cs.

134  {
135  return node.ExtractValue(xpath);
136  }
ISqlObject ExtractValue(string xpath)
Definition: SqlXmlNode.cs:137
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.GetXmlNode ( DataObject  node)
inlinestaticprivate

Definition at line 22 of file XmlFunctions.cs.

22  {
23  if (!(node.Type is XmlNodeType))
24  throw new ArgumentException();
25 
26  return node.Value as SqlXmlNode;
27  }
static string Deveel.Data.Xml.XmlFunctions.GetXPath ( DataObject  xpath)
inlinestaticprivate

Definition at line 15 of file XmlFunctions.cs.

15  {
16  if (!(xpath.Type is StringType))
17  throw new ArgumentException();
18 
19  return xpath.AsVarChar().Value.ToString();
20  }
static DataObject Deveel.Data.Xml.XmlFunctions.InsertBefore ( DataObject  obj,
DataObject  xpath,
DataObject  value 
)
inlinestatic

Definition at line 163 of file XmlFunctions.cs.

163  {
164  return InsertBefore(obj, GetXPath(xpath), value);
165  }
static DataObject InsertBefore(DataObject obj, DataObject xpath, DataObject value)
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static DataObject Deveel.Data.Xml.XmlFunctions.InsertBefore ( DataObject  obj,
string  xpath,
DataObject  value 
)
inlinestatic

Definition at line 167 of file XmlFunctions.cs.

167  {
168  throw new NotImplementedException();
169  }
static DataObject Deveel.Data.Xml.XmlFunctions.InsertChild ( DataObject  obj,
DataObject  xpath,
DataObject  child,
DataObject  value 
)
inlinestatic

Definition at line 155 of file XmlFunctions.cs.

155  {
156  throw new NotImplementedException();
157  }
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.InsertChild ( SqlXmlNode  node,
string  xpath,
SqlXmlNode  child,
SqlXmlNode  value 
)
inlinestatic

Definition at line 159 of file XmlFunctions.cs.

159  {
160  return node.InsertChild(xpath, child, value);
161  }
SqlXmlNode InsertChild(string xpath, SqlXmlNode child, SqlXmlNode value)
Definition: SqlXmlNode.cs:206
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.Update ( SqlXmlNode  node,
string  xpath,
DataObject  value 
)
inlinestatic

Definition at line 171 of file XmlFunctions.cs.

171  {
172  return node.Update(xpath, value.Value);
173  }
bool Update(string xpath, object value, string xmlNs, out byte[] updated)
Definition: SqlXmlNode.cs:105
static DataObject Deveel.Data.Xml.XmlFunctions.Update ( DataObject  obj,
DataObject  xpath,
DataObject  value 
)
inlinestatic

Definition at line 175 of file XmlFunctions.cs.

175  {
176  var result = Update(GetXmlNode(obj), GetXPath(xpath), value);
177  return new DataObject(XmlNodeType.XmlType, result);
178  }
static string GetXPath(DataObject xpath)
Definition: XmlFunctions.cs:15
static SqlXmlNode GetXmlNode(DataObject node)
Definition: XmlFunctions.cs:22
static SqlXmlNode Update(SqlXmlNode node, string xpath, DataObject value)
static DataObject Deveel.Data.Xml.XmlFunctions.XmlType ( DataObject  obj)
inlinestatic

Definition at line 29 of file XmlFunctions.cs.

29  {
30  if (obj.IsNull)
31  return new DataObject(XmlNodeType.XmlType, SqlNull.Value);
32 
33  var value = obj.Value;
34  SqlXmlNode xmlNode;
35 
36  if (value is ISqlBinary) {
37  xmlNode = XmlType((ISqlBinary) value);
38  } else if (value is ISqlString) {
39  xmlNode = XmlType((ISqlString) value);
40  } else {
41  throw new NotSupportedException();
42  }
43 
44  return new DataObject(XmlNodeType.XmlType, xmlNode);
45  }
static readonly SqlNull Value
Definition: SqlNull.cs:24
static DataObject XmlType(DataObject obj)
Definition: XmlFunctions.cs:29
Defines the required contract of a SQL BINARY object
Definition: ISqlBinary.cs:25
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.XmlType ( ISqlBinary  binary)
inlinestatic

Definition at line 47 of file XmlFunctions.cs.

47  {
48  var len = binary.Length;
49  var content = new byte[len];
50  var offset = 0;
51 
52  const int bufferSize = 1024 * 10;
53 
54  using (var stream = binary.GetInput()) {
55  using (var reader = new BinaryReader(stream)) {
56  while (true) {
57  var buffer = new byte[bufferSize];
58  var readCount = reader.Read(buffer, 0, bufferSize);
59 
60  Array.Copy(buffer, 0, content, offset, readCount);
61 
62  if (readCount == 0)
63  break;
64 
65  offset += readCount;
66  }
67  }
68  }
69 
70  return new SqlXmlNode(content);
71  }
long Length
Gets the raw length of the binary object.
Definition: ISqlBinary.cs:29
Stream GetInput()
Gets an object used to read the contents of the binary
static SqlXmlNode Deveel.Data.Xml.XmlFunctions.XmlType ( ISqlString  s)
inlinestatic

Definition at line 73 of file XmlFunctions.cs.

73  {
74  var len = s.Length;
75  var content = new char[len];
76  var offset = 0;
77 
78  const int bufferSize = 1024*10;
79 
80  using (var reader = s.GetInput(s.Encoding)) {
81  while (true) {
82  var buffer = new char[bufferSize];
83  var readCount = reader.Read(buffer, 0, bufferSize);
84 
85  if (readCount == 0)
86  break;
87 
88  Array.Copy(buffer, 0, content, offset, readCount);
89 
90  offset += readCount;
91  }
92  }
93 
94  var bytes = s.Encoding.GetBytes(content);
95  if (!s.Encoding.Equals(Encoding.UTF8))
96  bytes = Encoding.Convert(s.Encoding, Encoding.UTF8, bytes);
97 
98  return new SqlXmlNode(bytes);
99  }
TextReader GetInput(Encoding encoding)

Property Documentation

IRoutineResolver Deveel.Data.Xml.XmlFunctions.Resolver
staticget

Definition at line 11 of file XmlFunctions.cs.


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