コード例 #1
0
ファイル: MysqlProvider.cs プロジェクト: Tony-Liang/Common
 public override IList<TriggersEntity> GetTriggers(DataBaseEntity database)
 {
     IList<TriggersEntity> list = null;
     using (MySqlConnection connection = new MySqlConnection(database.DbConnectionStringBuilder.ConnectionString))
     {
         connection.Open();
         MySqlCommand cmd = connection.CreateCommand();
         cmd.CommandText = "SHOW TRIGGERS";//"select * FROM SysObjects where xtype='TR'";
         cmd.CommandType = CommandType.Text;
         MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         if (reader != null && reader.HasRows)
         {
             list = new List<TriggersEntity>();
             while (reader.Read())
             {
                 string name = reader["Trigger"].ToString();
                 TriggersEntity tr = new TriggersEntity(database.DbConnectionStringBuilder, name, name);
                 tr.DataBase = database;
                 list.Add(tr);
             }
         }
     }
     return list;
 }
コード例 #2
0
ファイル: MysqlProvider.cs プロジェクト: Tony-Liang/Common
 public override IList<ViewEntity> GetViews(DataBaseEntity database)
 {
     IList<ViewEntity> list = null;
     using (MySqlConnection connection = new MySqlConnection(database.DbConnectionStringBuilder.ConnectionString))
     {
         connection.Open();
         DataTable views = connection.GetSchema(SqlClientMetaDataCollectionNames.Views, new string[] { null, null, null, null });
         if (views != null && views.Rows.Count > 0)
         {
             list = new List<ViewEntity>();
             foreach (DataRow table in views.Rows)
             {
                 string name = string.Format("{0}", table["TABLE_NAME"]);
                 string des = string.Format("{0}.{1}", table["TABLE_SCHEMA"], table["TABLE_NAME"]);
                 ViewEntity view = new ViewEntity(database.DbConnectionStringBuilder,name, des);
                 view.DataBase = database;
                 list.Add(view);
             }
         }
     }
     return list;
 }
コード例 #3
0
ファイル: MysqlProvider.cs プロジェクト: Tony-Liang/Common
 public override IList<ProcedureEntity> GetProcedures(DataBaseEntity database)
 {
     IList<ProcedureEntity> list = null;
     using (MySqlConnection connection = new MySqlConnection(database.DbConnectionStringBuilder.ConnectionString))
     {
         connection.Open();
         DataTable procedures = connection.GetSchema(SqlClientMetaDataCollectionNames.Procedures, new string[] { null, null, null, "PROCEDURE" });
         if (procedures != null && procedures.Rows.Count > 0)
         {
             list = new List<ProcedureEntity>();
             foreach (DataRow procedure in procedures.Rows)
             {
                 string name = string.Format("{0}", procedure["SPECIFIC_NAME"]);
                 string des = string.Format("{0}.{1}", procedure["ROUTINE_SCHEMA"], procedure["SPECIFIC_NAME"]);
                 ProcedureEntity proc = new ProcedureEntity(database.DbConnectionStringBuilder,name, des);
                 proc.DataBase = database;
                 list.Add(proc);
             }
         }
     }
     return list;
 }
コード例 #4
0
ファイル: MysqlProvider.cs プロジェクト: Tony-Liang/Common
 public override IList<TableEntity> GetTables(DataBaseEntity database)
 {
     IList<TableEntity> list = null;
     using (MySqlConnection connection = new MySqlConnection(database.DbConnectionStringBuilder.ConnectionString))
     {
         connection.Open();
         DataTable tables = connection.GetSchema(SqlClientMetaDataCollectionNames.Tables, new string[] { null, null, null, "BASE TABLE" });
         if (tables != null && tables.Rows.Count > 0)
         {
             list = new List<TableEntity>();
             foreach (DataRow table in tables.Rows)
             {
                 string name = string.Format("{0}", table["TABLE_NAME"]);
                 string des = string.Format("{0}.{1}", table["TABLE_SCHEMA"], table["TABLE_NAME"]);
                 TableEntity t = new TableEntity(database.DbConnectionStringBuilder,name, des);
                 t.DataBase = database;
                 list.Add(t);
             }
         }
     }
     return list;
 }
コード例 #5
0
ファイル: MysqlProvider.cs プロジェクト: Tony-Liang/Common
 public override IList<DataBaseEntity> GetDataBases(ServiceSite site)
 {
     IList<DataBaseEntity> list = null;
     using (MySqlConnection connection = new MySqlConnection(site.DbConnectionStringBuilder.ConnectionString))
     {
         connection.Open();
         DataTable databases = connection.GetSchema(SqlClientMetaDataCollectionNames.Databases, new string[] { null });
         if (databases != null && databases.Rows.Count > 0)
         {
             list = new List<DataBaseEntity>();
             foreach (DataRow database in databases.Rows)
             {
                 string name = (string)database["database_name"];
                 MySqlConnectionStringBuilder con = new MySqlConnectionStringBuilder(site.DbConnectionStringBuilder.ConnectionString);
                 con.Database = name;
                 DataBaseEntity db = new DataBaseEntity(con,name);
                 db.Service = site;
                 list.Add(db);
             }
         }
     }
     return list;
 }
コード例 #6
0
ファイル: ProviderBuilder.cs プロジェクト: Tony-Liang/Common
 public abstract IList<ViewEntity> GetViews(DataBaseEntity database);
コード例 #7
0
ファイル: ProviderBuilder.cs プロジェクト: Tony-Liang/Common
 public abstract IList<TriggersEntity> GetTriggers(DataBaseEntity database);
コード例 #8
0
ファイル: ProviderBuilder.cs プロジェクト: Tony-Liang/Common
 public abstract IList<TableEntity> GetTables(DataBaseEntity database);
コード例 #9
0
ファイル: ProviderBuilder.cs プロジェクト: Tony-Liang/Common
 public abstract IList<ProcedureEntity> GetProcedures(DataBaseEntity database);