Exemplo n.º 1
0
        public static List <FieldInfo> GetTableColumns(string connStr, DataTypes?dataType, string dataBase, string tableName)
        {
            var sql = string.Empty;

            switch (dataType)
            {
            case DataTypes.MYSQL:
            case DataTypes.ORACLE:
                sql = string.Format(Consts.Fields.OracleFieldsInfo, "USER_TAB_COLS.COLUMN_NAME AS ColumnName, USER_TAB_COLS.DATA_TYPE AS DataType," +
                                    "USER_TAB_COLS.DATA_LENGTH AS StringLength,USER_TAB_COLS.COLUMN_ID AS OrderNo", tableName);
                break;

            case DataTypes.SQLSERVER:
                sql = string.Format(Consts.Fields.SqlServerFieldsInfo, "COLUMN_NAME AS ColumnName,DATA_TYPE AS DataType,CHARACTER_MAXIMUM_LENGTH As StringLength,ORDINAL_POSITION AS OrderNo", dataBase, tableName);
                return(BaseUnity.GetTableColunmSql(connStr, tableName));

                break;

            default:
                return(null);
            }

            return(BaseUnity.QueryForList <FieldInfo>(connStr, dataType, sql, null));
        }
Exemplo n.º 2
0
 private static List <string> GetDataBaseInfoSqlServer(string connStr)
 {
     return(BaseUnity.QueryForListStr(connStr, DataTypes.SQLSERVER, Consts.DataBase.SqlServer, null));
 }
Exemplo n.º 3
0
        private static List <string> GetTablesInfoMysql(string connStr, string dataBase)
        {
            var sql = string.Format(Consts.Tables.MysqlAllTables, dataBase);

            return(BaseUnity.QueryForListStr(connStr, DataTypes.MYSQL, sql, null));
        }
Exemplo n.º 4
0
        private static List <string> GetTablesInfoOracle(string connStr, string dataBase)
        {
            var sql = string.Format(Consts.Tables.OracleAllTables, dataBase);

            return(BaseUnity.QueryForListStr(connStr, DataTypes.ORACLE, sql, null));
        }
Exemplo n.º 5
0
        private static List <string> GetTablesInfoSqlServer(string connStr, string dataBase)
        {
            var sql = string.Format(Consts.Tables.SqlServerAllTables, dataBase);

            return(BaseUnity.QueryForListStr(connStr, DataTypes.SQLSERVER, sql, null));
        }