Beispiel #1
0
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnShowTables_Click(object sender, EventArgs e)
        {
            DataTable tb = null;

            Enumeration.DataBaseType type = (Enumeration.DataBaseType)cbxDataBase.SelectedIndex;
            //Generate gen = new Generate(type);

            if (type == Enumeration.DataBaseType.Oracle)
            {
                tb = new OracleInfo().DBTables(txtFilterTable.Text);
            }
            else if (type == Enumeration.DataBaseType.MySQL)
            {
                tb = new MySQLInfo().DBTables(txtFilterTable.Text);
            }
            else if (type == Enumeration.DataBaseType.MSSQL)
            {
                tb = new MSSQLInfo().DBTables(txtFilterTable.Text);
            }
            else if (type == Enumeration.DataBaseType.PostgreSQL)
            {
                tb = new PgInfo().DBTables(txtFilterTable.Text);
            }
            else
            {
            }

            this.dgvTables.DataSource = tb;

            //CheckAll();
        }
Beispiel #2
0
        /// <summary>
        /// 获取表的注释
        /// </summary>
        /// <param name="DBType"></param>
        /// <param name="dbTableName"></param>
        /// <returns></returns>
        public static string GetTableComments(Enumeration.DataBaseType DBType, string dbTableName)
        {
            string comment = null;

            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                comment = new OracleInfo().TableComments(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                comment = new MySQLInfo().TableComments(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                comment = new MSSQLInfo().TableComments(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.PostgreSQL)
            {
                comment = new PgInfo().TableComments(dbTableName);
            }
            else
            {
            }

            return(comment);
        }
Beispiel #3
0
        /// <summary>
        /// 选获取表的主键
        /// </summary>
        /// <param name="DBType"></param>
        /// <param name="dbTableName"></param>
        /// <returns></returns>
        public static List <string> GetPrimayKeys(Enumeration.DataBaseType DBType, string dbTableName)
        {
            List <string> keyList = null;

            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                keyList = new OracleInfo().GetPrimayKeys(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                keyList = new MySQLInfo().GetPrimayKeys(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                keyList = new MSSQLInfo().GetPrimayKeys(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.PostgreSQL)
            {
                keyList = new PgInfo().GetPrimayKeys(dbTableName);
            }
            else
            {
            }

            for (int i = 0; i < keyList.Count(); i++)
            {
                keyList[i] = Words.reWriteWord(keyList[i]);
            }

            return(keyList);
        }
Beispiel #4
0
        /// <summary>
        /// 选择数据库
        /// </summary>
        /// <param name="DBType"></param>
        /// <param name="dbTableName"></param>
        /// <returns></returns>
        public static DataTable SelectColumnsByTableName(Enumeration.DataBaseType DBType, string dbTableName)
        {
            DataTable dtColumns = null;

            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                dtColumns = new OracleInfo().getColumnsByTableName(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                dtColumns = new MySQLInfo().getColumnsByTableName(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                dtColumns = new MSSQLInfo().getColumnsByTableName(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.PostgreSQL)
            {
                dtColumns = new PgInfo().getColumnsByTableName(dbTableName);
            }
            else
            {
            }

            return(dtColumns);
        }
Beispiel #5
0
        private void dgvTables_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }
            //表中字段
            DataTable dtColumns = null;

            if (cbxDataBase.SelectedIndex == 0)
            {
                dtColumns = new OracleInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else if (cbxDataBase.SelectedIndex == 1)
            {
                dtColumns = new MySQLInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else if (cbxDataBase.SelectedIndex == 2)
            {
                dtColumns = new MSSQLInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else if (cbxDataBase.SelectedIndex == 3)
            {
                dtColumns = new PgInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else
            {
            }

            dtColumns.TableName = "Columns";
            createCorrespondingXmlWhenNotExist();

            //显示骆驼表示法列名
            for (int i = 0; i < dtColumns.Rows.Count; i++)
            {
                string name = dtColumns.Rows[i]["Column_Name"].ToString();
                //if (dic.ContainsKey(name))
                //{
                //    dtColumns.Rows[i]["CamelName"] = dic[name];
                //}
                dtColumns.Rows[i]["Camel_Name"] = PublicHelper.GetCamelName(name);
            }
            dtColumns.AcceptChanges();

            this.dgvColumns.DataSource = dtColumns;
            //this.dgvColumns.AutoResizeColumns();
        }
Beispiel #6
0
        /// <summary>
        /// 选择数据库
        /// </summary>
        /// <param name="DBType"></param>
        /// <param name="dbTableName"></param>
        /// <returns></returns>
        public static DataTable SelectColumnsByTableName(Enumeration.DataBaseType DBType, string dbTableName)
        {
            DataTable dtColumns = null;
            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                dtColumns = new OracleInfo().getColumnsByTableName(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                dtColumns = new MySQLInfo().getColumnsByTableName(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                dtColumns = new MSSQLInfo().getColumnsByTableName(dbTableName);
            }
            else {

            }

            return dtColumns;
        }
Beispiel #7
0
        public static List <string> GetNotNullColumns(Enumeration.DataBaseType DBType, string dbTableName)
        {
            List <string> keyList = null;

            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                keyList = new OracleInfo().GetNotNullColumns(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                keyList = new MySQLInfo().GetNotNullColumns(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                keyList = new MSSQLInfo().GetNotNullColumns(dbTableName);
            }
            else
            {
            }

            return(keyList);
        }
Beispiel #8
0
        private void btnShowTables_Click(object sender, EventArgs e)
        {
            DataTable tb = null;
            Enumeration.DataBaseType type = (Enumeration.DataBaseType)cbxDataBase.SelectedIndex;
            //Generate gen = new Generate(type);

            if (type == Enumeration.DataBaseType.Oracle)
            {
                tb = new OracleInfo().DBTables(txtFilterTable.Text);
            }
            else if (type == Enumeration.DataBaseType.MySQL)
            {
                tb = new MySQLInfo().DBTables(txtFilterTable.Text);
            }
            else if (type == Enumeration.DataBaseType.MSSQL)
            {
                tb = new MSSQLInfo().DBTables(txtFilterTable.Text);
            }
            else
            {
            }

            this.dgvTables.DataSource = tb;

            //CheckAll();
        }
Beispiel #9
0
        private void dgvTables_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }
            //表中字段
            DataTable dtColumns = null;
            if (cbxDataBase.SelectedIndex == 0)
            {
                dtColumns = new OracleInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else if (cbxDataBase.SelectedIndex == 1)
            {
                dtColumns = new MySQLInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else if (cbxDataBase.SelectedIndex == 2)
            {
                dtColumns = new MSSQLInfo().getColumnsByTableName(this.dgvTables.Rows[e.RowIndex].Cells["Table_Name"].Value.ToString());
            }
            else
            {

            }

            dtColumns.TableName = "Columns";
            createCorrespondingXmlWhenNotExist();

            //显示骆驼表示法列名
            for (int i = 0; i < dtColumns.Rows.Count; i++)
            {
                string name = dtColumns.Rows[i]["Column_Name"].ToString();
                //if (dic.ContainsKey(name))
                //{
                //    dtColumns.Rows[i]["CamelName"] = dic[name];
                //}
                dtColumns.Rows[i]["Camel_Name"] = PublicHelper.GetCamelName(name);
            }
            dtColumns.AcceptChanges();

            this.dgvColumns.DataSource = dtColumns;
            //this.dgvColumns.AutoResizeColumns();
        }
Beispiel #10
0
        public static List<string> SelectGetNotNullColumns(Enumeration.DataBaseType DBType, string dbTableName)
        {
            List<string> keyList = null;
            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                keyList = new OracleInfo().GetNotNullColumns(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                keyList = new MySQLInfo().GetNotNullColumns(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                keyList = new MSSQLInfo().GetNotNullColumns(dbTableName);
            }
            else {

            }

            return keyList;
        }
Beispiel #11
0
        public static string SelectTableComments(Enumeration.DataBaseType DBType, string dbTableName)
        {
            string comment = null;
            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                comment = new OracleInfo().TableComments(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                comment = new MySQLInfo().TableComments(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                comment = new MSSQLInfo().TableComments(dbTableName);
            }
            else {

            }

            return comment;
        }
Beispiel #12
0
        public static List<string> SelectGetPrimayKeys(Enumeration.DataBaseType DBType, string dbTableName)
        {
            List<string> keyList = null;
            if (DBType == Enumeration.DataBaseType.Oracle)
            {
                keyList = new OracleInfo().GetPrimayKeys(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MySQL)
            {
                keyList = new MySQLInfo().GetPrimayKeys(dbTableName);
            }
            else if (DBType == Enumeration.DataBaseType.MSSQL)
            {
                keyList = new MSSQLInfo().GetPrimayKeys(dbTableName);
            }
            else {

            }

            for (int i = 0; i < keyList.Count(); i++)
            {
                keyList[i] = Words.reWriteWord(keyList[i]);
            }

            return keyList;
        }