DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | List of all members
Deveel.Data.Sql.Compile.AlterTableCompileTests Class Reference
Inheritance diagram for Deveel.Data.Sql.Compile.AlterTableCompileTests:
Deveel.Data.Sql.Compile.CursorCompileTests Deveel.Data.Sql.Compile.SqlCompileTestBase

Public Member Functions

void AddColumn ()
 
void AddMultipleColumns ()
 
void AddColumnsAndUniqeContraints ()
 
void AddPrimaryKeyContraint ()
 
void DropColumn ()
 
- Public Member Functions inherited from Deveel.Data.Sql.Compile.CursorCompileTests
void DeclareCursorWithArguments ()
 
void ImplicitDeclareCursor ()
 
void DeclareCursorWithoutArguments ()
 
void OpenCursorWithArguments ()
 
void OpenCursorSimple ()
 
void CloseCursor ()
 
void FetchNextFromCursorInto ()
 
void FetchNextImplicitCursor ()
 

Additional Inherited Members

- Protected Member Functions inherited from Deveel.Data.Sql.Compile.SqlCompileTestBase
SqlCompileResult Compile (string sql)
 

Detailed Description

Definition at line 11 of file AlterTableCompileTests.cs.

Member Function Documentation

void Deveel.Data.Sql.Compile.AlterTableCompileTests.AddColumn ( )
inline

Definition at line 13 of file AlterTableCompileTests.cs.

13  {
14  const string sql = "ALTER TABLE test ADD COLUMN b INT NOT NULL";
15 
16  var result = Compile(sql);
17  Assert.IsNotNull(result);
18  Assert.IsFalse(result.HasErrors);
19  Assert.IsNotEmpty(result.Statements);
20  Assert.AreEqual(1, result.Statements.Count);
21 
22  var statement = result.Statements.First();
23 
24  Assert.IsNotNull(statement);
25  Assert.IsInstanceOf<AlterTableStatement>(statement);
26 
27  var alterStatement = (AlterTableStatement) statement;
28 
29  Assert.AreEqual("test", alterStatement.TableName.FullName);
30  Assert.IsInstanceOf<AddColumnAction>(alterStatement.Action);
31 
32  var alterAction = (AddColumnAction) alterStatement.Action;
33  Assert.AreEqual("b", alterAction.Column.ColumnName);
34  Assert.IsInstanceOf<NumericType>(alterAction.Column.ColumnType);
35  Assert.IsTrue(alterAction.Column.IsNotNull);
36  }
void Deveel.Data.Sql.Compile.AlterTableCompileTests.AddColumnsAndUniqeContraints ( )
inline

Definition at line 51 of file AlterTableCompileTests.cs.

51  {
52  const string sql = "ALTER TABLE test ADD COLUMN b INT NOT NULL ADD CONSTRAINT c UNIQUE(a, b)";
53 
54  var result = Compile(sql);
55  Assert.IsNotNull(result);
56  Assert.IsFalse(result.HasErrors);
57  Assert.IsNotEmpty(result.Statements);
58  Assert.AreEqual(2, result.Statements.Count);
59 
60  var firstStatement = result.Statements.ElementAt(0);
61  var secondStatement = result.Statements.ElementAt(1);
62 
63  Assert.IsNotNull(firstStatement);
64  Assert.IsNotNull(secondStatement);
65 
66  Assert.IsInstanceOf<AlterTableStatement>(firstStatement);
67  Assert.IsInstanceOf<AlterTableStatement>(secondStatement);
68 
69  var alter1 = (AlterTableStatement) firstStatement;
70  var alter2 = (AlterTableStatement) secondStatement;
71 
72  Assert.IsInstanceOf<AddColumnAction>(alter1.Action);
73  Assert.IsInstanceOf<AddConstraintAction>(alter2.Action);
74  }
void Deveel.Data.Sql.Compile.AlterTableCompileTests.AddMultipleColumns ( )
inline

Definition at line 40 of file AlterTableCompileTests.cs.

40  {
41  const string sql = "ALTER TABLE test ADD COLUMN b INT NOT NULL ADD c VARCHAR DEFAULT 'test'";
42 
43  var result = Compile(sql);
44  Assert.IsNotNull(result);
45  Assert.IsFalse(result.HasErrors);
46  Assert.IsNotEmpty(result.Statements);
47  Assert.AreEqual(2, result.Statements.Count);
48  }
void Deveel.Data.Sql.Compile.AlterTableCompileTests.AddPrimaryKeyContraint ( )
inline

Definition at line 77 of file AlterTableCompileTests.cs.

77  {
78  const string sql = "ALTER TABLE test ADD CONSTRAINT c PRIMARY KEY(id)";
79 
80  var result = Compile(sql);
81  Assert.IsNotNull(result);
82  Assert.IsFalse(result.HasErrors);
83  Assert.IsNotEmpty(result.Statements);
84  Assert.AreEqual(1, result.Statements.Count);
85 
86  var statement = result.Statements.First();
87 
88  Assert.IsNotNull(statement);
89  Assert.IsInstanceOf<AlterTableStatement>(statement);
90 
91  var alterStatement = (AlterTableStatement) statement;
92 
93  Assert.AreEqual("test", alterStatement.TableName.FullName);
94  Assert.IsInstanceOf<AddConstraintAction>(alterStatement.Action);
95  }
void Deveel.Data.Sql.Compile.AlterTableCompileTests.DropColumn ( )
inline

Definition at line 98 of file AlterTableCompileTests.cs.

98  {
99  const string sql = "ALTER TABLE test DROP COLUMN b";
100 
101  var result = Compile(sql);
102  Assert.IsNotNull(result);
103  Assert.IsFalse(result.HasErrors);
104  Assert.IsNotEmpty(result.Statements);
105  Assert.AreEqual(1, result.Statements.Count);
106 
107  var statement = result.Statements.ElementAt(0);
108 
109  Assert.IsInstanceOf<AlterTableStatement>(statement);
110 
111  var alter = (AlterTableStatement) statement;
112 
113  Assert.IsInstanceOf<DropColumnAction>(alter.Action);
114  }

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