Ejemplo n.º 1
0
        /// <summary>
        /// Produce a valid sql string according to the column properties.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private string ProduceNewColumnQuery(ColumnVirtualization.ColumnItem item)
        {
            string sqlStr, strAllowNull = string.Empty, strPrimaryKey = string.Empty, strIdentity = string.Empty, strLen = string.Empty;
            string parsedType;  //Stores the type as a string according to database type
            string strCompressed = string.Empty;

            parsedType = ParseColType2string(item);
            //sqlStr += columnNewItem.Name + " " + columnNewItem.Type + columnNewItem.Len + " " + columnNewItem.AllowNull + " " + columnNewItem.PrimaryKey + " " + columnNewItem.Identity;
            if (item.Len != null)
            {
                strLen = "(" + item.Len.ToString() + ")";
            }

            if (item.Compressed == true)//used in access,default value false.
            {
                HandleCompressedCol(ref strCompressed);
            }

            if (item.AllowNull == false)
            {
                strAllowNull = "not null";
            }
            if (item.PrimaryKey == true)
            {
                strPrimaryKey = "primary key";
            }

            if (item.Identity == true)
            {
                HandleAutoIncreamentCol(ref strIdentity, ref parsedType);
            }

            sqlStr = item.Name + " " + parsedType + strLen + " " + strCompressed + " " + strAllowNull + " " + strPrimaryKey + " " + strIdentity;
            return(sqlStr);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public virtual string ParseColType2string(ColumnVirtualization.ColumnItem item)
        {
            string retVal = string.Empty;

            switch (item.ColType)
            {
            case ColumnVirtualization.ColumnType.boolean:
                retVal = "Bit";
                break;

            case ColumnVirtualization.ColumnType.DateTime:
                retVal = "DateTime";
                break;
            }
            return(retVal);
        }
Ejemplo n.º 3
0
        public override string ParseColType2string(ColumnVirtualization.ColumnItem item)
        {
            string retVal = string.Empty;

            switch (item.ColType)
            {
            case ColumnVirtualization.ColumnType.String:
                retVal = "Text";
                break;

            case ColumnVirtualization.ColumnType.Byte:
                retVal = "Byte";
                break;

            case ColumnVirtualization.ColumnType.Int:
                retVal = "smallint";
                break;

            case ColumnVirtualization.ColumnType.LongInteger:
                retVal = "integer";
                break;

            case ColumnVirtualization.ColumnType.Single:
                retVal = "single";
                break;

            case ColumnVirtualization.ColumnType.Double:
                retVal = "double";
                break;

            case ColumnVirtualization.ColumnType.Memo:    //#9366 - added new type
                retVal = "MEMO";
                break;


            //case ColumnVirtualization.ColumnType.AutoNumber:
            //    retVal = "AUTOINCREMENT";
            //    break;
            default:
                retVal = base.ParseColType2string(item);
                break;
            }
            return(retVal);
        }