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.DeclareCursorStatementTests Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.DeclareCursorStatementTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void DeclareInsensitiveCursor_NoArguments ()
 
void DeclareCursorWithArguments ()
 
- 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 26 of file DeclareCursorStatementTests.cs.

Member Function Documentation

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

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 27 of file DeclareCursorStatementTests.cs.

27  {
28  using (var session = base.CreateAdminSession(database)) {
29  using (var query = session.CreateQuery()) {
30  var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
31  tableInfo.AddColumn("a", PrimitiveTypes.Integer());
32  tableInfo.AddColumn("b", PrimitiveTypes.String(), false);
33 
34  query.CreateTable(tableInfo, false, false);
35  query.Commit();
36  }
37  }
38 
39  return base.CreateAdminSession(database);
40  }
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.DeclareCursorStatementTests.DeclareCursorWithArguments ( )
inline

Definition at line 61 of file DeclareCursorStatementTests.cs.

61  {
62  const string sql = "DECLARE CURSOR c1 (arg1 INT, arg2 VARCHAR) IS SELECT * FROM test_table WHERE a = arg1";
63 
64  var statements = SqlStatement.Parse(sql);
65  Assert.IsNotNull(statements);
66 
67  var statementList = statements.ToList();
68  Assert.IsNotEmpty(statementList);
69  Assert.AreEqual(1, statementList.Count);
70  Assert.IsInstanceOf<DeclareCursorStatement>(statementList[0]);
71 
72  var statement = (DeclareCursorStatement)statementList[0];
73  Assert.AreEqual("c1", statement.CursorName);
74  Assert.IsNotEmpty(statement.Parameters);
75 
76  var arg1 = statement.Parameters.First();
77  Assert.IsNotNull(arg1);
78  Assert.AreEqual("arg1", arg1.ParameterName);
79  Assert.IsInstanceOf<NumericType>(arg1.ParameterType);
80  Assert.AreEqual(0, arg1.Offset);
81  }
void Deveel.Data.Sql.Statements.DeclareCursorStatementTests.DeclareInsensitiveCursor_NoArguments ( )
inline

Definition at line 43 of file DeclareCursorStatementTests.cs.

43  {
44  const string sql = "DECLARE CURSOR c1 INSENSITIVE IS SELECT * FROM test_table WHERE a = 1";
45 
46  var statements = SqlStatement.Parse(sql);
47  Assert.IsNotNull(statements);
48 
49  var statementList = statements.ToList();
50  Assert.IsNotEmpty(statementList);
51  Assert.AreEqual(1, statementList.Count);
52  Assert.IsInstanceOf<DeclareCursorStatement>(statementList[0]);
53 
54  var statement = (DeclareCursorStatement) statementList[0];
55  Assert.AreEqual("c1", statement.CursorName);
56  Assert.AreNotEqual(0, (statement.Flags & CursorFlags.Insensitive));
57  Assert.IsEmpty(statement.Parameters);
58  }

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