public BatchCommand Current() { try { _lock.EnterUpgradeableReadLock(); if (hasCurrentExceededCommandSizeLimit()) { _lock.EnterWriteLock(); try { _current = new BatchCommand(_store.Serializer, _tenant); _commands.Add(_current); } finally { _lock.ExitWriteLock(); } } return(_current); } finally { _lock.ExitUpgradeableReadLock(); } }
public SprocCall(BatchCommand parent, FunctionName function) { if (parent == null) throw new ArgumentNullException(nameof(parent)); if (function == null) throw new ArgumentNullException(nameof(function)); _parent = parent; _function = function; }
public SprocCall(BatchCommand parent, FunctionName function) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } if (function == null) { throw new ArgumentNullException(nameof(function)); } _parent = parent; _function = function; }
private static void executeCallbacks(NpgsqlCommand cmd, BatchCommand batch, List <Exception> list) { using (var reader = cmd.ExecuteReader()) { if (batch.Callbacks.Any()) { batch.Callbacks[0]?.Postprocess(reader, list); for (int i = 1; i < batch.Callbacks.Count; i++) { reader.NextResult(); batch.Callbacks[i]?.Postprocess(reader, list); } } } }
public UpdateBatch(DocumentStore store, IManagedConnection connection, VersionTracker versions, MemoryPool <char> writerPool, ITenant tenant, ConcurrencyChecks concurrency) { _store = store; _writerPool = writerPool; Versions = versions ?? throw new ArgumentNullException(nameof(versions)); var current = new BatchCommand(_store.Serializer, tenant); _commands.Add(current); _current = current; Connection = connection; Concurrency = concurrency; TenantId = tenant.TenantId; _tenant = tenant; }
private static async Task executeCallbacksAsync(NpgsqlCommand cmd, CancellationToken tkn, BatchCommand batch, List <Exception> list) { using (var reader = await cmd.ExecuteReaderAsync(tkn).ConfigureAwait(false)) { if (batch.Callbacks.Any()) { if (batch.Callbacks[0] != null) { await batch.Callbacks[0].PostprocessAsync(reader, list, tkn).ConfigureAwait(false); } for (var i = 1; i < batch.Callbacks.Count; i++) { if (!(batch.Calls[i - 1] is NoDataReturnedCall)) { await reader.NextResultAsync(tkn).ConfigureAwait(false); } if (batch.Callbacks[i] != null) { await batch.Callbacks[i].PostprocessAsync(reader, list, tkn).ConfigureAwait(false); } } } } }
public SprocCall(BatchCommand parent, DbObjectName function) { _parent = parent ?? throw new ArgumentNullException(nameof(parent)); _function = function ?? throw new ArgumentNullException(nameof(function)); }
public SprocCall(BatchCommand parent, string sprocName) { _parent = parent; _sprocName = sprocName; }
private static void executeCallbacks(NpgsqlCommand cmd, BatchCommand batch, List<Exception> list) { using (var reader = cmd.ExecuteReader()) { if (batch.Callbacks.Any()) { batch.Callbacks[0]?.Postprocess(reader, list); for (int i = 1; i < batch.Callbacks.Count; i++) { reader.NextResult(); batch.Callbacks[i]?.Postprocess(reader, list); } } } }
private static async Task executeCallbacksAsync(NpgsqlCommand cmd, CancellationToken tkn, BatchCommand batch, List<Exception> list) { using (var reader = await cmd.ExecuteReaderAsync(tkn).ConfigureAwait(false)) { if (batch.Callbacks.Any()) { if (batch.Callbacks[0] != null) { await batch.Callbacks[0].PostprocessAsync(reader, list, tkn).ConfigureAwait(false); } for (int i = 1; i < batch.Callbacks.Count; i++) { await reader.NextResultAsync(tkn).ConfigureAwait(false); if (batch.Callbacks[i] != null) { await batch.Callbacks[i].PostprocessAsync(reader, list, tkn).ConfigureAwait(false); } } } } }