Esempio n. 1
0
        private DBField(PropertyInfo propertyInfo, DBFieldAttribute attribute)
        {
            this.propertyInfo = propertyInfo;
            this.attribute = attribute;

            // determine how this shoudl be stored in the DB
            type = DBDataType.TEXT;

            if (propertyInfo.PropertyType == typeof(string))
                type = DBDataType.TEXT;
            else if (propertyInfo.PropertyType == typeof(int))
                type = DBDataType.INTEGER;
            else if (propertyInfo.PropertyType == typeof(int?))
                type = DBDataType.INTEGER;
            else if (propertyInfo.PropertyType == typeof(long))
                type = DBDataType.LONG;
            else if (propertyInfo.PropertyType == typeof(long?))
                type = DBDataType.LONG;
            else if (propertyInfo.PropertyType == typeof(float))
                type = DBDataType.REAL;
            else if (propertyInfo.PropertyType == typeof(float?))
                type = DBDataType.REAL;
            else if (propertyInfo.PropertyType == typeof(double))
                type = DBDataType.REAL;
            else if (propertyInfo.PropertyType == typeof(double?))
                type = DBDataType.REAL;
            else if (propertyInfo.PropertyType == typeof(bool))
                type = DBDataType.BOOL;
            else if (propertyInfo.PropertyType == typeof(bool?))
                type = DBDataType.BOOL;
            else if (propertyInfo.PropertyType == typeof(Boolean))
                type = DBDataType.BOOL;
            else if (propertyInfo.PropertyType == typeof(DateTime))
                type = DBDataType.DATE_TIME;
            else if (propertyInfo.PropertyType == typeof(DateTime?))
                type = DBDataType.DATE_TIME;
            else if (propertyInfo.PropertyType == typeof(Type))
                type = DBDataType.TYPE;
            else if (propertyInfo.PropertyType.IsEnum)
                type = DBDataType.ENUM;
            // nullable enum
            else if (Nullable.GetUnderlyingType(propertyInfo.PropertyType) != null ? Nullable.GetUnderlyingType(propertyInfo.PropertyType).IsEnum : false)
                type = DBDataType.ENUM;
            else if (DatabaseManager.IsDatabaseTableType(propertyInfo.PropertyType))
                type = DBDataType.DB_OBJECT;
            else if (propertyInfo.PropertyType == typeof(DBField))
                type = DBDataType.DB_FIELD;
            else if (propertyInfo.PropertyType == typeof(DBRelation))
                type = DBDataType.DB_RELATION;
            else {
                // check for string object types
                foreach (Type currInterface in propertyInfo.PropertyType.GetInterfaces())
                    if (currInterface == typeof(IStringSourcedObject)) {
                        type = DBDataType.STRING_OBJECT;
                        return;
                    }
            }
        }
Esempio n. 2
0
 public DatabaseParameter(string Field, DBDataFormula DataFormula)
 {
     this.Field = string.Empty;
     this.Value = string.Empty;
     this.StringPattern = string.Empty;
     this.DataCompareStr = new string[] { " = ", " <> ", " > ", " < ", " >= ", " <= ", " IS ", " IS NOT ", " LIKE " };
     this.DataLinkageStr = new string[] { " AND ", " OR " };
     this.DataFormulaStr = new string[] { " GETDATE() ", " GETID() ", " NULL " };
     this.IsUnicode = false;
     this.IsNullable = false;
     this.DataType = DBDataType.String;
     this.DataCompare = DBCompareType.Equal;
     this.DataLinkage = DBLinkage.AND;
     this.SortBy = false;
     this.ASC = true;
     this.Field = Field;
     this.DataFormula = DataFormula;
     this.DataType = DBDataType.Formula;
 }
Esempio n. 3
0
 public DBColumn(char tableCharIn, string nameIn, DBDataType typeIn)
 {
     this.TableChar = tableCharIn;
     this.Name      = nameIn;
     this.Type      = typeIn;
 }
Esempio n. 4
0
 public static bool IsDateOrTimeOrDateTime(this DBDataType type)
 {
     return(type == DBDataType.DATE || type == DBDataType.DATE_TIME || type == DBDataType.TIME);
 }
Esempio n. 5
0
 /// <summary>
 ///     パラメータを追加する。
 /// </summary>
 /// <param name="name">パラメータ名</param>
 /// <param name="value">値</param>
 /// <param name="type">データベース型</param>
 public void AddParameter(string name, object value, DBDataType type)
 {
     this.AccessBase.AddParameter(name, value, type);
 }
Esempio n. 6
0
 public QType(DBDataType type)
 {
     // TODO: Complete member initialization
     this.type = type;
 }
Esempio n. 7
0
 public DataTypeInfo(DBDataType type, string sqlDataType, int length, int decimals) : base(type, sqlDataType, length, decimals)
 {
 }
 public abstract string GetDefaultValue(DBDataType type);
 /// <summary>
 /// Returns an SQL expression that transforms a value of a specified type, to be used in conditions and calculated columns.
 /// This implementation returns the value without making any modification to it.
 /// </summary>
 public virtual string TransformValue(string value, DBDataType type)
 {
     return(value);
 }