private void CheckCommand()
    {
        if (_transaction != null && _transaction.IsCompleted)
        {
            _transaction = null;
        }

        FbConnection.EnsureOpen(_connection);

        //if (_activeReader != null)
        //{
        //	throw new InvalidOperationException("There is already an open DataReader associated with this Command which must be closed first.");
        //}

        if (_transaction == null &&
            _connection.InnerConnection.HasActiveTransaction &&
            !_connection.InnerConnection.IsEnlisted)
        {
            throw new InvalidOperationException("Execute requires the Command object to have a Transaction object when the Connection object assigned to the command is in a pending local transaction. The Transaction property of the Command has not been initialized.");
        }

        if (_transaction != null && !_transaction.IsCompleted &&
            !_connection.Equals(_transaction.Connection))
        {
            throw new InvalidOperationException("Command Connection is not equal to Transaction Connection.");
        }

        if (_commandText == null || _commandText.Length == 0)
        {
            throw new InvalidOperationException("The command text for this Command has not been set.");
        }
    }
Ejemplo n.º 2
0
    private T GetValue <T>(byte item)
    {
        FbConnection.EnsureOpen(Connection);

        var items = new byte[]
        {
            item,
            IscCodes.isc_info_end
        };
        var info = Connection.InnerConnection.Database.GetDatabaseInfo(items);

        return(info.Any() ? ConvertValue <T>(info[0]) : default);