コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sqlTable"></param>
        /// <returns></returns>
        public List <MySqlColumn> GetSqlColumns(MySqlTable sqlTable)
        {
            if (MySqlColumns == null)
            {
                return(new List <MySqlColumn>());
            }

            return(MySqlColumns.Where(w =>
                                      w.TableSchema == sqlTable.Schema &&
                                      w.TableName == sqlTable.Name).ToList());
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="postgresTable"></param>
        /// <returns></returns>
        private TableInfo ConvertToTableInfo(MySqlTable postgresTable)
        {
            var table = new TableInfo();

            table.Schema     = postgresTable.Schema;
            table.Name       = postgresTable.Name;
            table.Columns    = GetColumns(table, postgresTable);
            table.PrimaryKey = GetPrimaryKeyInfo(table, postgresTable);

            return(table);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        /// <param name="postgresTable"></param>
        /// <returns></returns>
        private PrimaryKeyInfo GetPrimaryKeyInfo(TableInfo table, MySqlTable postgresTable)
        {
            var sqlPrimaryKey = MySqlPrimaryKeyManager.GetPrimaryKey(postgresTable);

            if (sqlPrimaryKey == null)
            {
                return(null);
            }

            var primaryKey = new PrimaryKeyInfo();

            primaryKey.Name          = sqlPrimaryKey.ConstraintName;
            primaryKey.Table         = table;
            primaryKey.PrimaryColumn = table.GetColumn(sqlPrimaryKey.ColumnName);
            return(primaryKey);
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="table"></param>
 /// <returns></returns>
 public MySqlPrimaryKey GetPrimaryKey(MySqlTable table)
 {
     return(MySqlPrimaryKeys?.FirstOrDefault(f =>
                                             f.TableSchema == table.Schema &&
                                             f.TableName == table.Name));
 }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        /// <param name="postgresTable"></param>
        /// <returns></returns>
        private List <ColumnInfo> GetColumns(TableInfo table, MySqlTable postgresTable)
        {
            var columns = MySqlColumnManager.GetSqlColumns(postgresTable);

            return(columns.Select(s => ConvertToColumnInfo(table, s)).ToList());
        }