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.");
            }
        }
        private async Task <T> GetValue <T>(byte item, AsyncWrappingCommonArgs async)
        {
            FbConnection.EnsureOpen(Connection);

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

            return(info.Any() ? (T)Convert.ChangeType(info[0], typeof(T)) : default);
Beispiel #3
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);
Beispiel #4
0
        private List <T> GetList <T>(byte item)
        {
            FbConnection.EnsureOpen(_connection);

            var db    = Connection.InnerConnection.Database;
            var items = new byte[]
            {
                item,
                IscCodes.isc_info_end
            };

            return(db.GetDatabaseInfo(items).Cast <T>().ToList());
        }
Beispiel #5
0
        private string GetString(byte item)
        {
            FbConnection.EnsureOpen(_connection);

            var db    = Connection.InnerConnection.Database;
            var items = new byte[]
            {
                item,
                IscCodes.isc_info_end
            };

            return((string)db.GetDatabaseInfo(items)[0]);
        }
Beispiel #6
0
        private ArrayList GetArrayList(byte item)
        {
            FbConnection.EnsureOpen(_connection);

            IDatabase db = Connection.InnerConnection.Database;

            byte[] items = new byte[]
            {
                item,
                IscCodes.isc_info_end
            };

            return(db.GetDatabaseInfo(items));
        }
Beispiel #7
0
        private bool GetBoolean(byte item)
        {
            FbConnection.EnsureOpen(_connection);

            var db    = Connection.InnerConnection.Database;
            var items = new byte[]
            {
                item,
                IscCodes.isc_info_end
            };

            var info = db.GetDatabaseInfo(items);

            return(info.Count > 0 ? (bool)info[0] : false);
        }
Beispiel #8
0
        private int GetInt32(byte item)
        {
            FbConnection.EnsureOpen(_connection);

            var db    = Connection.InnerConnection.Database;
            var items = new byte[]
            {
                item,
                IscCodes.isc_info_end
            };

            var info = db.GetDatabaseInfo(items);

            return(info.Count > 0 ? (int)info[0] : 0);
        }