当前位置: 首页>>代码示例>>C#>>正文


C# Schema.GetTableName方法代码示例

本文整理汇总了C#中Schema.GetTableName方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.GetTableName方法的具体用法?C# Schema.GetTableName怎么用?C# Schema.GetTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema.GetTableName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public static void Add(Schema schema)
        {
            if (CheckTableExists(schema))
            {
                Delete(schema);
            }

            StringBuilder columns = new StringBuilder();

            schema = schema.AsActual();

            foreach (var column in schema.Columns.Where(it => !it.IsSystemField))
            {
                columns.AppendFormat(",`{0}` {1}", column.Name, ColumnTypeDefinition(column));
            }

            string ddl = string.Format(createTable, schema.GetTableName(), columns.ToString(), MysqlSettings.Instance.DEFAULT_CHARSET);

            ExecuteDDL(schema.Repository, ddl);
        }
开发者ID:Godoy,项目名称:CMS,代码行数:20,代码来源:SchemaManager.cs

示例2: CheckTableExists

        private static bool CheckTableExists(Schema schema)
        {
            string sql = string.Format(@"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '{0}'", schema.GetTableName());

            MySqlCommand command = new MySqlCommand() { CommandText = sql };

            return (long)MysqlHelper.ExecuteScalar(schema.Repository, command) != 0;
        }
开发者ID:Godoy,项目名称:CMS,代码行数:8,代码来源:SchemaManager.cs

示例3: Delete

 public static void Delete(Schema schema)
 {
     DropTable(schema.Repository, schema.GetTableName());
 }
开发者ID:Godoy,项目名称:CMS,代码行数:4,代码来源:SchemaManager.cs

示例4: ExportSchemaData

 public IEnumerable<IDictionary<string, object>> ExportSchemaData(Schema schema)
 {
     var connectionString = schema.Repository.GetConnectionString();
     string sql = string.Format("SELECT * FROM [{0}] ", schema.GetTableName());
     List<IDictionary<string, object>> list = new List<IDictionary<string, object>>();
     SqlCeConnection connection;
     using (var reader = SQLCeHelper.ExecuteReader(connectionString, new SqlCeCommand() { CommandText = sql }, out connection))
     {
         try
         {
             while (reader.Read())
             {
                 list.Add(reader.ToContent<TextContent>(new TextContent()));
             }
         }
         finally
         {
             reader.Close();
             connection.Close();
         }
     }
     return list;
 }
开发者ID:jason1234,项目名称:CMS,代码行数:23,代码来源:TextContentProvider.cs

示例5: Delete

 public static void Delete(Schema schema)
 {
     string ddl = string.Format(dropTable, schema.GetTableName());
     ExecuteDDL(schema.Repository, ddl);
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:5,代码来源:SchemaManager.cs

示例6: CheckTableExists

        private static bool CheckTableExists(Schema schema)
        {
            string sql = string.Format(@"SELECT count(*)
            FROM INFORMATION_SCHEMA.TABLES
            WHERE TABLE_NAME = '{0}' AND TABLE_TYPE='TABLE'", schema.GetTableName());

            SqlCeCommand command = new SqlCeCommand() { CommandText = sql };

            return (int)SQLCeHelper.ExecuteScalar(schema.Repository.GetConnectionString(), command) != 0;
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:10,代码来源:SchemaManager.cs

示例7: ExportSchemaData

 public IEnumerable<IDictionary<string, object>> ExportSchemaData(Schema schema)
 {
     string sql = string.Format("SELECT * FROM `{0}` ", schema.GetTableName());
     List<TextContent> list = new List<TextContent>();
     MySqlConnection connection;
     using (var reader = MysqlHelper.ExecuteReader(schema.Repository, new MySqlCommand() { CommandText = sql }, out connection))
     {
         while (reader.Read())
         {
             list.Add(reader.ToContent<TextContent>(new TextContent()));
         }
         connection.Close();
     }
     return list;
 }
开发者ID:Godoy,项目名称:CMS,代码行数:15,代码来源:TextContentProvider.cs


注:本文中的Schema.GetTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。