示例#1
0
 internal void PopulateJobConfigurationQuery(JobConfigurationQuery query)
 {
     query.Query = Sql;
     // Safe for now; we only have "named" or "positional". This is unlikely to change.
     query.ParameterMode   = ParameterMode.ToString().ToLowerInvariant();
     query.QueryParameters = Parameters.Select(p => p.ToQueryParameter(ParameterMode)).ToList();
 }
 internal void ModifyRequest(JobConfigurationQuery query)
 {
     // Note: no validation of combinations (flatten results etc). Leave this to the server,
     // to avoid restrictions getting out of date.
     if (AllowLargeResults != null)
     {
         query.AllowLargeResults = AllowLargeResults;
     }
     if (CreateDisposition != null)
     {
         query.CreateDisposition = EnumMap.ToApiValue(CreateDisposition.Value);
     }
     if (DefaultDataset != null)
     {
         query.DefaultDataset = DefaultDataset;
     }
     if (DestinationTable != null)
     {
         query.DestinationTable = DestinationTable;
     }
     if (FlattenResults != null)
     {
         query.FlattenResults = FlattenResults;
     }
     if (MaximumBillingTier != null)
     {
         query.MaximumBillingTier = MaximumBillingTier;
     }
     if (MaximumBytesBilled != null)
     {
         query.MaximumBytesBilled = MaximumBytesBilled;
     }
     if (Priority != null)
     {
         query.Priority = EnumMap.ToApiValue(Priority.Value);
     }
     if (UseQueryCache != null)
     {
         query.UseQueryCache = UseQueryCache;
     }
     if (WriteDisposition != null)
     {
         query.WriteDisposition = EnumMap.ToApiValue(WriteDisposition.Value);
     }
     if (UseLegacySql != null)
     {
         query.UseLegacySql = UseLegacySql;
     }
     if (ParameterMode != null)
     {
         // Safe for now; we only have "named" or "positional". This is unlikely to change.
         query.ParameterMode = ParameterMode.ToString().ToLowerInvariant();
     }
     if (DestinationEncryptionConfiguration != null)
     {
         query.DestinationEncryptionConfiguration = DestinationEncryptionConfiguration;
     }
 }
示例#3
0
 private long CalcMemoryDirection(ParameterMode mode, long direction)
 {
     if (mode == ParameterMode.PositionMode)
     {
         return(direction);
     }
     else if (mode == ParameterMode.RelativeMode)
     {
         return(_positionBase + direction);
     }
     else
     {
         throw new NotSupportedException($"Memory mode not supported {mode.ToString()}({(int)mode})");
     }
 }
示例#4
0
        internal static string ToString(ParameterMode value)
        {
            switch (value)
            {
            case ParameterMode.In:
                return("In");

            case ParameterMode.Out:
                return("Out");

            case ParameterMode.InOut:
                return("InOut");

            case ParameterMode.ReturnValue:
                return("ReturnValue");

            default:
                return(value.ToString());
            }
        }
示例#5
0
        // Returns ParameterDirection corresponding to given ParameterMode
        internal static ParameterDirection ParameterModeToParameterDirection(ParameterMode mode)
        {
            switch (mode)
            {
            case ParameterMode.In:
                return(ParameterDirection.Input);

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

            case ParameterMode.Out:
                return(ParameterDirection.Output);

            case ParameterMode.ReturnValue:
                return(ParameterDirection.ReturnValue);

            default:
                Debug.Fail("unrecognized mode " + mode.ToString());
                return(default(ParameterDirection));
            }
        }
示例#6
0
        /// <remarks>
        ///     Performance of Enum.ToString() is slow and we use this value in building Identity
        /// </remarks>
        internal static string ToString(ParameterMode value)
        {
            switch (value)
            {
            case ParameterMode.In:
                return(EdmConstants.In);

            case ParameterMode.Out:
                return(EdmConstants.Out);

            case ParameterMode.InOut:
                return(EdmConstants.InOut);

            case ParameterMode.ReturnValue:
                return("ReturnValue");

            default:
                Debug.Assert(false, "which ParameterMode.ToString() is missing?");
                return(value.ToString());
            }
        }
        // Returns ParameterDirection corresponding to given ParameterMode
        private static ParameterDirection ParameterModeToParameterDirection(ParameterMode mode)
        {
            switch (mode)
            {
                case ParameterMode.In:
                    return ParameterDirection.Input;

                case ParameterMode.InOut:
                    return ParameterDirection.InputOutput;

                case ParameterMode.Out:
                    return ParameterDirection.Output;

                case ParameterMode.ReturnValue:
                    return ParameterDirection.ReturnValue;

                default:
                    Debug.Fail("unrecognized mode " + mode.ToString());
                    return default(ParameterDirection);
            }
        }