[Quantproject-developers] QuantProject/b2_DataAccess/Tables FaultyTickers.cs,1.1,1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-04-08 14:15:16
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16429/b2_DataAccess/Tables Modified Files: FaultyTickers.cs Log Message: Changed constructor for FaultyTickers class to access faultyTickers table. If the parameter deleteOldFaultyTickersRecords is set true, tickers are deleted from table if their last Attempt Date is older than the Date of the last Quote stored in the database. Index: FaultyTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/FaultyTickers.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FaultyTickers.cs 20 Jan 2005 19:12:29 -0000 1.1 --- FaultyTickers.cs 8 Apr 2006 14:15:10 -0000 1.2 *************** *** 43,52 **** private int count; ! public FaultyTickers() { this.faultyTickers = SqlExecutor.GetDataTable("SELECT * FROM faultyTickers"); this.count = this.faultyTickers.Rows.Count; } ! /// <summary> /// Number of tickers in FaultyTickers table --- 43,79 ---- private int count; ! private void faultyTickers_deleteRowsFromDatabaseTable() { this.faultyTickers = SqlExecutor.GetDataTable("SELECT * FROM faultyTickers"); + + foreach(DataRow row in this.faultyTickers.Rows) + { + if(SqlExecutor.GetDataTable("SELECT * FROM quotes WHERE quTicker='" + + (string)row[0] + "' AND quDate>" + + SQLBuilder.GetDateConstant((DateTime)row[1])).Rows.Count>0) + //there are quotes with date > than last attempt date + + SqlExecutor.ExecuteNonQuery("DELETE * FROM faultyTickers " + + "WHERE ftTicker='" + (string)row[0] + "'"); + + } + + } + + /// <summary> + /// Class to access the Faulty Tickers table (containing tickers not + /// downloaded because of some error). + /// </summary> + /// <param name="deleteOldFaultyTickersRecords">If the parameter is set on true, + /// tickers are deleted from table if their lastAttemptDate is older than + /// last quote Date stored in the database</param> + public FaultyTickers(bool deleteOldFaultyTickersRecords) + { + if(deleteOldFaultyTickersRecords) + this.faultyTickers_deleteRowsFromDatabaseTable(); + this.faultyTickers = SqlExecutor.GetDataTable("SELECT * FROM faultyTickers ORDER BY ftDate"); this.count = this.faultyTickers.Rows.Count; } ! /// <summary> /// Number of tickers in FaultyTickers table |