16 using System.Collections.Generic;
25 using NUnit.Framework;
27 namespace Deveel.Data.Sql.Statements {
30 protected override void OnSetUp(
string testName) {
44 Query.CreateTable(tableInfo);
45 Query.AddPrimaryKey(tableInfo.TableName,
"id",
"PK_TEST_TABLE");
50 const string sql =
"ALTER TABLE test_table ADD COLUMN reserved BOOLEAN";
52 IEnumerable<SqlStatement> statements = null;
54 Assert.IsNotNull(statements);
56 var list = statements.ToList();
58 Assert.AreEqual(1, list.Count);
60 var statement = list[0];
62 Assert.IsNotNull(statement);
66 Assert.DoesNotThrow(() => result = statement.Execute(
Query));
67 Assert.IsNotNull(result);
68 Assert.AreEqual(1, result.RowCount);
69 Assert.AreEqual(1, result.TableInfo.ColumnCount);
70 Assert.AreEqual(0, ((
SqlNumber) result.GetValue(0,0).Value).ToInt32());
74 Assert.IsNotNull(testTable);
75 Assert.AreEqual(6, testTable.TableInfo.ColumnCount);
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
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.
static BooleanType Boolean()
static NumericType Integer()
Describes the name of an object within a database.
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...
override void OnSetUp(string testName)
static DateType DateTime()
static SqlReferenceExpression Reference(ObjectName objectName)
static StringType String()
Defines the base class for instances that represent SQL expression tree nodes.
void AlterTableAddColumn()
static SqlFunctionCallExpression FunctionCall(ObjectName functionName)
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.