public void DatabaseShutdown2(FbShutdownOnlineMode mode, FbShutdownType type, int seconds) { StartSpb = new ServiceParameterBuffer(); StartSpb.Append(IscCodes.isc_action_svc_properties); StartSpb.Append(IscCodes.isc_spb_dbname, Database); StartSpb.Append(IscCodes.isc_spb_prp_shutdown_mode, FbShutdownOnlineModeToIscCode(mode)); switch (type) { case FbShutdownType.ForceShutdown: StartSpb.Append(IscCodes.isc_spb_prp_force_shutdown, seconds); break; case FbShutdownType.AttachmentsShutdown: StartSpb.Append(IscCodes.isc_spb_prp_attachments_shutdown, seconds); break; case FbShutdownType.TransactionsShutdown: StartSpb.Append(IscCodes.isc_spb_prp_transactions_shutdown, seconds); break; } Open(); StartTask(); Close(); }
public async Task DatabaseShutdown2Async(FbShutdownOnlineMode mode, FbShutdownType type, int seconds, CancellationToken cancellationToken = default) { EnsureDatabase(); await OpenAsync(cancellationToken).ConfigureAwait(false); var startSpb = new ServiceParameterBuffer2(); startSpb.Append(IscCodes.isc_action_svc_properties); startSpb.Append2(IscCodes.isc_spb_dbname, Database, SpbFilenameEncoding); startSpb.Append(IscCodes.isc_spb_prp_shutdown_mode, FbShutdownOnlineModeToIscCode(mode)); switch (type) { case FbShutdownType.ForceShutdown: startSpb.Append(IscCodes.isc_spb_prp_force_shutdown, seconds); break; case FbShutdownType.AttachmentsShutdown: startSpb.Append(IscCodes.isc_spb_prp_attachments_shutdown, seconds); break; case FbShutdownType.TransactionsShutdown: startSpb.Append(IscCodes.isc_spb_prp_transactions_shutdown, seconds); break; } await StartTaskAsync(startSpb, cancellationToken).ConfigureAwait(false); await CloseAsync(cancellationToken).ConfigureAwait(false); }
private async Task DatabaseShutdown2Impl(FbShutdownOnlineMode mode, FbShutdownType type, int seconds, AsyncWrappingCommonArgs async) { EnsureDatabase(); await Open(async).ConfigureAwait(false); var startSpb = new ServiceParameterBuffer(); startSpb.Append(IscCodes.isc_action_svc_properties); startSpb.Append(IscCodes.isc_spb_dbname, Database, SpbFilenameEncoding); startSpb.Append(IscCodes.isc_spb_prp_shutdown_mode, FbShutdownOnlineModeToIscCode(mode)); switch (type) { case FbShutdownType.ForceShutdown: startSpb.Append(IscCodes.isc_spb_prp_force_shutdown, seconds); break; case FbShutdownType.AttachmentsShutdown: startSpb.Append(IscCodes.isc_spb_prp_attachments_shutdown, seconds); break; case FbShutdownType.TransactionsShutdown: startSpb.Append(IscCodes.isc_spb_prp_transactions_shutdown, seconds); break; } await StartTask(startSpb, async).ConfigureAwait(false); await Close(async).ConfigureAwait(false); }
private static byte FbShutdownOnlineModeToIscCode(FbShutdownOnlineMode mode) { return(mode switch { FbShutdownOnlineMode.Normal => IscCodes.isc_spb_prp_sm_normal, FbShutdownOnlineMode.Multi => IscCodes.isc_spb_prp_sm_multi, FbShutdownOnlineMode.Single => IscCodes.isc_spb_prp_sm_single, FbShutdownOnlineMode.Full => IscCodes.isc_spb_prp_sm_full, _ => throw new ArgumentOutOfRangeException(nameof(mode)), });
public void DatabaseOnline2(FbShutdownOnlineMode mode) { StartSpb = new ServiceParameterBuffer(); StartSpb.Append(IscCodes.isc_action_svc_properties); StartSpb.Append(IscCodes.isc_spb_dbname, Database); StartSpb.Append(IscCodes.isc_spb_prp_online_mode, FbShutdownOnlineModeToIscCode(mode)); Open(); StartTask(); Close(); }
public void DatabaseOnline2(FbShutdownOnlineMode mode) { EnsureDatabase(); Open(); var startSpb = new ServiceParameterBuffer2(); startSpb.Append(IscCodes.isc_action_svc_properties); startSpb.Append2(IscCodes.isc_spb_dbname, Database, SpbFilenameEncoding); startSpb.Append(IscCodes.isc_spb_prp_online_mode, FbShutdownOnlineModeToIscCode(mode)); StartTask(startSpb); Close(); }
public async Task DatabaseOnline2Async(FbShutdownOnlineMode mode, CancellationToken cancellationToken = default) { EnsureDatabase(); await OpenAsync(cancellationToken).ConfigureAwait(false); var startSpb = new ServiceParameterBuffer2(); startSpb.Append(IscCodes.isc_action_svc_properties); startSpb.Append2(IscCodes.isc_spb_dbname, Database, SpbFilenameEncoding); startSpb.Append(IscCodes.isc_spb_prp_online_mode, FbShutdownOnlineModeToIscCode(mode)); await StartTaskAsync(startSpb, cancellationToken).ConfigureAwait(false); await CloseAsync(cancellationToken).ConfigureAwait(false); }
private async Task DatabaseOnline2Impl(FbShutdownOnlineMode mode, AsyncWrappingCommonArgs async) { EnsureDatabase(); await Open(async).ConfigureAwait(false); var startSpb = new ServiceParameterBuffer(); startSpb.Append(IscCodes.isc_action_svc_properties); startSpb.Append(IscCodes.isc_spb_dbname, Database, SpbFilenameEncoding); startSpb.Append(IscCodes.isc_spb_prp_online_mode, FbShutdownOnlineModeToIscCode(mode)); await StartTask(startSpb, async).ConfigureAwait(false); await Close(async).ConfigureAwait(false); }
byte FbShutdownOnlineModeToIscCode(FbShutdownOnlineMode mode) { switch (mode) { case FbShutdownOnlineMode.Normal: return(IscCodes.isc_spb_prp_sm_normal); case FbShutdownOnlineMode.Multi: return(IscCodes.isc_spb_prp_sm_multi); case FbShutdownOnlineMode.Single: return(IscCodes.isc_spb_prp_sm_single); case FbShutdownOnlineMode.Full: return(IscCodes.isc_spb_prp_sm_full); default: throw new ArgumentOutOfRangeException(); } }
public Task DatabaseOnline2Async(FbShutdownOnlineMode mode, CancellationToken cancellationToken = default) => DatabaseOnline2Impl(mode, new AsyncWrappingCommonArgs(true, cancellationToken));
public void DatabaseOnline2(FbShutdownOnlineMode mode) => DatabaseOnline2Impl(mode, new AsyncWrappingCommonArgs(false)).GetAwaiter().GetResult();
public Task DatabaseShutdown2Async(FbShutdownOnlineMode mode, FbShutdownType type, int seconds, CancellationToken cancellationToken = default) => DatabaseShutdown2Impl(mode, type, seconds, new AsyncWrappingCommonArgs(true, cancellationToken));
public void DatabaseShutdown2(FbShutdownOnlineMode mode, FbShutdownType type, int seconds) => DatabaseShutdown2Impl(mode, type, seconds, new AsyncWrappingCommonArgs(false)).GetAwaiter().GetResult();
byte FbShutdownOnlineModeToIscCode(FbShutdownOnlineMode mode) { switch (mode) { case FbShutdownOnlineMode.Normal: return IscCodes.isc_spb_prp_sm_normal; case FbShutdownOnlineMode.Multi: return IscCodes.isc_spb_prp_sm_multi; case FbShutdownOnlineMode.Single: return IscCodes.isc_spb_prp_sm_single; case FbShutdownOnlineMode.Full: return IscCodes.isc_spb_prp_sm_full; default: throw new ArgumentOutOfRangeException(); } }
public void DatabaseOnline2(FbShutdownOnlineMode mode) { StartSpb = new ServiceParameterBuffer(); StartSpb.Append(IscCodes.isc_action_svc_properties); StartSpb.Append(IscCodes.isc_spb_dbname, Database); StartSpb.Append(IscCodes.isc_spb_prp_online_mode, FbShutdownOnlineModeToIscCode(mode)); Open(); StartTask(); Close(); }
public void DatabaseShutdown2(FbShutdownOnlineMode mode, FbShutdownType type, int seconds) { StartSpb = new ServiceParameterBuffer(); StartSpb.Append(IscCodes.isc_action_svc_properties); StartSpb.Append(IscCodes.isc_spb_dbname, Database); StartSpb.Append(IscCodes.isc_spb_prp_shutdown_mode, FbShutdownOnlineModeToIscCode(mode)); switch (type) { case FbShutdownType.ForceShutdown: StartSpb.Append(IscCodes.isc_spb_prp_force_shutdown, seconds); break; case FbShutdownType.AttachmentsShutdown: StartSpb.Append(IscCodes.isc_spb_prp_attachments_shutdown, seconds); break; case FbShutdownType.TransactionsShutdown: StartSpb.Append(IscCodes.isc_spb_prp_transactions_shutdown, seconds); break; } Open(); StartTask(); Close(); }