|
From: Jason J. <jrj...@us...> - 2010-03-02 21:50:17
|
Update of /cvsroot/autopatch/autopatch/migrate/dotnet/AutopatchNet/src/com/tacitknowledge/util/migration/ado In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7743/migrate/dotnet/AutopatchNet/src/com/tacitknowledge/util/migration/ado Modified Files: SqlLoadMigrationTask.cs Log Message: Implemented delimited file loading Index: SqlLoadMigrationTask.cs =================================================================== RCS file: /cvsroot/autopatch/autopatch/migrate/dotnet/AutopatchNet/src/com/tacitknowledge/util/migration/ado/SqlLoadMigrationTask.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlLoadMigrationTask.cs 20 Mar 2007 19:38:32 -0000 1.1 --- SqlLoadMigrationTask.cs 2 Mar 2010 21:49:27 -0000 1.2 *************** *** 47,51 **** protected internal abstract System.String StatmentSql{get;} /// <summary> Class logger</summary> - //UPGRADE_NOTE: The initialization of 'log' was moved to static method 'com.tacitknowledge.util.migration.ado.SqlLoadMigrationTask'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1005'" private static ILog log; --- 47,50 ---- *************** *** 58,62 **** /// <seealso cref="MigrationTaskSupport.Migrate(IMigrationContext)"> /// </seealso> ! public override void Migrate(IMigrationContext ctx) { DataSourceMigrationContext context = (DataSourceMigrationContext) ctx; --- 57,61 ---- /// <seealso cref="MigrationTaskSupport.Migrate(IMigrationContext)"> /// </seealso> ! public override void Migrate(IMigrationContext ctx) { DataSourceMigrationContext context = (DataSourceMigrationContext) ctx; *************** *** 64,70 **** try { ! //UPGRADE_NOTE: There are other database providers or managers under System.Data namespace which can be used optionally to better fit the application requirements. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1208'" ! System.Data.Common.DbConnection conn = context.Connection; ! System.Data.Common.DbCommand stmt = null;// SupportClass.TransactionManager.manager.PrepareStatement(conn, StatmentSql); System.Collections.IList rows = getData(ResourceAsStream); int rowCount = rows.Count; --- 63,69 ---- try { ! System.Data.Common.DbCommand stmt = context.Database.GetSqlStringCommand(StatmentSql); ! stmt.Connection = context.Connection; ! stmt.Transaction = context.Transaction; System.Collections.IList rows = getData(ResourceAsStream); int rowCount = rows.Count; *************** *** 75,89 **** if (loadRowFlag) { ! //UPGRADE_ISSUE: Method 'java.sql.PreparedStatement.addBatch' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javasqlPreparedStatementaddBatch'" ! //stmt.addBatch(); ! if (i % 50 == 0) ! { ! //UPGRADE_TODO: Method 'java.sql.Statement.executeBatch' was converted to 'SupportClass.BatchManager.manager.ExecuteUpdate' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlStatementexecuteBatch'" ! //SupportClass.BatchManager.manager.ExecuteUpdate(stmt); ! } } } - //UPGRADE_TODO: Method 'java.sql.Statement.executeBatch' was converted to 'SupportClass.BatchManager.manager.ExecuteUpdate' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlStatementexecuteBatch'" - //SupportClass.BatchManager.manager.ExecuteUpdate(stmt); } catch (System.Exception e) --- 74,80 ---- if (loadRowFlag) { ! stmt.ExecuteNonQuery(); } } } catch (System.Exception e) *************** *** 91,105 **** System.String message = Name + ": Error running SQL \"" + StatmentSql + "\""; log.Error(message, e); ! if (e is System.Data.OleDb.OleDbException) ! { ! //UPGRADE_ISSUE: Method 'java.sql.SQLException.getNextException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javasqlSQLExceptiongetNextException'" ! //if (((System.Data.OleDb.OleDbException) e).getNextException() != null) ! //{ ! // //UPGRADE_ISSUE: Method 'java.sql.SQLException.getNextException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javasqlSQLExceptiongetNextException'" ! // log.Error("Chained SQL Exception", ((System.Data.OleDb.OleDbException) e).getNextException()); ! //} ! } ! ! throw new MigrationException(message, e); } } --- 82,86 ---- System.String message = Name + ": Error running SQL \"" + StatmentSql + "\""; log.Error(message, e); ! throw new MigrationException(message, e); } } *************** *** 130,144 **** /// /// </summary> ! /// <param name="is">the input stream containing the data to load /// </param> /// <returns> the data to load as a list of rows /// </returns> /// <throws> IOException if the input stream could not be read </throws> ! protected internal virtual System.Collections.IList getData(System.IO.Stream is_Renamed) { System.Collections.IList data = new System.Collections.ArrayList(); ! //UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.io.BufferedReader.BufferedReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'" ! //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'" ! System.IO.StreamReader reader = new System.IO.StreamReader(new System.IO.StreamReader(is_Renamed, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(is_Renamed, System.Text.Encoding.Default).CurrentEncoding); System.String line = null; while ((line = reader.ReadLine()) != null) --- 111,123 ---- /// /// </summary> ! /// <param name="inputStream">the input stream containing the data to load /// </param> /// <returns> the data to load as a list of rows /// </returns> /// <throws> IOException if the input stream could not be read </throws> ! protected internal virtual System.Collections.IList getData(System.IO.Stream inputStream) { System.Collections.IList data = new System.Collections.ArrayList(); ! System.IO.StreamReader reader = new System.IO.StreamReader(inputStream); System.String line = null; while ((line = reader.ReadLine()) != null) |