Esempio n. 1
0
        /// <summary>
        /// Creates and returns a ProtoBuf representation of the specified collection.
        /// </summary>
        /// <returns></returns>
        public static pbc.RepeatedField <TypedValue> AsRepeatedFieldTypedValue(PhoenixParameterCollection collection)
        {
            pbc.RepeatedField <TypedValue> pbParamValues = new pbc.RepeatedField <TypedValue>();
            for (int i = 0; i < collection.Count; i++)
            {
                pbParamValues.Add(collection[i].AsPhoenixTypedValue());
            }

            return(pbParamValues);
        }
Esempio n. 2
0
        //internal ResultSetResponse InternalTableTypesRequest()
        //{
        //    ResultSetResponse response = null;

        //    Task<ResultSetResponse> tResp = _client.TableTypesRequestAsync(this.ConnectionId, this.Options);

        //    tResp.Wait();

        //    response = tResp.Result;

        //    return response;
        //}

        internal async Task <GarudaExecuteResponse> InternalExecuteRequestAsync(PrepareResponse prepared, string sql,
                                                                                PhoenixParameterCollection parameterValues)
        {
            CreateStatementResponse tStmt   = null;
            ExecuteResponse         tResp   = null;
            GarudaExecuteResponse   ourResp = new GarudaExecuteResponse();

            try
            {
                if (null == prepared)
                {
                    try
                    {
                        // Not prepared....
                        tStmt = await _client.CreateStatementRequestAsync(this.ConnectionId, this.Options);

                        ourResp.StatementId = tStmt.StatementId;

                        tResp = await _client.PrepareAndExecuteRequestAsync(this.ConnectionId, sql, ourResp.StatementId, long.MaxValue, int.MaxValue, this.Options);
                    }
                    catch (Exception)
                    {
                        if (null != tStmt)
                        {
                            InternalCloseStatementAsync(tStmt.StatementId);
                        }

                        throw;
                    }
                }
                else
                {
                    // Prepared and possibly with parameters.
                    pbc.RepeatedField <TypedValue> pbParamValues = parameterValues.AsRepeatedFieldTypedValue();

                    tResp = await _client.ExecuteRequestAsync(prepared.Statement, pbParamValues, uint.MaxValue,
                                                              parameterValues.Count > 0, this.Options);
                }

                ourResp.Response = tResp;
            }
            catch (Exception ex)
            {
                if (OnInternalException(ex))
                {
                    throw;
                }
            }

            return(ourResp);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates and returns a ProtoBuf representation of this collection.
 /// </summary>
 /// <returns></returns>
 public pbc.RepeatedField <TypedValue> AsRepeatedFieldTypedValue()
 {
     return(PhoenixParameterCollection.AsRepeatedFieldTypedValue(this));
 }