示例#1
0
 public void AddParameter(string name, string value, bool isOutput)
 {
     ParameterName.Add(name);
     ParamaterValue.Add(value);
     ParamDirection.Add(isOutput);
     arraySize++;
 }
示例#2
0
 public ParamInfos(ParamType type, ParamDirection dir, ParamConnectType connectType, string name)
 {
     Type        = type;
     Direction   = dir;
     ConnectType = connectType;
     Name        = name;
 }
示例#3
0
 public DataParam(string name, CustomSqlTypes type, ParamDirection direction, string defval)
 {
     Name      = name;
     Type      = type;
     Default   = defval;
     Direction = direction;
 }
示例#4
0
 public ParameterDescriptor(object source, int index, string name, string type, ParamDirection direction)
 {
     Source    = source;
     Name      = name;
     Type      = type;
     Direction = direction;
 }
示例#5
0
 public ParamObj(string name, object value, SysDbType type, int size, ParamDirection direction)
 {
     this.name      = name;
     this.value     = value;
     this.type      = type;
     this.size      = size;
     this.direction = direction;
 }
示例#6
0
 public DBParams(string paramName, object paramValue, ParamType paramType, ParamDirection paramDirection)
 {
     sqlParam = new SqlParameter();
     sqlParam.ParameterName = paramName;
     sqlParam.Value         = paramValue;
     sqlParam.DbType        = (System.Data.DbType)((ParamType)paramType);
     sqlParam.Direction     = (System.Data.ParameterDirection)((ParamDirection)paramDirection);
 }
示例#7
0
 public ParamObj(string name, object value, SysDbType type, int size, ParamDirection direction)
 {
     this.name = name;
     this.value = value;
     this.type = type;
     this.size = size;
     this.direction = direction;
 }
示例#8
0
 public dbParameter(string Name, object Value, DbType Type = DbType.String
                    , ParamDirection Driection             = ParamDirection.In)
 {
     this.Name      = Name;
     this.Value     = Value;
     this.Type      = Type;
     this.Driection = Driection;
 }
示例#9
0
        /// <summary>
        /// 添加一个参数
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <param name="iDirection"></param>
        public void Append(string name, object value, ParamDirection iDirection = ParamDirection.IN)
        {
            JsonObject obj = new JsonObject();

            obj[name]        = value;
            obj["Direction"] = iDirection;

            _Params.Add(obj);
        }
示例#10
0
        /// <summary>
        /// Converts parameter direction to Doxygen string.
        /// </summary>
        /// <param name="dir">Parameter direction.</param>
        /// <returns>Doxygen compatible string.</returns>
        private static string DirectionToString(ParamDirection dir)
        {
            switch (dir)
            {
            case ParamDirection.In:
            default:
                return("[in]");

            case ParamDirection.Out:
                return("[out]");

            case ParamDirection.InOut:
                return("[in,out]");
            }
        }
示例#11
0
        public List <DataParam> GetparamsByDirection(ParamDirection direction)
        {
            List <DataParam> result = new List <DataParam>();

            foreach (DataParam param in Params.Values)
            {
                if (param.Direction == direction)
                {
                    result.Add(param);
                }
            }


            return(result);
        }
示例#12
0
        /// <summary>
        /// Determines parameter direction based on the code element and the previously parsed parameter comment line.
        /// </summary>
        /// <param name="function">Parent function.</param>
        /// <param name="param">Code element for the parameter.</param>
        /// <param name="parsedParam">Existing parsed parameter info, if available.</param>
        /// <returns>The parameter direction.</returns>
        private ParamDirection GetParamDirection(CodeFunction function, CodeParameter param, ParsedParam parsedParam)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            ParamDirection direction     = ParamDirection.In;
            bool           isConstructor = (function.FunctionKind & vsCMFunction.vsCMFunctionConstructor) != 0;

            // By default trust the user if an existing direction is found.
            if (parsedParam != null)
            {
                direction = parsedParam.Direction;
            }
            // Constructor assumes inputs only. Otherwise we check the parameter data type to try to determine
            // the appropriate direction.
            else if (!isConstructor && !IsInput(param))
            {
                direction = Config.DefaultNonConstReferenceDirection;
            }

            return(direction);
        }
示例#13
0
        public static ParameterDirection GetParametrDirection(ParamDirection direction)
        {
            switch (direction)
            {
            case ParamDirection.Input:
                return(ParameterDirection.Input);

            case ParamDirection.Output:
                return(ParameterDirection.Output);

            case ParamDirection.Return:
                return(ParameterDirection.ReturnValue);

            case ParamDirection.InOut:
                return(ParameterDirection.InputOutput);

            default:
                return(ParameterDirection.Input);
            }
        }
示例#14
0
        public void AddParameter(string Name, DBType Type, ParamDirection Direction, Int16 Size, object Value)
        {
            if ((short)Direction < 0 || (short)Direction > 3)
            {
                throw new Exception("Tipo ParamDirection incorrecto");
            }

            if (Direction == ParamDirection.ParamInput && Value == null)
            {
                throw new Exception("Valor incorrecto cuando ParamDirection es Input");
            }

            if ((short)Type < 1 || (short)Type > 13)
            {
                throw new Exception("Tipo DBType incorrecto");
            }

            if (Type == DBType.dbCursor && Direction == ParamDirection.ParamInput)
            {
                throw new Exception("Tipo DBType.dbCursor incorrecto cuando ParamDirection es Input");
            }


            PackageParameter iParameter = new PackageParameter();

            iParameter.Name      = Name;
            iParameter.Direction = (short)Direction;
            iParameter.Type      = (short)Type;
            iParameter.Size      = Size;
            iParameter.Flag      = true;
            if (Type == DBType.dbCursor)
            {
                iParameter.Value = null;
            }
            else
            {
                iParameter.Value = Value.ToString();
            }

            _Transaction.Parameters.Add(iParameter);
        }
示例#15
0
 public ParamInfos(ParamType type, ParamDirection dir, string name)
 {
     Type      = type;
     Direction = dir;
     Name      = name;
 }
示例#16
0
 internal Param(ParamDirection direction, T value, OracleDbType?oracleType = null)
     : base(direction, typeof(T), value, oracleType)
 {
     Value = value;
 }
示例#17
0
        public static DbParam CreateParam(string paramName, object paramValue, DataType dbType = DataType.String, ParamDirection direction = ParamDirection.Input, int size = 1)
        {
            var result = new DbParam()
            {
                Type = dbType, Direction = direction, Name = paramName
            };

            if (direction != ParamDirection.Output && paramValue != null)
            {
                result.Value = paramValue;
            }
            if (direction == ParamDirection.Output && dbType == DataType.String)
            {
                result.Size = size;
            }
            return(result);
        }
示例#18
0
 public static void Add(this List <DbParam> dbParams, string paramName, object paramValue, DataType dbType = DataType.String, ParamDirection direction = ParamDirection.Input, int size = 1)
 {
     dbParams.Add(CreateParam(paramName, paramValue, dbType, direction, size));
 }
示例#19
0
 /// <summary>
 /// 添加非输入参数
 /// </summary>
 /// <param name="ParamName">参数名</param>
 /// <param name="pDirection">参数方向</param>
 public void addParam(string ParamName, ParamDirection pDirection)
 {
     ParamObj myParam = new ParamObj(null, pDirection);
     m_Param[ParamName] = myParam;
 }
 public static ParameterDirection ToParameterDirection(this ParamDirection dir)
 {
     return((ParameterDirection)(int)dir);
 }
示例#21
0
 /// <summary>
 /// Приводит ParamDirection к ParameterDirection
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 public static ParameterDirection DecodeParamDirection(ParamDirection dir) {
   switch (dir) {
     case ParamDirection.Input: return ParameterDirection.Input;
     case ParamDirection.InputOutput: return ParameterDirection.InputOutput;
     case ParamDirection.Output: return ParameterDirection.Output;
     case ParamDirection.Return: return ParameterDirection.ReturnValue;
     default: return ParameterDirection.Input;
   }
 }
示例#22
0
 // 参数方向
 //构造函数
 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 /// <param name="iDirection"></param>
 public Parameter(string name, object value, ParamDirection iDirection)
 {
     _name = name;
     _value = value;
     _direction = iDirection;
 }
示例#23
0
        /// <summary>
        ///     添加一个参数
        /// </summary>
        /// <param name="name"> 参数名 </param>
        /// <param name="value"> 参数值 </param>
        /// <param name="iDirection"> 参数的输入输出方面 </param>
        public void Append(string name, object value, ParamDirection iDirection = ParamDirection.In)
        {
            var obj = new JsonObject();
            obj[name] = value;
            obj["Direction"] = iDirection;

            _params.Add(obj);
        }
示例#24
0
 private ASTFunctionParam MakeParam(ParamDirection direction, ASTNode type, ASTNode name) => new ASTFunctionParam()
 {
     Name      = (name as ASTLiteral).Literal,
     Type      = (type as ASTLiteral).Literal,
     Direction = direction
 };
示例#25
0
 public object this[string key, ParamType pt, ParamDirection d]
 {
     set
     {
         //if the set value is null, assume it is a string
         if ((value is string) || (value == null))
         {
             if (pt == ParamType.Nullable)
                 this[key, SqlDbType.NVarChar, d] = value;
             else
                 this[key, SqlDbType.VarChar, d] = value;
         }
         else if (value is DateTime)
         {
             if (pt == ParamType.Nullable)
             {
                 DateTime dt = (DateTime)value;
                 if (dt == DateTime.MinValue)
                     this[key, SqlDbType.SmallDateTime, d] = DBNull.Value;
                 else
                     this[key, SqlDbType.SmallDateTime, d] = value;
             }
             else
                 this[key, SqlDbType.SmallDateTime, d] = value;
         }
         else if (value is bool)
         {
             this[key, SqlDbType.Bit, d] = value;
         }
         else if (value is long)
         {
             if (pt == ParamType.Nullable)
             {
                 long i = (long)value;
                 if (i == 0)
                     this[key, SqlDbType.Int, d] = DBNull.Value;
                 else
                     this[key, SqlDbType.Int, d] = value;
             }
             else
                 this[key, SqlDbType.Int, d] = value;
         }
         else //if (value is int)
         {
             if (pt == ParamType.Nullable)
             {
                 int i = (int)value;
                 if (i == 0)
                     this[key, SqlDbType.Int, d] = DBNull.Value;
                 else
                     this[key, SqlDbType.Int, d] = value;
             }
             else
                 this[key, SqlDbType.Int, d] = value;
         }
     }
 }
示例#26
0
 public DataParam(string name, CustomSqlTypes type, ParamDirection direction)
     : this(name, type, direction, string.Empty)
 {
 }
示例#27
0
        public object this[string key, SqlDbType t, ParamDirection d, int size]
        {
            set
            {
                if (!parameters.ContainsKey(key))
                {
                    SqlParameter p = new SqlParameter(key, t, size);
                    p.Direction = (ParameterDirection)d;
                    parameters.Add(key, p);
                }

                object result = getFormattedValue(value, t);
                parameters[key].Value = result;

            }
        }
示例#28
0
 public Parameters(string paramKey, object value, ParamDirection direction = ParamDirection.Input)
 {
     ParamKey  = paramKey;
     Value     = value;
     Direction = direction;
 }
示例#29
0
 /// <summary>
 /// 构造
 /// </summary>
 /// <param name="pvalue">值</param>
 /// <param name="pDirection">参数方向</param>
 public ParamObj(object pvalue, ParamDirection pDirection)
 {
     PValue = pvalue;
     PDirection = pDirection;
 }