public async System.Threading.Tasks.Task ExecuteStoredProcedureWithOutputParamAsync() { var query = "UnitTestProc"; var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.StoredProcedure, TimeoutSeconds = 60 }; var oracleParam = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.Varchar2, Name = "returnVal", Size = 255 }; var output = new OutputProperties(); output.OutputParameters = new OracleParametersForTask[1]; output.OutputParameters[0] = oracleParam; var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
public async System.Threading.Tasks.Task InsertValuesViaParametersAsync() { var query = "INSERT INTO TestTable (textField) VALUES (:param1)"; OracleParametersForTask ownOracleParam = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.Varchar2, Name = "param1", Value = "Text from parameter" }; var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.Command, TimeoutSeconds = 60, InputParameters = new OracleParametersForTask[1] }; input.InputParameters[0] = ownOracleParam; var output = new OutputProperties(); var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
private void ControlKeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Escape: case Key.Enter: ExecuteCommand.Execute(ExecuteCommandParameter); break; } }
private void _executeMainCompileCommand() { ExecuteCommand executeCommand = new ExecuteCommand(); Console.WriteLine("Starting rendering."); File.Delete(Path.Combine(_compilatorPathFolder, "Compilation.mp4")); string command = $"cd {_compilatorPathFolder} & ffmpeg -f concat -safe 0 -i videos.txt -c:v libx264 -preset {_renderSpeed} -crf 13 -c:a aac Compilation.mp4"; executeCommand.Execute(command); Console.WriteLine("Rendering complete."); }
static void Main(string[] args) { var arguments = ParseCommandLine(args); RequiredAttributes(arguments, "databaseProvider", "codeFormatProvider", "codeHighlightProvider", "outputProvider", "action" ); var loader = new AssemblyLoader(); var dbProvider = loader.CreateTypeFromAssembly <DbProvider>(arguments["databaseProvider"], arguments); var dbCodeFormatter = loader.CreateTypeFromAssembly <DbTraceCodeFormatter>(arguments["codeFormatProvider"], arguments); var codeHighlighter = loader.CreateTypeFromAssembly <HighlightCodeProvider>(arguments["codeHighlightProvider"], arguments); var outputProvider = loader.CreateTypeFromAssembly <OutputProvider>(arguments["outputProvider"], arguments); var command = arguments["action"].ToLower().Trim(); var traceName = arguments.ContainsKey("traceFileName") ? arguments["traceFileName"] : null; switch (command) { case "generate": RequiredAttributes(arguments, "traceFileName" ); var generateCommand = new GenerateOutputCommand(dbProvider, dbCodeFormatter, codeHighlighter, outputProvider, traceName); generateCommand.Execute(); break; case "execute": RequiredAttributes(arguments, "target" ); traceName = traceName ?? DateTime.Now.ToString("yyyyMMddHHmmss"); var startCommand = new StartCommand(outputProvider, dbProvider, traceName); startCommand.Execute(); var executeCommand = new ExecuteCommand(arguments["target"], arguments.ContainsKey("targetArgs") ? arguments["targetArgs"] : string.Empty); executeCommand.Execute(); var stopCommand = new StopCommand(dbProvider, outputProvider, traceName); stopCommand.Execute(); break; } }
private static void Run() { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile( path: "appsettings.json", optional: false, reloadOnChange: true) .Build(); var appSettings = new AppSettings(); new ConfigureFromConfigurationOptions <AppSettings>(configuration.GetSection("Settings")).Configure(appSettings); using (var watcher = new FileSystemWatcher()) { watcher.Path = appSettings.Path; // @"C:\\inetpub\\wwwroot\\tronar.multiplixe\\multiplixe.comum\\multiplixe.comum.enums\\bin\\Release"; watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; watcher.Filter = "*.nupkg"; watcher.EnableRaisingEvents = true; watcher.IncludeSubdirectories = true; watcher.Created += (object sender, FileSystemEventArgs e) => { if (e.FullPath.ToLower().Contains("release")) { Console.WriteLine(">> {0}", e.FullPath); var command = new PublishNugetPackageCommand(e.FullPath, appSettings.Token); ExecuteCommand.Execute(command); } else { Console.WriteLine("Pacote não esta em modo RELEASE"); } }; Console.WriteLine($"Ouvindo pasta {appSettings.Path} ('q' pra sair)"); while (Console.Read() != 'q') { ; } } }
public async System.Threading.Tasks.Task InsertValues() { var query = "INSERT INTO TestTable (textField) VALUES ('unit test text')"; var output = new OutputProperties(); var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.Command, TimeoutSeconds = 60 }; var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
public async System.Threading.Tasks.Task CreateTable() { var query = "CREATE TABLE TestTable(textField VARCHAR(255))"; var output = new OutputProperties(); var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.Command, TimeoutSeconds = 60 }; var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
public async System.Threading.Tasks.Task GatAndUseRefCursorToJtoken() { // Replicate of test of https://docs.oracle.com/database/121/ODPNT/featRefCursor.htm#ODPNT319 ////////////////////////////////////////////////// /// Get refcursor var oracleParam = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.RefCursor, Name = "outRefPrm", Value = DBNull.Value, Size = 0 }; var output = new OutputProperties { DataReturnType = OracleCommandReturnType.Parameters }; var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = "begin open :1 for select col1 from test; end;", CommandType = OracleCommandType.Command, BindParametersByName = false, TimeoutSeconds = 60 }; output.OutputParameters = new OracleParametersForTask[1]; output.OutputParameters[0] = oracleParam; var result = await ExecuteCommand.Execute(input, output, _taskOptions); ////////////////////////////////////////////////// /// Ref cursor to JToken var secondInput = new RefCursorToJTokenInput { Refcursor = result.Result[0] }; var secondResult = ExecuteCommand.RefCursorToJToken(secondInput); StringAssert.Contains(@"[{""COL1"":1.0}]", JsonConvert.SerializeObject(secondResult.Result)); }
private void _compileCoub(CoubInfo coubInfo) { if (File.Exists(Path.Combine(coubInfo.Path, "Coub.mp4"))) { Console.WriteLine($"Coub {coubInfo.Permalink} is alredy exist"); return; } ExecuteCommand executeCommand = new ExecuteCommand(); Console.WriteLine($"Compiling coub {coubInfo.Permalink}"); string command; if (File.Exists(Path.Combine(coubInfo.Path, "Audio.mp3"))) { command = $"cd {coubInfo.Path} && ffmpeg -i Video.mp4 -t {coubInfo.Duration.ToString("0.0", CultureInfo.InvariantCulture)} -lavfi \"split [original][copy];[original]scale=w=-1:h=1080:-1:flags=neighbor+bitexact+accurate_rnd+full_chroma_int+full_chroma_inp+print_info,setsar=1:1[ov];[copy]scale=w=1920+1000*iw/ih:h=ih*1920/iw+1000*ih/iw" + $":flags=neighbor+bitexact+accurate_rnd+full_chroma_int+full_chroma_inp+print_info,setsar=1:1,boxblur=luma_radius=min(h\\,w)/20:luma_power=1:chroma_radius=min(cw\\,ch)/20:chroma_power=1[blur];[blur][ov]overlay=(W-w)/2:(H-h)/2,crop=w=1920:h=1080\" " + $"-i Audio.mp3 -map 0:v -map 1:a -c:a copy Coub.mp4 -y"; executeCommand.Execute(command); } }
public async System.Threading.Tasks.Task CreateProcedure() { var query = @" CREATE PROCEDURE UnitTestProc (returnVal OUT VARCHAR2) AS BEGIN SELECT TEXTFIELD INTO returnVal FROM TESTTABLE WHERE ROWNUM = 1; END;"; var output = new OutputProperties(); var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.Command, TimeoutSeconds = 60 }; var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
public async System.Threading.Tasks.Task TestTearDownAsync() { var query = "DROP TABLE TestTable"; var output = new OutputProperties(); var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = query, CommandType = OracleCommandType.Command, TimeoutSeconds = 60 }; var result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); input.CommandOrProcedureName = "DROP PROCEDURE UnitTestProc"; result = await ExecuteCommand.Execute(input, output, _taskOptions); Assert.AreEqual(true, result.Success); }
public async Task GetAndUseRefCursor() { // Replicate of test of https://docs.oracle.com/database/121/ODPNT/featRefCursor.htm#ODPNT319 // create table and procedure: /* * connect scott/tiger@oracle * create table test (col1 number); * insert into test(col1) values (1); * commit; * * create or replace package testPkg as type empCur is REF Cursor; * end testPkg; * / * * create or replace procedure testSP(param1 IN testPkg.empCur, param2 OUT NUMBER) * as * begin * FETCH param1 into param2; * end; * / */ // Note this kind of usage of ref cursors don't work in frends. When run in frends task doesn't accept ref cursors as input parameters. ////////////////////////////////////////////////// /// Get refcursor var oracleParam = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.RefCursor, Name = "outRefPrm", Value = DBNull.Value, Size = 0 }; var output = new OutputProperties { DataReturnType = OracleCommandReturnType.Parameters }; var input = new Input { ConnectionString = connectionString, CommandOrProcedureName = "begin open :1 for select col1 from test; end;", CommandType = OracleCommandType.Command, BindParametersByName = false, TimeoutSeconds = 60 }; output.OutputParameters = new OracleParametersForTask[1]; output.OutputParameters[0] = oracleParam; var result = await ExecuteCommand.Execute(input, output, _taskOptions); ////////////////////////////////////////////////// /// Use refcursor var secondInput = new Input { ConnectionString = connectionString, CommandOrProcedureName = "testSP", CommandType = OracleCommandType.StoredProcedure, InputParameters = new OracleParametersForTask[1], BindParametersByName = false, TimeoutSeconds = 60 }; OracleParametersForTask secondInputParameters = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.RefCursor, Name = "param1", Value = result.Result[0].Value, Size = 0 }; secondInput.InputParameters[0] = secondInputParameters; var secondOutputParameters = new OracleParametersForTask { DataType = OracleParametersForTask.ParameterDataType.Int32, Name = "param2", Value = DBNull.Value, Size = 0 }; var secondOutput = new OutputProperties { OutputParameters = new OracleParametersForTask[1], DataReturnType = OracleCommandReturnType.XmlString }; secondOutput.OutputParameters[0] = secondOutputParameters; var secondResult = await ExecuteCommand.Execute(secondInput, secondOutput, _taskOptions); Assert.AreEqual("<Root>\r\n <param2>1</param2>\r\n</Root>", secondResult.Result); }