예제 #1
0
        /// <summary>
        /// 查询某要素的表结构
        /// </summary>
        /// <param name="featureClass"></param>
        /// <returns></returns>
        public static Dictionary <string, string> QueryColumnInfo(IFeatureClass featureClass)
        {
            try
            {
                Dictionary <string, string> columnInfoSet = new Dictionary <string, string>();

                string columnIdentity = string.Empty;
                string columnDataType = string.Empty;

                for (int i = 0; i < featureClass.Fields.FieldCount; i++)
                {
                    columnIdentity = featureClass.Fields.get_Field(i).Name.ToUpper();
                    columnDataType = featureClass.Fields.get_Field(i).Type.ToString();

                    if (RegexCheck.IsExist(ScreenTemplate.ScreenAllowFieldType, columnDataType))
                    {
                        columnInfoSet.Add(columnIdentity, columnDataType);
                    }
                }

                return(columnInfoSet);
            }
            catch (Exception ex)
            {
                LogHelper.Error.Append(ex);

                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// 查询某用户具有权限的表空间
        /// </summary>
        /// <param name="dbHelper"></param>
        /// <returns></returns>
        public static List <string> QueryTablespace(IDBHelper dbHelper)
        {
            try
            {
                dbHelper.TryConnect();

                List <string> tablespaceSet = new List <string>();

                string[] sqlCommand = SqlTemplate.Select.SELECT_06.Split('@');

                DataTable tablespaceResultSet = dbHelper.DoQueryEx(sqlCommand[0]);

                string tablespace = string.Empty;

                for (int i = 0; i < tablespaceResultSet.Rows.Count; i++)
                {
                    tablespace = tablespaceResultSet.Rows[i][sqlCommand[1]].ToString();

                    if (!RegexCheck.IsExist(ScreenTemplate.ScreenLimitTablespace, tablespace))
                    {
                        tablespaceSet.Add(tablespace);
                    }
                }

                return(tablespaceSet);
            }
            catch (Exception ex)
            {
                LogHelper.Error.Append(ex);

                throw ex;
            }
        }
예제 #3
0
        /// <summary>
        /// 查询某普通表的表结构
        /// </summary>
        /// <param name="dbHelper"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public static Dictionary <string, string> QueryColumnInfo(IDBHelper dbHelper, string tableName)
        {
            try
            {
                dbHelper.TryConnect();

                Dictionary <string, string> columnInfoSet = new Dictionary <string, string>();

                List <DBColumnInfo> columnInfoResultSet = dbHelper.GetColumns(tableName);

                string columnIdentity   = string.Empty;
                int    columnDataTypeId = -1;
                string columnDataType   = string.Empty;

                for (int i = 0; i < columnInfoResultSet.Count; i++)
                {
                    columnIdentity   = columnInfoResultSet[i].Name.ToUpper();
                    columnDataTypeId = columnInfoResultSet[i].DataType.EnumDBFieldType;

                    switch (columnDataTypeId)
                    {
                    case (int)EnumDBFieldType.FTBlob:
                        columnDataType = EnumDBFieldType.FTBlob.ToString();
                        break;

                    case (int)EnumDBFieldType.FTDate:
                        columnDataType = EnumDBFieldType.FTDate.ToString();
                        break;

                    case (int)EnumDBFieldType.FTDatetime:
                        columnDataType = EnumDBFieldType.FTDatetime.ToString();
                        break;

                    case (int)EnumDBFieldType.FTNumber:
                        columnDataType = EnumDBFieldType.FTNumber.ToString();
                        break;

                    case (int)EnumDBFieldType.FTString:
                        columnDataType = EnumDBFieldType.FTString.ToString();
                        break;

                    case (int)EnumDBFieldType.UnKnown:
                        columnDataType = EnumDBFieldType.UnKnown.ToString();
                        break;

                    default:
                        break;
                    }

                    if (RegexCheck.IsExist(ScreenTemplate.ScreenAllowFieldType, columnDataType))
                    {
                        columnInfoSet.Add(columnIdentity, columnDataType);
                    }
                }

                return(columnInfoSet);
            }
            catch (Exception ex)
            {
                LogHelper.Error.Append(ex);

                throw ex;
            }
        }