DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Member Functions | List of all members
Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer Class Reference
Inheritance diagram for Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer:
Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlExpressionSerializer< SqlQueryExpression >

Public Member Functions

override void Serialize (SqlQueryExpression expression, BinaryWriter writer)
 
override SqlQueryExpression Deserialize (BinaryReader reader)
 

Private Member Functions

void SerializeSelectColumns (IEnumerable< SelectColumn > selectColumns, BinaryWriter writer)
 
IEnumerable< SelectColumnDeserializeSelectColumns (BinaryReader reader)
 

Additional Inherited Members

- Static Protected Member Functions inherited from Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlExpressionSerializer< SqlQueryExpression >
static void WriteExpression (SqlExpression expression, BinaryWriter writer)
 
static void WriteExpressions (SqlExpression[] expressions, BinaryWriter writer)
 
static SqlExpression ReadExpression (BinaryReader reader)
 
static SqlExpression[] ReadExpressions (BinaryReader reader)
 

Detailed Description

Definition at line 248 of file SqlExpressionSerializers.cs.

Member Function Documentation

override SqlQueryExpression Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer.Deserialize ( BinaryReader  reader)
inline

Definition at line 298 of file SqlExpressionSerializers.cs.

298  {
299  var selectColumns = DeserializeSelectColumns(reader);
300 
301  var queryExp = new SqlQueryExpression(selectColumns);
302 
303  var isDistinct = reader.ReadByte() == 1;
304  queryExp.Distinct = isDistinct;
305 
306  var hasFrom = reader.ReadByte() == 1;
307  if (hasFrom) {
308  queryExp.FromClause = FromClause.Deserialize(reader);
309  }
310 
311  var hasWhere = reader.ReadByte() == 1;
312  if (hasWhere)
313  queryExp.WhereExpression = SqlExpression.Deserialize(reader);
314 
315  var hasGroupMax = reader.ReadByte() == 1;
316  if (hasGroupMax)
317  queryExp.GroupMax = ObjectName.Deserialize(reader);
318 
319  var hasHaving = reader.ReadByte() == 1;
320  if (hasHaving)
321  queryExp.HavingExpression = SqlExpression.Deserialize(reader);
322 
323  return queryExp;
324  }
IEnumerable<SelectColumn> Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer.DeserializeSelectColumns ( BinaryReader  reader)
inlineprivate

Definition at line 326 of file SqlExpressionSerializers.cs.

326  {
327  var count = reader.ReadInt32();
328  var columns = new SelectColumn[count];
329  for (int i = 0; i < count; i++) {
330  columns[i] = SelectColumn.Deserialize(reader);
331  }
332 
333  return columns;
334  }
override void Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer.Serialize ( SqlQueryExpression  expression,
BinaryWriter  writer 
)
inline

Definition at line 249 of file SqlExpressionSerializers.cs.

249  {
250  SerializeSelectColumns(expression.SelectColumns, writer);
251 
252  writer.Write(expression.Distinct ? (byte)1 : (byte)0);
253 
254  if (expression.FromClause != null) {
255  writer.Write((byte) 1);
256  FromClause.Serialize(expression.FromClause, writer);
257  } else {
258  writer.Write((byte)0);
259  }
260 
261  if (expression.WhereExpression != null) {
262  writer.Write((byte) 1);
263  SqlExpression.Serialize(expression.WhereExpression, writer);
264  } else {
265  writer.Write((byte)0);
266  }
267 
268  if (expression.GroupBy != null) {
269  throw new NotImplementedException();
270  }
271 
272  if (expression.GroupMax != null) {
273  writer.Write((byte) 1);
274  ObjectName.Serialize(expression.GroupMax, writer);
275  } else {
276  writer.Write((byte)0);
277  }
278 
279  if (expression.HavingExpression != null) {
280  writer.Write((byte) 1);
281  SqlExpression.Serialize(expression.HavingExpression, writer);
282  } else {
283  writer.Write((byte)0);
284  }
285 
286  // TODO: Composites!!
287  }
void SerializeSelectColumns(IEnumerable< SelectColumn > selectColumns, BinaryWriter writer)
void Deveel.Data.Sql.Expressions.SqlExpressionSerializers.SqlQueryExpressionSerializer.SerializeSelectColumns ( IEnumerable< SelectColumn selectColumns,
BinaryWriter  writer 
)
inlineprivate

Definition at line 289 of file SqlExpressionSerializers.cs.

289  {
290  var list = selectColumns == null ? new List<SelectColumn>() : selectColumns.ToList();
291  writer.Write(list.Count);
292  for (int i = 0; i < list.Count; i++) {
293  var column = list[i];
294  SelectColumn.Serialize(column, writer);
295  }
296  }

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