16 using System.Collections.Generic;
23 using NUnit.Framework;
25 namespace Deveel.Data.Sql.Statements {
30 using (var session = base.CreateAdminSession(database)) {
31 using (var query = session.CreateQuery()) {
36 query.CreateTable(tableInfo,
false,
false);
41 return base.CreateAdminSession(database);
46 const string sql =
"CREATE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
49 Assert.IsNotNull(statements);
51 var statementList = statements.ToList();
52 Assert.IsNotEmpty(statementList);
53 Assert.AreEqual(1, statementList.Count);
57 Assert.IsNotNull(createView.SourceQuery);
58 Assert.IsTrue(createView.IsFromQuery);
60 Assert.IsNotNull(createView.ViewName);
66 const string sql =
"CREATE VIEW text_view1 (a, b, c) AS SELECT * FROM test_table WHERE a = 1";
68 IEnumerable<SqlStatement> statements = null;
70 Assert.IsNotNull(statements);
72 var statementList = statements.ToList();
73 Assert.IsNotEmpty(statementList);
74 Assert.AreEqual(1, statementList.Count);
82 const string sql =
"CREATE OR REPLACE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
84 IEnumerable<SqlStatement> statements = null;
86 Assert.IsNotNull(statements);
88 var statementList = statements.ToList();
89 Assert.IsNotEmpty(statementList);
90 Assert.AreEqual(1, statementList.Count);
98 const string sql =
"CREATE VIEW text_view1 AS SELECT * FROM test_table WHERE a = 1";
100 IEnumerable<SqlStatement> statements = null;
102 Assert.IsNotNull(statements);
104 var list = statements.ToList();
106 Assert.AreEqual(1, list.Count);
108 var statement = list[0];
110 Assert.IsNotNull(statement);
114 Assert.DoesNotThrow(() => result = statement.Execute(
Query));
115 Assert.IsNotNull(result);
116 Assert.AreEqual(1, result.RowCount);
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
void ParseCreateViewWithOrReplace()
Defines the contract to access the data contained into a table of a database.
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
override ISession CreateAdminSession(IDatabase database)
void ParseSimpleCreateView()
static NumericType Integer()
Describes the name of an object within a database.
The representation of a single database in the system.
void ExecuteSimpleCreateView()
Represents the foundation class of SQL statements to be executed.
void AddColumn(ColumnInfo column)
Adds a new column to the table at the last position of the columns list in the table metadata...
An isolated session to a given database for a given user, encapsulating the transaction for operation...
static StringType String()
static IEnumerable< SqlStatement > Parse(string sqlSource)
Parses a given string into one of more statements.
Defines the metadata properties of a table existing within a database.
void ParseCreateViewWithColumns()