/// <summary> /// Initializes a new instance of <see cref="SpannerCommand"/>. /// </summary> /// <param name="connection">The <see cref="SpannerConnection"/> that is /// associated with this <see cref="SpannerCommand"/>. Must not be null.</param> /// <param name="transaction">The <see cref="SpannerTransaction"/> /// used when creating the <see cref="CommandPartition"/>. /// </param> /// <param name="commandPartition"> /// The partition which this command is restricted to. /// See <see cref="SpannerConnection.BeginReadOnlyTransaction(TransactionId)"/> /// </param> public SpannerCommand( SpannerConnection connection, SpannerTransaction transaction, CommandPartition commandPartition) : this(connection, transaction, null, commandPartition) { GaxPreconditions.CheckNotNull(connection, nameof(connection)); GaxPreconditions.CheckNotNull(transaction, nameof(transaction)); GaxPreconditions.CheckNotNull(commandPartition, nameof(commandPartition)); SpannerCommandTextBuilder = SpannerCommandTextBuilder.FromCommandText(commandPartition.ExecuteSqlRequest.Sql); }
private SpannerCommand( SpannerConnection connection, SpannerTransaction transaction, SpannerParameterCollection parameters, CommandPartition commandPartition) : this(connection) { _transaction = transaction; Partition = commandPartition; if (parameters != null) { Parameters = parameters; } }
/// <summary> /// Initializes a new instance of <see cref="SpannerCommand"/>. /// </summary> /// <param name="connection">The <see cref="SpannerConnection"/> that is /// associated with this <see cref="SpannerCommand"/>. Must not be null.</param> /// <param name="transaction">The <see cref="SpannerTransaction"/> /// used when creating the <see cref="CommandPartition"/>. /// </param> /// <param name="commandPartition"> /// The partition which this command is restricted to. /// See <see cref="SpannerConnection.BeginReadOnlyTransaction(TransactionId)"/> /// </param> public SpannerCommand( SpannerConnection connection, SpannerTransaction transaction, CommandPartition commandPartition) : this(connection, transaction, null, commandPartition) { GaxPreconditions.CheckNotNull(connection, nameof(connection)); GaxPreconditions.CheckNotNull(transaction, nameof(transaction)); GaxPreconditions.CheckNotNull(commandPartition, nameof(commandPartition)); SpannerCommandTextBuilder = commandPartition.Request.IsQuery ? SpannerCommandTextBuilder.FromCommandText(commandPartition.Request.ExecuteSqlRequest.Sql) : SpannerCommandTextBuilder.CreateReadTextBuilder( commandPartition.Request.ReadRequest.Table, ReadOptions.FromColumns(commandPartition.Request.ReadRequest.Columns)); }