Esempio n. 1
0
        public List <DbTableInfo> GetTablesWithPage(string tablename, string fieldNameToSort, bool isDescending, PagerInfo info)
        {
            List <DbTableInfo> list = new List <DbTableInfo>();

            if (dbType == DatabaseType.SqlServer)
            {
                MssqlExtractor mssqlExtractor = new MssqlExtractor();
                list = mssqlExtractor.GetAllTables(tablename, fieldNameToSort, isDescending, info);
            }
            else if (dbType == DatabaseType.MySql)
            {
                MySqlExtractor mysqlExtractor = new MySqlExtractor();
                list = mysqlExtractor.GetAllTables(this.dbName, tablename, fieldNameToSort, isDescending, info);
            }
            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取数据所有表信息
        /// </summary>
        /// <param name="tablelist">数据库表名称</param>
        /// <returns></returns>
        public List <DbTableInfo> GetWhereTables(string tablelist = null)
        {
            List <DbTableInfo> list = new List <DbTableInfo>();

            if (dbType == DatabaseType.SqlServer)
            {
                MssqlExtractor mssqlExtractor = new MssqlExtractor();
                list = mssqlExtractor.GetAllTables(tablelist);
            }
            else if (dbType == DatabaseType.MySql)
            {
                MySqlExtractor mssqlExtractor = new MySqlExtractor();
                list = mssqlExtractor.GetAllTables(this.dbName, tablelist);
            }
            return(list);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public List <DataBaseInfo> GetAllDataBases()
        {
            List <DataBaseInfo> list = new List <DataBaseInfo>();

            if (dbType == DatabaseType.SqlServer)
            {
                MssqlExtractor mssqlExtractor = new MssqlExtractor();
                list = mssqlExtractor.GetAllDataBases();
            }
            else if (dbType == DatabaseType.MySql)
            {
                MySqlExtractor mssqlExtractor = new MySqlExtractor();
                list = mssqlExtractor.GetAllDataBases();
            }
            return(list);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取表的所有字段名及字段类型
        /// </summary>
        /// <param name="tableName">数据表的名称</param>
        /// <returns></returns>
        public List <DbFieldInfo> GetAllColumns(string tableName)
        {
            List <DbFieldInfo> list = new List <DbFieldInfo>();

            if (dbType == DatabaseType.SqlServer)
            {
                MssqlExtractor mssqlExtractor = new MssqlExtractor();
                list = mssqlExtractor.GetAllColumns(tableName);
            }
            else if (dbType == DatabaseType.MySql)
            {
                MySqlExtractor mysqlExtractor = new MySqlExtractor();
                list = mysqlExtractor.GetAllColumns(this.dbName, tableName);
            }
            return(list);
        }
Esempio n. 5
0
        public DbExtractor()
        {
            MssqlExtractor mssqlExtractor = new MssqlExtractor();

            mssqlExtractor.OpenSharedConnection();
            YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper();
            string            dbTypeCache       = yuebonCacheHelper.Get("CodeGeneratorDbType").ToString();

            if (dbTypeCache != null)
            {
                dbType = (DatabaseType)Enum.Parse(typeof(DatabaseType), dbTypeCache);
            }
            object odbn = yuebonCacheHelper.Get("CodeGeneratorDbName");

            if (odbn != null)
            {
                dbName = odbn.ToString();
            }
        }