[Quantproject-developers] QuantProject/b2_DataAccess DataBase.cs, 1.12, 1.13 DataBaseVersionManager
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-12-30 00:12:01
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16515/b2_DataAccess Modified Files: DataBase.cs DataBaseVersionManager.cs Log Message: Now bot Access and MySql are supported (but the DataBaseVersionManager will need some tuning in order to work with a MySQL database without structure) Index: DataBaseVersionManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBaseVersionManager.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** DataBaseVersionManager.cs 27 Aug 2005 19:20:26 -0000 1.15 --- DataBaseVersionManager.cs 30 Dec 2008 00:11:44 -0000 1.16 *************** *** 23,29 **** --- 23,33 ---- using System; using System.Windows.Forms; + using System.Data.Common; using System.Data.OleDb; using System.Data; using System.Collections; + + using MySql.Data.MySqlClient; + using QuantProject.ADT; *************** *** 47,51 **** public class DataBaseVersionManager { ! private OleDbConnection oleDbConnection; delegate void updatingMethodHandler(); private ArrayList updatingMethods; --- 51,55 ---- public class DataBaseVersionManager { ! private DbConnection dbConnection; delegate void updatingMethodHandler(); private ArrayList updatingMethods; *************** *** 75,83 **** } ! public DataBaseVersionManager(OleDbConnection oleDbConnection) { try { ! this.oleDbConnection = oleDbConnection; this.initialize_updatingMethods(); } --- 79,87 ---- } ! public DataBaseVersionManager( DbConnection dbConnection) { try { ! this.dbConnection = dbConnection; this.initialize_updatingMethods(); } *************** *** 85,89 **** { MessageBox.Show(ex.ToString()); ! this.oleDbConnection.Close(); } } --- 89,93 ---- { MessageBox.Show(ex.ToString()); ! this.dbConnection.Close(); } } *************** *** 217,232 **** "AND tickers_tickerGroups.ttEventDate Is Null"); ! } private void executeCommand(string commandToBeExecuted) { try { ! OleDbCommand oleDbCommand = new OleDbCommand( commandToBeExecuted , this.oleDbConnection ); ! int checkCommandExecution = oleDbCommand.ExecuteNonQuery(); } catch(Exception ex) { string notUsed = ex.ToString();// to avoid warning after compilation ! } } --- 221,239 ---- "AND tickers_tickerGroups.ttEventDate Is Null"); ! } ! private void executeCommand(string commandToBeExecuted) { try { ! // DbCommand dbCommand = new DbCommand( commandToBeExecuted , this.dbConnection ); ! // DbCommand dbCommand = this.getDbCommand( commandToBeExecuted ); ! DbCommand dbCommand = DbCommandProvider.GetDbCommand( commandToBeExecuted ); ! int checkCommandExecution = dbCommand.ExecuteNonQuery(); } catch(Exception ex) { string notUsed = ex.ToString();// to avoid warning after compilation ! } } Index: DataBase.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBase.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DataBase.cs 20 Nov 2008 20:39:03 -0000 1.12 --- DataBase.cs 30 Dec 2008 00:11:44 -0000 1.13 *************** *** 25,28 **** --- 25,29 ---- using System.Collections.Generic; using System.Data; + using System.Data.Common; using System.Data.OleDb; using System.Windows.Forms; *************** *** 40,44 **** public class DataBase { ! private static OleDbConnection oleDbConnection = ConnectionProvider.OleDbConnection; public DataBase() --- 41,45 ---- public class DataBase { ! private static DbConnection dbConnection = ConnectionProvider.DbConnection; public DataBase() *************** *** 95,101 **** "and (quDate>=" + SQLBuilder.GetDateConstant( firstDate ) + ") " + "and (quDate<=" + SQLBuilder.GetDateConstant( lastDate ) + ")"; ! OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter( commandString , oleDbConnection ); ! DataTable dataTable = new DataTable(); ! oleDbDataAdapter.Fill( dataTable ); history.Import( dataTable , "quDate" , getFieldName( quoteField ) ); return history; --- 96,103 ---- "and (quDate>=" + SQLBuilder.GetDateConstant( firstDate ) + ") " + "and (quDate<=" + SQLBuilder.GetDateConstant( lastDate ) + ")"; ! // OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter( commandString , dbConnection ); ! // DataTable dataTable = new DataTable(); ! DataTable dataTable = SqlExecutor.GetDataTable( commandString ); ! // oleDbDataAdapter.Fill( dataTable ); history.Import( dataTable , "quDate" , getFieldName( quoteField ) ); return history; |