/// <summary> /// Initializes a new instance of <see cref="SpannerCommand"/> /// </summary> /// <param name="commandText">If this command is a SQL Query, then commandText is /// the SQL statement. If its an update, insert or delete command, then this text /// is "[operation] [table]" such as "UPDATE MYTABLE"</param>. Must not be null. /// <param name="connection">The <see cref="SpannerConnection"/> that is /// associated with this <see cref="SpannerCommand"/>. Must not be null.</param> /// <param name="transaction">An optional <see cref="SpannerTransaction"/> /// created through <see> /// <cref>SpannerConnection.BeginTransactionAsync</cref></see>. May be null.</param> /// <param name="parameters">An optional collection of <see cref="SpannerParameter"/> /// that is used in the command. May be null.</param> public SpannerCommand( string commandText, SpannerConnection connection, SpannerTransaction transaction = null, SpannerParameterCollection parameters = null) : this(SpannerCommandTextBuilder.FromCommandText(commandText), connection, transaction, parameters) { }
internal SpannerCommand(string commandText, SpannerParameterCollection parameters = null) { SpannerCommandTextBuilder = SpannerCommandTextBuilder.FromCommandText(commandText); 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 = SpannerCommandTextBuilder.FromCommandText(commandPartition.ExecuteSqlRequest.Sql); }
/// <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)); }