DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Deveel.Data.Sql.JoinTableTests Class Reference
Inheritance diagram for Deveel.Data.Sql.JoinTableTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void NaturalInnerJoin ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

override void OnSetUp (string testName)
 
- Protected Member Functions inherited from Deveel.Data.ContextBasedTest
virtual void RegisterServices (ServiceContainer container)
 
virtual ISystem CreateSystem ()
 
virtual IDatabase CreateDatabase (ISystem system, IConfiguration configuration)
 
virtual ISession CreateAdminSession (IDatabase database)
 
virtual IQuery CreateQuery (ISession session)
 
ISession CreateUserSession (string userName, string password)
 
virtual void OnTearDown ()
 

Private Member Functions

void AddTestData ()
 
void CreateTestTables ()
 
TableInfo CreateSecondTable ()
 
TableInfo CreateFirstTable ()
 

Additional Inherited Members

- Protected Attributes inherited from Deveel.Data.ContextBasedTest
const string AdminUserName = "SA"
 
const string AdminPassword = "1234567890"
 
const string DatabaseName = "testdb"
 
- Properties inherited from Deveel.Data.ContextBasedTest
virtual bool SingleContext [get]
 
IQuery Query [get, private set]
 
ISystem System [get, private set]
 
IDatabase Database [get, private set]
 
ISession Session [get, private set]
 

Detailed Description

Definition at line 28 of file JoinTableTests.cs.

Member Function Documentation

void Deveel.Data.Sql.JoinTableTests.AddTestData ( )
inlineprivate

Definition at line 34 of file JoinTableTests.cs.

34  {
35  var table = Query.GetMutableTable(new ObjectName(new ObjectName("APP"), "persons"));
36 
37  var row = table.NewRow();
38  row["person_id"] = DataObject.Integer(1);
39  row["name"] = DataObject.String("Antonello Provenzano");
40  row["age"] = DataObject.Integer(34);
41  table.AddRow(row);
42 
43  row = table.NewRow();
44  row["person_id"] = DataObject.Integer(3);
45  row["name"] = DataObject.String("John Doe");
46  row["age"] = DataObject.Integer(56);
47  table.AddRow(row);
48 
49  table = Query.GetMutableTable(new ObjectName(new ObjectName("APP"), "codes"));
50  row = table.NewRow();
51  row["person_id"] = DataObject.Integer(1);
52  row["code"] = DataObject.String("123456");
53  row["registered"] = DataObject.Date(new SqlDateTime(2014, 01, 12));
54  table.AddRow(row);
55  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
static DataObject Integer(int value)
Definition: DataObject.cs:576
static DataObject String(string s)
Definition: DataObject.cs:592
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
TableInfo Deveel.Data.Sql.JoinTableTests.CreateFirstTable ( )
inlineprivate

Definition at line 75 of file JoinTableTests.cs.

75  {
76  var tableInfo = new TableInfo(new ObjectName(new ObjectName("APP"), "persons"));
77  tableInfo.AddColumn("person_id", PrimitiveTypes.Integer());
78  tableInfo.AddColumn("name", PrimitiveTypes.String());
79  tableInfo.AddColumn("age", PrimitiveTypes.Integer());
80 
81  return tableInfo;
82  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
TableInfo Deveel.Data.Sql.JoinTableTests.CreateSecondTable ( )
inlineprivate

Definition at line 66 of file JoinTableTests.cs.

66  {
67  var tableInfo = new TableInfo(new ObjectName(new ObjectName("APP"), "codes"));
68  tableInfo.AddColumn("person_id", PrimitiveTypes.Integer());
69  tableInfo.AddColumn("code", PrimitiveTypes.String());
70  tableInfo.AddColumn("registered", PrimitiveTypes.DateTime());
71 
72  return tableInfo;
73  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
void Deveel.Data.Sql.JoinTableTests.CreateTestTables ( )
inlineprivate

Definition at line 57 of file JoinTableTests.cs.

57  {
58  var tableInfo = CreateFirstTable();
59  Query.CreateTable(tableInfo);
60  Query.AddPrimaryKey(tableInfo.TableName, "person_id");
61 
62  tableInfo = CreateSecondTable();
63  Query.CreateTable(tableInfo);
64  }
void Deveel.Data.Sql.JoinTableTests.NaturalInnerJoin ( )
inline

Definition at line 85 of file JoinTableTests.cs.

85  {
86  SqlExpression expression = null;
87  Assert.DoesNotThrow(() => expression = SqlExpression.Parse("SELECT * FROM persons, codes"));
88  Assert.IsNotNull(expression);
89  Assert.IsInstanceOf<SqlQueryExpression>(expression);
90 
91  SqlExpression resultExpression = null;
92  Assert.DoesNotThrow(() => resultExpression = expression.Evaluate(Query, null));
93  Assert.IsNotNull(resultExpression);
94  Assert.IsInstanceOf<SqlConstantExpression>(resultExpression);
95 
96  var constantExpression = (SqlConstantExpression) resultExpression;
97  Assert.IsInstanceOf<QueryType>(constantExpression.Value.Type);
98 
99  var queryPlan = ((SqlQueryObject) constantExpression.Value.Value);
100  ITable result = null;
101 
102  Assert.DoesNotThrow(() => result = queryPlan.QueryPlan.Evaluate(Query));
103 
104  Assert.IsNotNull(result);
105  }
Defines the contract to access the data contained into a table of a database.
Definition: ITable.cs:40
static SqlExpression Parse(string s)
Parses the given SQL string to an expression that can be evaluated.
virtual SqlExpression Evaluate(EvaluateContext context)
When overridden by a derived class, this method evaluates the expression within the provided context...
An expression that holds a constant value.
Defines the base class for instances that represent SQL expression tree nodes.
override void Deveel.Data.Sql.JoinTableTests.OnSetUp ( string  testName)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 29 of file JoinTableTests.cs.


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