本文整理汇总了C#中TableInfo.AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C# TableInfo.AddColumn方法的具体用法?C# TableInfo.AddColumn怎么用?C# TableInfo.AddColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableInfo
的用法示例。
在下文中一共展示了TableInfo.AddColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SessionTableContainer
static SessionTableContainer()
{
// SYSTEM.OPEN_SESSIONS
OpenSessionsTableInfo = new TableInfo(SystemSchema.OpenSessionsTableName);
OpenSessionsTableInfo.AddColumn("username", PrimitiveTypes.String());
OpenSessionsTableInfo.AddColumn("host_string", PrimitiveTypes.String());
OpenSessionsTableInfo.AddColumn("last_command", PrimitiveTypes.DateTime());
OpenSessionsTableInfo.AddColumn("time_connected", PrimitiveTypes.DateTime());
OpenSessionsTableInfo = OpenSessionsTableInfo.AsReadOnly();
// SYSTEM.SESSION_INFO
SessionInfoTableInfo = new TableInfo(SystemSchema.SessionInfoTableName);
SessionInfoTableInfo.AddColumn("var", PrimitiveTypes.String());
SessionInfoTableInfo.AddColumn("value", PrimitiveTypes.String());
SessionInfoTableInfo = SessionInfoTableInfo.AsReadOnly();
// SYSTEM.STATS
StatisticsTableInfo = new TableInfo(SystemSchema.StatisticsTableName);
StatisticsTableInfo.AddColumn("stat_name", PrimitiveTypes.String());
StatisticsTableInfo.AddColumn("value", PrimitiveTypes.String());
StatisticsTableInfo = StatisticsTableInfo.AsReadOnly();
IntTableInfo = new TableInfo[3];
IntTableInfo[0] = StatisticsTableInfo;
IntTableInfo[1] = SessionInfoTableInfo;
IntTableInfo[2] = OpenSessionsTableInfo;
}
示例2: CreateAdminSession
protected override ISession CreateAdminSession(IDatabase database)
{
using (var session = base.CreateAdminSession(database)) {
using (var query = session.CreateQuery()) {
var tn1 = ObjectName.Parse("APP.test_table1");
var tableInfo1 = new TableInfo(tn1);
tableInfo1.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
tableInfo1.AddColumn(new ColumnInfo("name", PrimitiveTypes.String()));
tableInfo1.AddColumn(new ColumnInfo("date", PrimitiveTypes.DateTime()));
query.CreateTable(tableInfo1);
query.AddPrimaryKey(tn1, "id");
var tn2 = ObjectName.Parse("APP.test_table2");
var tableInfo2 = new TableInfo(tn2);
tableInfo2.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
tableInfo2.AddColumn(new ColumnInfo("other_id", PrimitiveTypes.Integer()));
tableInfo2.AddColumn(new ColumnInfo("count", PrimitiveTypes.Integer()));
query.CreateTable(tableInfo2);
query.AddPrimaryKey(tn2, "id");
query.AddForeignKey(tn2, new[] { "other_id" }, tn1, new[] { "id" }, ForeignKeyAction.Cascade, ForeignKeyAction.Cascade, null);
query.Commit();
}
}
return base.CreateAdminSession(database);
}
示例3: CreateSimpleTableAsAdmin
public void CreateSimpleTableAsAdmin()
{
var tableName = ObjectName.Parse("APP.test_table");
var tableInfo = new TableInfo(tableName);
tableInfo.AddColumn("a", PrimitiveTypes.Integer(), true);
tableInfo.AddColumn("b", PrimitiveTypes.String());
using (var session = Database.CreateUserSession(AdminUserName, AdminPassword)) {
using (var context = new SessionQueryContext(session)) {
Assert.DoesNotThrow(() => {
context.CreateTable(tableInfo);
});
}
Assert.DoesNotThrow(() => session.Commit());
}
using (var session = Database.CreateUserSession(AdminUserName, AdminPassword)) {
using (var context = new SessionQueryContext(session)) {
bool exists = false;
Assert.DoesNotThrow(() => exists = context.TableExists(tableName));
Assert.IsTrue(exists);
}
}
}
示例4: CreateTable
private void CreateTable(IQuery query)
{
var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
tableInfo.AddColumn("a", PrimitiveTypes.Integer());
tableInfo.AddColumn("b", PrimitiveTypes.String(), false);
query.CreateTable(tableInfo, false, false);
}
示例5: TestSetup
public void TestSetup()
{
var tableInfo = new TableInfo(ObjectName.Parse("APP.people"));
tableInfo.AddColumn("id", PrimitiveTypes.Bit());
tableInfo.AddColumn("first_name", PrimitiveTypes.String(), true);
tableInfo.AddColumn("last_name", PrimitiveTypes.String());
tableInfo.AddColumn("age", PrimitiveTypes.TinyInt());
table = new TemporaryTable(tableInfo);
var tempTable = (TemporaryTable) table;
tempTable.NewRow(new[] {
DataObject.BigInt(1),
DataObject.String("Antonello"),
DataObject.String("Provenzano"),
DataObject.Null()
});
tempTable.NewRow(new[] {
DataObject.BigInt(2),
DataObject.String("Moritz"),
DataObject.String("Krull"),
DataObject.TinyInt(31)
});
tempTable.BuildIndexes();
}
示例6: CreateQuery
protected override IQuery CreateQuery(ISession session)
{
var query = base.CreateQuery(session);
var tableInfo = new TableInfo(TestTableName);
tableInfo.AddColumn("id", PrimitiveTypes.Integer());
tableInfo.AddColumn("name", PrimitiveTypes.String());
tableInfo.AddColumn("date", PrimitiveTypes.DateTime());
query.CreateTable(tableInfo);
return query;
}
示例7: CreateQueryContext
protected override IQueryContext CreateQueryContext(IDatabase database)
{
var context = base.CreateQueryContext(database);
var tableInfo = new TableInfo(TestTableName);
tableInfo.AddColumn("id", PrimitiveTypes.Integer());
tableInfo.AddColumn("name", PrimitiveTypes.String());
tableInfo.AddColumn("date", PrimitiveTypes.DateTime());
return context;
}
示例8: OnSetUp
protected override bool OnSetUp(string testName, IQuery query)
{
if (testName != "RollbackTableCreate") {
var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table"));
tableInfo.AddColumn("a", PrimitiveTypes.Integer());
tableInfo.AddColumn("b", PrimitiveTypes.String());
query.Access().CreateObject(tableInfo);
}
return true;
}
示例9: CreateTable
private IMutableTable CreateTable()
{
var tableName = ObjectName.Parse("APP.test_table");
var tableInfo = new TableInfo(tableName);
tableInfo.AddColumn("name", PrimitiveTypes.String(), true);
tableInfo.AddColumn("age", PrimitiveTypes.Integer());
tableInfo.AddColumn("order", PrimitiveTypes.Integer());
Query.CreateTable(tableInfo);
return Query.GetMutableTable(tableName);
}
示例10: CreateTableInfo
private static TableInfo CreateTableInfo(string schema, string name)
{
var tableInfo = new TableInfo(new ObjectName(new ObjectName(schema), name));
tableInfo.AddColumn("type", PrimitiveTypes.Numeric());
tableInfo.AddColumn("on_object", PrimitiveTypes.String());
tableInfo.AddColumn("routine_name", PrimitiveTypes.String());
tableInfo.AddColumn("param_args", PrimitiveTypes.String());
tableInfo.AddColumn("owner", PrimitiveTypes.String());
return tableInfo.AsReadOnly();
}
示例11: Create
public void Create()
{
var tableInfo = new TableInfo(SystemSchema.ViewTableName);
tableInfo.AddColumn("schema", PrimitiveTypes.String());
tableInfo.AddColumn("name", PrimitiveTypes.String());
tableInfo.AddColumn("query", PrimitiveTypes.String());
tableInfo.AddColumn("plan", PrimitiveTypes.Binary());
// TODO: Columns...
Transaction.CreateTable(tableInfo);
}
示例12: Create
public void Create()
{
// SYSTEM.SCHEMA_INFO
var tableInfo = new TableInfo(SystemSchema.SchemaInfoTableName);
tableInfo.AddColumn("id", PrimitiveTypes.Numeric());
tableInfo.AddColumn("name", PrimitiveTypes.String());
tableInfo.AddColumn("type", PrimitiveTypes.String());
tableInfo.AddColumn("culture", PrimitiveTypes.String());
tableInfo.AddColumn("other", PrimitiveTypes.String());
tableInfo = tableInfo.AsReadOnly();
Transaction.CreateTable(tableInfo);
}
示例13: OnTableCompositeCreate
public void OnTableCompositeCreate(IQuery systemQuery)
{
var tableInfo = new TableInfo(ViewManager.ViewTableName);
tableInfo.AddColumn("schema", PrimitiveTypes.String());
tableInfo.AddColumn("name", PrimitiveTypes.String());
tableInfo.AddColumn("query", PrimitiveTypes.String());
tableInfo.AddColumn("plan", PrimitiveTypes.Binary());
// TODO: Columns...
systemQuery.Access().CreateTable(tableInfo);
}
示例14: CreateSimple_RegularUser
public void CreateSimple_RegularUser()
{
var tableName = ObjectName.Parse("APP.test_table");
var tableInfo = new TableInfo(tableName);
tableInfo.AddColumn("a", PrimitiveTypes.Integer(), true);
tableInfo.AddColumn("b", PrimitiveTypes.String());
using (var session = CreateUserSession(TestUserName, TestPassword)) {
using (var query = session.CreateQuery()) {
Assert.DoesNotThrow(() => query.CreateTable(tableInfo));
}
}
}
示例15: CreateTestView
private void CreateTestView(IQuery query)
{
var tn1 = ObjectName.Parse("APP.test_table1");
var tableInfo1 = new TableInfo(tn1);
tableInfo1.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
tableInfo1.AddColumn(new ColumnInfo("name", PrimitiveTypes.String()));
tableInfo1.AddColumn(new ColumnInfo("date", PrimitiveTypes.DateTime()));
query.CreateTable(tableInfo1);
query.AddPrimaryKey(tn1, "id");
var exp = SqlExpression.Parse("SELECT * FROM APP.test_table1");
query.ExecuteCreateView("APP.test_view1", (SqlQueryExpression) exp);
}