private void CreateOrOpen(int op, BlobParameterBuffer bpb)
        {
            lock (_database.SyncObject)
            {
                try
                {
                    _database.XdrStream.Write(op);
                    if (bpb != null)
                    {
                        _database.XdrStream.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray());
                    }
                    _database.XdrStream.Write(_transaction.Handle);
                    _database.XdrStream.Write(_blobId);
                    _database.XdrStream.Flush();

                    GenericResponse response = _database.ReadGenericResponse();

                    _blobId     = response.BlobId;
                    _blobHandle = response.ObjectHandle;
                }
                catch (IOException ex)
                {
                    throw IscException.ForErrorCode(IscCodes.isc_net_read_err, ex);
                }
            }
        }
Exemplo n.º 2
0
        private void CreateOrOpen(int op, BlobParameterBuffer bpb)
        {
            lock (this.database.SyncObject)
            {
                try
                {
                    this.database.Write(op);
                    if (bpb != null)
                    {
                        this.database.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray());
                    }
                    this.database.Write(this.transaction.Handle);
                    this.database.Write(this.blobId);
                    this.database.Flush();

                    GenericResponse response = this.database.ReadGenericResponse();

                    this.blobId     = response.BlobId;
                    this.blobHandle = response.ObjectHandle;
                }
                catch (IOException)
                {
                    throw new IscException(IscCodes.isc_net_read_err);
                }
            }
        }
    private async ValueTask CreateOrOpenAsync(int op, BlobParameterBuffer bpb, CancellationToken cancellationToken = default)
    {
        try
        {
            await _database.Xdr.WriteAsync(op, cancellationToken).ConfigureAwait(false);

            if (bpb != null)
            {
                await _database.Xdr.WriteTypedAsync(IscCodes.isc_bpb_version1, bpb.ToArray(), cancellationToken).ConfigureAwait(false);
            }
            await _database.Xdr.WriteAsync(_transaction.Handle, cancellationToken).ConfigureAwait(false);

            await _database.Xdr.WriteAsync(_blobId, cancellationToken).ConfigureAwait(false);

            await _database.Xdr.FlushAsync(cancellationToken).ConfigureAwait(false);

            var response = (GenericResponse)await _database.ReadResponseAsync(cancellationToken).ConfigureAwait(false);

            _blobId     = response.BlobId;
            _blobHandle = response.ObjectHandle;
        }
        catch (IOException ex)
        {
            throw IscException.ForIOException(ex);
        }
    }
Exemplo n.º 4
0
        private async Task CreateOrOpen(int op, BlobParameterBuffer bpb, AsyncWrappingCommonArgs async)
        {
            try
            {
                await _database.Xdr.Write(op, async).ConfigureAwait(false);

                if (bpb != null)
                {
                    await _database.Xdr.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray(), async).ConfigureAwait(false);
                }
                await _database.Xdr.Write(_transaction.Handle, async).ConfigureAwait(false);

                await _database.Xdr.Write(_blobId, async).ConfigureAwait(false);

                await _database.Xdr.Flush(async).ConfigureAwait(false);

                var response = (GenericResponse)await _database.ReadResponse(async).ConfigureAwait(false);

                _blobId     = response.BlobId;
                _blobHandle = response.ObjectHandle;
            }
            catch (IOException ex)
            {
                throw IscException.ForIOException(ex);
            }
        }
    private void CreateOrOpen(int op, BlobParameterBuffer bpb)
    {
        try
        {
            _database.Xdr.Write(op);
            if (bpb != null)
            {
                _database.Xdr.WriteTyped(IscCodes.isc_bpb_version1, bpb.ToArray());
            }
            _database.Xdr.Write(_transaction.Handle);
            _database.Xdr.Write(_blobId);
            _database.Xdr.Flush();

            var response = (GenericResponse)_database.ReadResponse();

            _blobId     = response.BlobId;
            _blobHandle = response.ObjectHandle;
        }
        catch (IOException ex)
        {
            throw IscException.ForIOException(ex);
        }
    }