void Deveel.Data.Sql.Statements.CreateTableStatementTests.ParseSimpleCreate |
( |
| ) |
|
|
inline |
Definition at line 30 of file CreateTableStatementTests.cs.
31 const string sql =
"CREATE TABLE test (id INT, name VARCHAR)";
33 IEnumerable<SqlStatement> statements = null;
34 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
35 Assert.IsNotNull(statements);
37 var list = statements.ToList();
39 Assert.AreEqual(1, list.Count);
41 var statement = list[0];
43 Assert.IsNotNull(statement);
44 Assert.IsInstanceOf<CreateTableStatement>(statement);
46 var createTable = (CreateTableStatement) statement;
47 Assert.AreEqual(2, createTable.Columns.Count);
49 var columns = createTable.Columns;
51 Assert.AreEqual(
"id", columns[0].ColumnName);
52 Assert.AreEqual(
SqlTypeCode.Integer, columns[0].ColumnType.TypeCode);
54 Assert.AreEqual(
"name", columns[1].ColumnName);
55 Assert.IsInstanceOf<
StringType>(columns[1].ColumnType);
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
void Deveel.Data.Sql.Statements.CreateTableStatementTests.ParseWithColumnAndTableConstraints |
( |
| ) |
|
|
inline |
Definition at line 186 of file CreateTableStatementTests.cs.
187 const string sql =
"CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR NOT NULL, CONSTRAINT uk_test UNIQUE(name))";
189 IEnumerable<SqlStatement> statements = null;
190 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
191 Assert.IsNotNull(statements);
193 var list = statements.ToList();
195 Assert.AreEqual(3, list.Count);
void Deveel.Data.Sql.Statements.CreateTableStatementTests.ParseWithColumnConstraints |
( |
| ) |
|
|
inline |
Definition at line 173 of file CreateTableStatementTests.cs.
174 const string sql =
"CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR NOT NULL)";
176 IEnumerable<SqlStatement> statements = null;
177 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
178 Assert.IsNotNull(statements);
180 var list = statements.ToList();
182 Assert.AreEqual(2, list.Count);
void Deveel.Data.Sql.Statements.CreateTableStatementTests.ParseWithColumnDefault |
( |
| ) |
|
|
inline |
Definition at line 105 of file CreateTableStatementTests.cs.
106 const string sql =
"CREATE TABLE test (id INT, name VARCHAR DEFAULT (67 * 90)+22, date TIMESTAMP DEFAULT GetDate())";
108 IEnumerable<SqlStatement> statements = null;
109 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
110 Assert.IsNotNull(statements);
112 var list = statements.ToList();
114 Assert.AreEqual(1, list.Count);
116 var statement = list[0];
118 Assert.IsNotNull(statement);
119 Assert.IsInstanceOf<CreateTableStatement>(statement);
121 var createTable = (CreateTableStatement)statement;
122 Assert.AreEqual(3, createTable.Columns.Count);
124 var columns = createTable.Columns;
126 Assert.AreEqual(
"id", columns[0].ColumnName);
127 Assert.AreEqual(
SqlTypeCode.Integer, columns[0].ColumnType.TypeCode);
129 Assert.AreEqual(
"name", columns[1].ColumnName);
130 Assert.IsInstanceOf<
StringType>(columns[1].ColumnType);
131 Assert.IsTrue(columns[1].HasDefaultExpression);
134 Assert.AreEqual(
"date", columns[2].ColumnName);
135 Assert.IsInstanceOf<
DateType>(columns[2].ColumnType);
136 Assert.IsTrue(columns[1].HasDefaultExpression);
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
void Deveel.Data.Sql.Statements.CreateTableStatementTests.ParseWithColumnIdentity |
( |
| ) |
|
|
inline |
Definition at line 141 of file CreateTableStatementTests.cs.
142 const string sql =
"CREATE TABLE test (id INT IDENTITY, name VARCHAR NOT NULL)";
144 IEnumerable<SqlStatement> statements = null;
145 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
146 Assert.IsNotNull(statements);
148 var list = statements.ToList();
150 Assert.AreEqual(1, list.Count);
152 var statement = list[0];
154 Assert.IsNotNull(statement);
155 Assert.IsInstanceOf<CreateTableStatement>(statement);
157 var createTable = (CreateTableStatement)statement;
158 Assert.AreEqual(2, createTable.Columns.Count);
160 var columns = createTable.Columns;
162 Assert.AreEqual(
"id", columns[0].ColumnName);
163 Assert.AreEqual(
SqlTypeCode.Integer, columns[0].ColumnType.TypeCode);
164 Assert.IsNotNull(columns[0].DefaultExpression);
167 Assert.AreEqual(
"name", columns[1].ColumnName);
168 Assert.IsInstanceOf<
StringType>(columns[1].ColumnType);
169 Assert.IsTrue(columns[1].IsNotNull);
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
void Deveel.Data.Sql.Statements.CreateTableStatementTests.SimpleCreate |
( |
| ) |
|
|
inline |
Definition at line 59 of file CreateTableStatementTests.cs.
60 const string sql =
"CREATE TABLE test (id INT, name VARCHAR)";
62 IEnumerable<SqlStatement> statements = null;
63 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
64 Assert.IsNotNull(statements);
66 var list = statements.ToList();
68 Assert.AreEqual(1, list.Count);
70 var statement = list[0];
72 Assert.IsNotNull(statement);
73 Assert.IsInstanceOf<CreateTableStatement>(statement);
76 Assert.DoesNotThrow(() => result = statement.Execute(
Query));
77 Assert.IsNotNull(result);
78 Assert.AreEqual(1, result.RowCount);
Defines the contract to access the data contained into a table of a database.
void Deveel.Data.Sql.Statements.CreateTableStatementTests.WithColumnDefault |
( |
| ) |
|
|
inline |
Definition at line 82 of file CreateTableStatementTests.cs.
83 const string sql =
"CREATE TABLE test (id INT, name VARCHAR DEFAULT (67 * 90)+22, date TIMESTAMP DEFAULT GetDate())";
85 IEnumerable<SqlStatement> statements = null;
86 Assert.DoesNotThrow(() => statements = SqlStatement.Parse(sql));
87 Assert.IsNotNull(statements);
89 var list = statements.ToList();
91 Assert.AreEqual(1, list.Count);
93 var statement = list[0];
95 Assert.IsNotNull(statement);
96 Assert.IsInstanceOf<CreateTableStatement>(statement);
99 Assert.DoesNotThrow(() => result = statement.Execute(
Query));
100 Assert.IsNotNull(result);
101 Assert.AreEqual(1, result.RowCount);
Defines the contract to access the data contained into a table of a database.
The documentation for this class was generated from the following file: