public static async Task SetCurrentSchema(this OracleCommand command, string schema, CancellationToken cancellationToken)
        {
            command.CommandText = $"ALTER SESSION SET CURRENT_SCHEMA = \"{schema}\"";
            await command.ExecuteNonQueryAsynchronous(cancellationToken);

            TraceLog.WriteLine($"Set current schema command '{command.CommandText}' executed successfully. ");
        }
Exemplo n.º 2
0
        public async Task Start(CancellationToken cancellationToken)
        {
            _debuggedSessionCommand.CommandText = OracleDatabaseCommands.StartDebuggee;
            _debuggedSessionCommand.AddSimpleParameter("DEBUG_SESSION_ID", null, TerminalValues.Varchar2, 12);
            var debuggedSessionIdParameter = _debuggedSessionCommand.Parameters[0];

            await _debuggedSessionCommand.ExecuteNonQueryAsynchronous(cancellationToken);

            _debuggerSessionId = ((OracleString)debuggedSessionIdParameter.Value).Value;

            TraceLog.WriteLine($"Target debug session initialized. Debug session ID = {_debuggerSessionId}");

            await Attach(cancellationToken);

            TraceLog.WriteLine("Debugger attached. ");

            var attachTask = Synchronize(cancellationToken).ContinueWith(AfterSynchronized, cancellationToken, TaskContinuationOptions.OnlyOnRanToCompletion);

            _debuggedAction = DebuggedCommand.ExecuteNonQueryAsynchronous(cancellationToken);
            TraceLog.WriteLine("Debugged action started. ");

            await attachTask;
        }
Exemplo n.º 3
0
        public async Task <bool> IsRunning(CancellationToken cancellationToken)
        {
            _debuggerSessionCommand.CommandText = "BEGIN IF dbms_debug.target_program_running THEN :isRunning := 1; ELSE :isRunning := 0; END IF; END;";
            _debuggerSessionCommand.Parameters.Clear();
            _debuggerSessionCommand.AddSimpleParameter("ISRUNNING", null, TerminalValues.Number);
            await _debuggerSessionCommand.ExecuteNonQueryAsynchronous(cancellationToken);

            var isRunning = ((OracleDecimal)_debuggerSessionCommand.Parameters[0].Value).Value;

            return(Convert.ToBoolean(isRunning));
        }
Exemplo n.º 4
0
		private async Task ExecuteStartupScript(OracleCommand command, string startupScript, CancellationToken cancellationToken)
		{
			if (String.IsNullOrWhiteSpace(startupScript))
			{
				return;
			}

			_userConnection.ActionName = "Execute startup script";

			var statements = await OracleSqlParser.Instance.ParseAsync(startupScript, cancellationToken);
			foreach (var statement in statements)
			{
				command.CommandText = statement.RootNode.GetText(startupScript);

				try
				{
					await command.ExecuteNonQueryAsynchronous(cancellationToken);
					Trace.WriteLine($"Startup script command '{command.CommandText}' executed successfully. ");
				}
				catch (Exception e)
				{
					Trace.WriteLine($"Startup script command '{command.CommandText}' failed: {e}");
				}
			}
		}