コード例 #1
0
 public void ReleaseConnection(SQLConnectionHeader connectionHeader, bool disposing)
 {
     if (!disposing)
     {
         EnsureStatic();
     }
     _cursor.Dispose();
     _cursor = null;
     _command.Dispose();
     _command    = null;
     _connection = null;
     connectionHeader.DeviceCursor = null;
 }
コード例 #2
0
        // AcquireConnection(SQLConnectionHeader) // sets the SQLDeviceCursor reference for the SQLConnectionHeader record in the SQLDeviceSession
        public void AcquireConnection(SQLConnectionHeader connectionHeader)
        {
            _connection = connectionHeader.Connection;
            try
            {
                _command = _connection.CreateCommand(true);
                try
                {
                    if (_buffer.Count > 0)
                    {
                        RestrictStatement();
                    }
                    else
                    {
                        UnrestrictStatement();
                    }
                    PrepareStatement();

                    _command.Statement = _deviceSession.Device.Emitter.Emit(_statement);
                    _command.Parameters.AddRange(_parameters);
                    _command.LockType = _lockType;

                    try
                    {
                        _cursor = _command.Open(_cursorType, _isolationLevel);
                        try
                        {
                                                        #if USEINCLUSIVEMULTIPLEX
                            if (_buffer.Count > 0)
                            {
                                _cursor.Next();
                            }
                                                        #endif
                            connectionHeader.DeviceCursor = this;
                        }
                        catch
                        {
                            _command.Close(_cursor);
                            _cursor = null;
                            throw;
                        }
                    }
                    catch (Exception exception)
                    {
                        _deviceSession.TransactionFailure = _connection.TransactionFailure;
                        throw _deviceSession.WrapException(exception);
                    }
                }
                catch
                {
                    _command.Dispose();
                    _command = null;
                    throw;
                }
            }
            catch
            {
                _connection = null;
                throw;
            }
        }
コード例 #3
0
 // ReleaseConnection(SQLConnectionHeader) // clears the SQLDeviceCursor reference for the SQLConnectionHeader record in the SQLDeviceSession
 public void ReleaseConnection(SQLConnectionHeader connectionHeader)
 {
     ReleaseConnection(connectionHeader, false);
 }