/// <summary> /// Open 50_run_upgrade.pdc and Parse and run each line. /// </summary> static void RunUpgrade() { //string dropLocation = StartLocation + "\\10_Structure\\" + CurrentEdition + "\\05_UPGRADE\\50_run_upgrade.pdc"; string dropLocation = StartLocation + "\\10_Structure\\" + CurrentEdition + "\\05_UPGRADE\\50_run_upgrade_original.pdc"; if (File.Exists(dropLocation)) { string readLine; OracleClass oc = new OracleClass(); using (StreamReader dpuFile = new StreamReader(dropLocation)) { while ((readLine = dpuFile.ReadLine()) != null) { readLine = readLine.Replace(";", ""); if (readLine.IndexOf("connect", StringComparison.OrdinalIgnoreCase) != -1) { // Connect with edition or normal // readLine = readLine.Remove(0, 8); string UserId = readLine.Remove(readLine.IndexOf("/")); string Password = readLine.Remove(0,readLine.IndexOf("/") + 1); string Edition = ""; if (Password.IndexOf("edition") != -1) { // Parse out edition // Edition = Password.Remove(0,Password.IndexOf("edition")); Password = Password.Remove(Password.IndexOf("edition") - 1); } // Now try to connect // //oc.Connect(UserId, Password, Edition); } else if (readLine.IndexOf("execute", StringComparison.OrdinalIgnoreCase) != -1) { //oc.tran = oc.conn.BeginTransaction(); // execute with a parameter (x) // readLine = readLine.Remove(0, 8); string proName = readLine.Remove(readLine.IndexOf("(")); string paramNum = readLine.Remove(0,readLine.IndexOf("(") + 1); paramNum = paramNum.Remove(1); ProcedureInputClass pic = new ProcedureInputClass(); pic.parameterName = new List<string>(); pic.parameterValue = new List<int>(); pic.numberOfParameters = 1; pic.parameterName.Add("i_section_number"); pic.parameterValue.Add(Convert.ToInt32(paramNum)); pic.procedureName = proName; oc.NonQueryProcedure(pic); //oc.tran.Commit(); //oc.conn.Close(); } } } } }
/// <summary> /// Run Procedure lynx.store_clr_dlls. /// </summary> static void ExecuteClrDll() { Console.WriteLine("Running lynx.store_clr_dlls ..."); OracleClass oc = new OracleClass(); oc.Connect(); oc.tran = oc.conn.BeginTransaction(); ProcedureInputClass pic = new ProcedureInputClass(); pic.numberOfParameters = 0; pic.procedureName = "lynx.store_clr_dlls"; oc.NonQueryProcedure(pic); oc.tran.Commit(); oc.conn.Close(); Console.WriteLine("Finished lynx.store_clr_dlls."); }
/// <summary> /// Open 40_qualify_database_and_unlock_.pdc and Parse and run each line. /// </summary> static void RunQualifyDatabaseAndUnlock() { string dropLocation = StartLocation + "\\10_Structure\\" + CurrentEdition + "\\05_UPGRADE\\40_qualify_database_and_unlock_.pdc"; if (File.Exists(dropLocation)) { string readLine; OracleClass oc = new OracleClass(); oc.Connect(); oc.tran = oc.conn.BeginTransaction(); using (StreamReader dpuFile = new StreamReader(dropLocation)) { while ((readLine = dpuFile.ReadLine()) != null) { readLine = readLine.Replace(";", ""); if (readLine.IndexOf("execute", StringComparison.OrdinalIgnoreCase) != -1) { readLine = readLine.Remove(0, 8); ProcedureInputClass pic = new ProcedureInputClass(); pic.numberOfParameters = 0; pic.procedureName = readLine; oc.NonQueryProcedure(pic); } else { oc.NonQueryText(readLine); } } } oc.tran.Commit(); oc.conn.Close(); } }