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

Public Member Functions

void ParseSimpleCreateView ()
 
void ParseCreateViewWithColumns ()
 
void ParseCreateViewWithOrReplace ()
 
void ExecuteSimpleCreateView ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

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

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 27 of file CreateViewStatementTests.cs.

Member Function Documentation

override ISession Deveel.Data.Sql.Statements.CreateViewStatementTests.CreateAdminSession ( IDatabase  database)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 29 of file CreateViewStatementTests.cs.

29  {
30  using (var session = base.CreateAdminSession(database)) {
31  using (var query = session.CreateQuery()) {
32  var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
33  tableInfo.AddColumn("a", PrimitiveTypes.Integer());
34  tableInfo.AddColumn("b", PrimitiveTypes.String(), false);
35 
36  query.CreateTable(tableInfo, false, false);
37  query.Commit();
38  }
39  }
40 
41  return base.CreateAdminSession(database);
42  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
void AddColumn(ColumnInfo column)
Adds a new column to the table at the last position of the columns list in the table metadata...
Definition: TableInfo.cs:230
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
void Deveel.Data.Sql.Statements.CreateViewStatementTests.ExecuteSimpleCreateView ( )
inline

Definition at line 97 of file CreateViewStatementTests.cs.

97  {
98  const string sql = "CREATE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
99 
100  IEnumerable<SqlStatement> statements = null;
101  Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
102  Assert.IsNotNull(statements);
103 
104  var list = statements.ToList();
105 
106  Assert.AreEqual(1, list.Count);
107 
108  var statement = list[0];
109 
110  Assert.IsNotNull(statement);
111  Assert.IsInstanceOf<CreateViewStatement>(statement);
112 
113  ITable result = null;
114  Assert.DoesNotThrow(() => result = statement.Execute(Query));
115  Assert.IsNotNull(result);
116  Assert.AreEqual(1, result.RowCount);
117  }
Defines the contract to access the data contained into a table of a database.
Definition: ITable.cs:40
void Deveel.Data.Sql.Statements.CreateViewStatementTests.ParseCreateViewWithColumns ( )
inline

Definition at line 65 of file CreateViewStatementTests.cs.

65  {
66  const string sql = "CREATE VIEW text_view1 (a, b, c) AS SELECT * FROM test_table WHERE a = 1";
67 
68  IEnumerable<SqlStatement> statements = null;
69  Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
70  Assert.IsNotNull(statements);
71 
72  var statementList = statements.ToList();
73  Assert.IsNotEmpty(statementList);
74  Assert.AreEqual(1, statementList.Count);
75  Assert.IsInstanceOf<CreateViewStatement>(statementList[0]);
76 
77  var createView = (CreateViewStatement)statementList[0];
78  }
void Deveel.Data.Sql.Statements.CreateViewStatementTests.ParseCreateViewWithOrReplace ( )
inline

Definition at line 81 of file CreateViewStatementTests.cs.

81  {
82  const string sql = "CREATE OR REPLACE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
83 
84  IEnumerable<SqlStatement> statements = null;
85  Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
86  Assert.IsNotNull(statements);
87 
88  var statementList = statements.ToList();
89  Assert.IsNotEmpty(statementList);
90  Assert.AreEqual(1, statementList.Count);
91  Assert.IsInstanceOf<CreateViewStatement>(statementList[0]);
92 
93  var createView = (CreateViewStatement)statementList[0];
94  }
void Deveel.Data.Sql.Statements.CreateViewStatementTests.ParseSimpleCreateView ( )
inline

Definition at line 45 of file CreateViewStatementTests.cs.

45  {
46  const string sql = "CREATE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
47 
48  var statements = SqlStatement.Parse(sql);
49  Assert.IsNotNull(statements);
50 
51  var statementList = statements.ToList();
52  Assert.IsNotEmpty(statementList);
53  Assert.AreEqual(1, statementList.Count);
54  Assert.IsInstanceOf<CreateViewStatement>(statementList[0]);
55 
56  var createView = (CreateViewStatement) statementList[0];
57  Assert.IsNotNull(createView.SourceQuery);
58  Assert.IsTrue(createView.IsFromQuery);
59 
60  Assert.IsNotNull(createView.ViewName);
61  }

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