Пример #1
0
 public void Execute(string AStatement, SQLParameters AParameters)
 {
     CheckConnectionValid();
     using (SQLCommand LCommand = CreateCommand())
     {
         LCommand.Statement = AStatement;
         LCommand.Parameters.AddRange(AParameters);
         LCommand.Execute();
     }
 }
Пример #2
0
 public void Execute(string statement, SQLParameters parameters)
 {
     CheckConnectionValid();
     using (SQLCommand command = CreateCommand(false))
     {
         command.Statement = statement;
         command.Parameters.AddRange(parameters);
         command.Execute();
     }
 }
Пример #3
0
        public void Close(SQLCursor ACursor)
        {
            SQLCommand LCommand = ACursor.Command;

            try
            {
                ACursor.Command.Close(ACursor);
            }
            finally
            {
                LCommand.Dispose();
            }
        }
Пример #4
0
        public void Close(SQLCursor cursor)
        {
            SQLCommand command = cursor.Command;

            try
            {
                cursor.Command.Close(cursor);
            }
            finally
            {
                command.Dispose();
            }
        }
Пример #5
0
        public SQLCommand CreateCommand(bool isCursor)
        {
            SQLCommand command = InternalCreateCommand();

            if (_defaultCommandTimeout >= 0)
            {
                command.CommandTimeout = _defaultCommandTimeout;
            }
            if (isCursor)
            {
                command.UseParameters = _defaultUseParametersForCursors;
            }
            command.ShouldNormalizeWhitespace = _defaultShouldNormalizeWhitespace;
            return(command);
        }
Пример #6
0
 internal void SetActiveCommand(SQLCommand ACommand)
 {
     if ((ACommand != null) && (FActiveCommand != null))
     {
         throw new ConnectionException(ConnectionException.Codes.ConnectionBusy);
     }
     FActiveCommand = ACommand;
     if (FActiveCommand != null)
     {
         FState = SQLConnectionState.Executing;
     }
     else
     {
         FState = SQLConnectionState.Idle;
     }
 }
Пример #7
0
        public SQLCursor Open(string AStatement, SQLParameters AParameters, SQLCursorType ACursorType, SQLIsolationLevel ACursorIsolationLevel, SQLCommandBehavior ABehavior)
        {
            CheckConnectionValid();
            SQLCommand LCommand = CreateCommand();

            try
            {
                LCommand.Statement = AStatement;
                LCommand.Parameters.AddRange(AParameters);
                LCommand.CommandBehavior = ABehavior;
                return(LCommand.Open(ACursorType, ACursorIsolationLevel));
            }
            catch
            {
                LCommand.Dispose();
                throw;
            }
        }
Пример #8
0
        public SQLCursor Open(string statement, SQLParameters parameters, SQLCursorType cursorType, SQLIsolationLevel cursorIsolationLevel, SQLCommandBehavior behavior)
        {
            CheckConnectionValid();
            SQLCommand command = CreateCommand(true);

            try
            {
                command.Statement = statement;
                command.Parameters.AddRange(parameters);
                command.CommandBehavior = behavior;
                return(command.Open(cursorType, cursorIsolationLevel));
            }
            catch
            {
                command.Dispose();
                throw;
            }
        }
Пример #9
0
 internal void SetActiveCommand(SQLCommand command)
 {
     if ((command != null) && (_activeCommand != null) && !_supportsMARS)
     {
         throw new ConnectionException(ConnectionException.Codes.ConnectionBusy);
     }
     if ((_activeCommand != null) && _activeCommands.Contains(_activeCommand))
     {
         _activeCommands.Remove(_activeCommand);
     }
     _activeCommand = command;
     if ((_activeCommand != null) && !_activeCommands.Contains(_activeCommand))
     {
         _activeCommands.Add(_activeCommand);
     }
     if (_activeCommands.Count > 0)
     {
         _state = SQLConnectionState.Executing;
     }
     else
     {
         _state = SQLConnectionState.Idle;
     }
 }
Пример #10
0
 protected SQLCursor(SQLCommand command) : base()
 {
     _command = command;
     _command.SetActiveCursor(this);
 }
Пример #11
0
 protected SQLCursor(SQLCommand ACommand) : base()
 {
     FCommand = ACommand;
     FCommand.SetActiveCursor(this);
 }