コード例 #1
0
ファイル: SQLConnection.cs プロジェクト: laszlo-kiss/Dataphor
 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
ファイル: SQLConnection.cs プロジェクト: laszlo-kiss/Dataphor
        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
ファイル: SQLConnection.cs プロジェクト: laszlo-kiss/Dataphor
 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
ファイル: SQLConnection.cs プロジェクト: laszlo-kiss/Dataphor
        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
ファイル: SQLCursor.cs プロジェクト: laszlo-kiss/Dataphor
 protected SQLCursor(SQLCommand command) : base()
 {
     _command = command;
     _command.SetActiveCursor(this);
 }
コード例 #11
0
ファイル: SQLConnection.cs プロジェクト: laszlo-kiss/Dataphor
 protected SQLCursor(SQLCommand ACommand) : base()
 {
     FCommand = ACommand;
     FCommand.SetActiveCursor(this);
 }