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

Public Member Functions

void InsertRegular ()
 
- 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 25 of file InsertTests.cs.

Member Function Documentation

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

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 26 of file InsertTests.cs.

26  {
27  using (var session = base.CreateAdminSession(database)) {
28  using (var query = session.CreateQuery()) {
29  var tableInfo = new TableInfo(ObjectName.Parse("APP.people"));
30  tableInfo.AddColumn("id", PrimitiveTypes.BigInt());
31  tableInfo.AddColumn("first_name", PrimitiveTypes.String(), true);
32  tableInfo.AddColumn("last_name", PrimitiveTypes.String());
33  tableInfo.AddColumn("age", PrimitiveTypes.TinyInt());
34 
35  query.CreateTable(tableInfo);
36  query.Commit();
37  }
38  }
39 
40  return base.CreateAdminSession(database);
41  }
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
static NumericType TinyInt(int size)
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
void Deveel.Data.Sql.InsertTests.InsertRegular ( )
inline

Definition at line 44 of file InsertTests.cs.

44  {
45  var tableName = ObjectName.Parse("APP.people");
46  var assignments = new SqlAssignExpression[] {
47  SqlExpression.Assign(SqlExpression.Reference(new ObjectName(tableName, "id")),
49  SqlExpression.Assign(SqlExpression.Reference(new ObjectName(tableName, "first_name")),
50  SqlExpression.Constant("Antonello")),
51  SqlExpression.Assign(SqlExpression.Reference(new ObjectName(tableName, "last_name")),
52  SqlExpression.Constant("Provenzano"))
53  };
54 
55  Query.InsertIntoTable(tableName, assignments);
56  }
static SqlAssignExpression Assign(SqlExpression reference, SqlExpression valueExpression)
static SqlReferenceExpression Reference(ObjectName objectName)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)

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