public static void DataReaderTest(MainForm frm) { PFMsOracle oracle = new PFMsOracle(); string connectionString = string.Empty; Stopwatch sw = new Stopwatch(); try { oracle.DataSource = frm.txtDataSource.Text; oracle.UseIntegratedSecurity = frm.chkUseIntegratedSecurity.Checked; oracle.Username = frm.txtUserId.Text; oracle.Password = frm.txtPassword.Text; connectionString = oracle.ConnectionString; _msg.Length = 0; _msg.Append("Connection string is: \r\n"); _msg.Append(connectionString); Program._messageLog.WriteLine(_msg.ToString()); if (frm.txtSQLQuery.Text.Length == 0) { throw new System.Exception("You must specify a SQL query to run."); } sw.Start(); oracle.OpenConnection(); oracle.SQLQuery = frm.txtSQLQuery.Text; if (frm.chkIsStoredProcedure.Checked) { oracle.CommandType = CommandType.StoredProcedure; } else { oracle.CommandType = CommandType.Text; } sw.Stop(); _msg.Length = 0; _msg.Append("Open connection time: "); _msg.Append(sw.FormattedElapsedTime); Program._messageLog.WriteLine(_msg.ToString()); Program._messageLog.WriteLine("\r\nRunning data extract tests ...\r\n"); oracle.returnResultAsString += new PFMsOracle.ResultAsStringDelegate(OutputResultsToFile); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } _textFile.OpenFile(@"c:\temp\ReaderDelimitedTestExtract.txt", PFFileOpenOperation.OpenFileForWrite); sw.Start(); OracleDataReader rdr = (OracleDataReader)oracle.RunQueryDataReader(); oracle.ExtractDelimitedDataFromDataReader(rdr, ",", "\r\n", true); sw.Stop(); _msg.Length = 0; _msg.Append("Extract Delimiated Dataset time: "); _msg.Append(sw.FormattedElapsedTime); Program._messageLog.WriteLine(_msg.ToString()); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } _textFile.OpenFile(@"c:\temp\ReaderFixedLengthTestExtract.txt", PFFileOpenOperation.OpenFileForWrite); rdr.Close(); sw.Start(); rdr = (OracleDataReader)oracle.RunQueryDataReader(); oracle.ExtractFixedLengthDataFromDataReader(rdr, true, true, false); sw.Stop(); _msg.Length = 0; _msg.Append("Extract Fixed Length Dataset time: "); _msg.Append(sw.FormattedElapsedTime); Program._messageLog.WriteLine(_msg.ToString()); if (_textFile.FileIsOpen) { _textFile.CloseFile(); } rdr.Close(); rdr = (OracleDataReader)oracle.RunQueryDataReader(); oracle.SaveDataReaderToXmlFile(rdr, @"c:\temp\Testrdr.xml"); rdr.Close(); rdr = (OracleDataReader)oracle.RunQueryDataReader(); oracle.SaveDataReaderWithSchemaToXmlFile(rdr, @"c:\temp\Testrdrplus.xml"); rdr.Close(); rdr = (OracleDataReader)oracle.RunQueryDataReader(); oracle.SaveDataReaderToXmlSchemaFile(rdr, @"c:\temp\Testrdr.xsd"); rdr.Close(); rdr = (OracleDataReader)oracle.RunQueryDataReader(); PFDataProcessor dataProcessor = new PFDataProcessor(); XmlDocument xmlDoc = dataProcessor.CopyDataTableToXmlDocument(oracle.ConvertDataReaderToDataTable(rdr)); Program._messageLog.WriteLine("\r\n" + xmlDoc.OuterXml + "\r\n"); rdr.Close(); } catch (System.Exception ex) { frm.OutputErrorMessageToLog(ex); } finally { oracle.CloseConnection(); oracle = null; } }