public FesTransaction(DatabaseBase db)
    {
        if (!(db is FesDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(FesDatabase)} type.");
        }

        _db           = (FesDatabase)db;
        _handle       = new TransactionHandle();
        State         = TransactionState.NoTransaction;
        _statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];
    }
 public override void Dispose2()
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             Rollback();
         }
         _db = null;
         _handle.Dispose();
         State         = TransactionState.NoTransaction;
         _statusVector = null;
         base.Dispose2();
     }
 }
 public override async ValueTask Dispose2Async(CancellationToken cancellationToken = default)
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             await RollbackAsync(cancellationToken).ConfigureAwait(false);
         }
         _db = null;
         _handle.Dispose();
         State         = TransactionState.NoTransaction;
         _statusVector = null;
         await base.Dispose2Async(cancellationToken).ConfigureAwait(false);
     }
 }
Exemplo n.º 4
0
 public FesArray(DatabaseBase db, TransactionBase transaction, long handle, string tableName, string fieldName)
     : base(tableName, fieldName)
 {
     if (!(db is FesDatabase))
     {
         throw new ArgumentException($"Specified argument is not of {nameof(FesDatabase)} type.");
     }
     if (!(transaction is FesTransaction))
     {
         throw new ArgumentException($"Specified argument is not of {nameof(FesTransaction)} type.");
     }
     _db           = (FesDatabase)db;
     _transaction  = (FesTransaction)transaction;
     _handle       = handle;
     _statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];
 }
Exemplo n.º 5
0
    public FesStatement(DatabaseBase db, TransactionBase transaction)
    {
        if (!(db is FesDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(FesDatabase)} type.");
        }

        _db              = (FesDatabase)db;
        _handle          = new StatementHandle();
        OutputParameters = new Queue <DbValue[]>();
        _statusVector    = new IntPtr[IscCodes.ISC_STATUS_LENGTH];
        _fetchSqlDa      = IntPtr.Zero;

        if (transaction != null)
        {
            Transaction = transaction;
        }
    }
    public FesBlob(DatabaseBase db, TransactionBase transaction, long blobId)
        : base(db)
    {
        if (!(db is FesDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(FesDatabase)} type.");
        }
        if (!(transaction is FesTransaction))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(FesTransaction)} type.");
        }

        _db           = (FesDatabase)db;
        _transaction  = (FesTransaction)transaction;
        _position     = 0;
        _blobHandle   = new BlobHandle();
        _blobId       = blobId;
        _statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH];
    }
Exemplo n.º 7
0
 public override void Dispose2()
 {
     if (!_disposed)
     {
         _disposed = true;
         Release();
         Clear();
         _db              = null;
         _fields          = null;
         _parameters      = null;
         _transaction     = null;
         OutputParameters = null;
         _statusVector    = null;
         _allRowsFetched  = false;
         _handle.Dispose();
         FetchSize = 0;
         base.Dispose2();
     }
 }
Exemplo n.º 8
0
    public override async ValueTask Dispose2Async(CancellationToken cancellationToken = default)
    {
        if (!_disposed)
        {
            _disposed = true;
            await ReleaseAsync(cancellationToken).ConfigureAwait(false);

            Clear();
            _db              = null;
            _fields          = null;
            _parameters      = null;
            _transaction     = null;
            OutputParameters = null;
            _statusVector    = null;
            _allRowsFetched  = false;
            _handle.Dispose();
            FetchSize = 0;
            await base.Dispose2Async(cancellationToken).ConfigureAwait(false);
        }
    }
    public override void Attach(ServiceParameterBufferBase spb, string dataSource, int port, string service, byte[] cryptKey)
    {
        FesDatabase.CheckCryptKeyForSupport(cryptKey);

        ClearStatusVector();

        var svcHandle = Handle;

        _fbClient.isc_service_attach(
            _statusVector,
            (short)service.Length,
            service,
            ref svcHandle,
            spb.Length,
            spb.ToArray());

        ProcessStatusVector(_statusVector);

        Handle = svcHandle;
    }
    public override ValueTask AttachAsync(ServiceParameterBufferBase spb, string dataSource, int port, string service, byte[] cryptKey, CancellationToken cancellationToken = default)
    {
        FesDatabase.CheckCryptKeyForSupport(cryptKey);

        ClearStatusVector();

        var svcHandle = Handle;

        _fbClient.isc_service_attach(
            _statusVector,
            (short)service.Length,
            service,
            ref svcHandle,
            spb.Length,
            spb.ToArray());

        ProcessStatusVector(_statusVector);

        Handle = svcHandle;

        return(ValueTask2.CompletedTask);
    }