예제 #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);
 }