diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-04-11 20:52:57 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-04-11 20:52:57 +0400 |
commit | ac673c874a3ca2c3dfdb31b4d63c187ac13c14ba (patch) | |
tree | 65efbbd734154225aa5e9c81d0b30c36bf9cd863 /webcompare | |
parent | 41bf6a2dac7a8a1c55f600030bc47df9b9dd29f3 (diff) |
2009-04-11 Gonzalo Paniagua Javier <gonzalo@novell.com>
* db/init-db.mysql: retrieve the last_updated field from the DB.
* App_Code/NodeUtils.cs: get master_id and last_updated.
* status.aspx: last updated time comes from the DB. Remove everything
after a '<' for generic type names when creating the link to MSDN.
svn path=/trunk/mono-tools/; revision=131521
Diffstat (limited to 'webcompare')
-rw-r--r-- | webcompare/App_Code/NodeUtils.cs | 33 | ||||
-rw-r--r-- | webcompare/ChangeLog | 7 | ||||
-rw-r--r-- | webcompare/db/init-db.mysql | 16 | ||||
-rw-r--r-- | webcompare/status.aspx | 8 |
4 files changed, 53 insertions, 11 deletions
diff --git a/webcompare/App_Code/NodeUtils.cs b/webcompare/App_Code/NodeUtils.cs index f1ebcc2f..563f976d 100644 --- a/webcompare/App_Code/NodeUtils.cs +++ b/webcompare/App_Code/NodeUtils.cs @@ -55,6 +55,7 @@ public class NodeUtils { string assembly; int master_id; string detail_level; + DateTime last_updated; static NodeUtils () { @@ -81,20 +82,32 @@ public class NodeUtils { this.assembly = assembly; this.detail_level = detail_level; master_id = -1; + using (IDbConnection cnc = GetConnection ()) { + GetBasicInfo (cnc); + } } - int GetMasterID (IDbConnection cnc) + void GetBasicInfo (IDbConnection cnc) { - if (master_id >= 0) - return master_id; - IDbCommand cmd = GetCommandForProcedure (cnc, "get_master_id"); AddParameter (cmd, "reference", reference); AddParameter (cmd, "profile", profile); AddParameter (cmd, "assembly", assembly); AddParameter (cmd, "detail_level", detail_level); - master_id = Convert.ToInt32 (cmd.ExecuteScalar ()); - return master_id; + using (IDataReader reader = cmd.ExecuteReader ()) { + if (reader.Read ()) { + master_id = Convert.ToInt32 (reader ["id"]); + last_updated = Convert.ToDateTime (reader ["last_updated"]); + } + } + } + + public int MasterID { + get { return master_id; } + } + + public DateTime LastUpdateTime { + get { return last_updated; } } public ComparisonNode GetRootNode () @@ -121,7 +134,7 @@ public class NodeUtils { { if (node.HasMessages) { IDbCommand cmd = GetCommandForProcedure (cnc, "get_messages"); - AddParameter (cmd, "master_id", GetMasterID (cnc)); + AddParameter (cmd, "master_id", MasterID); AddParameter (cmd, "nodename", node.InternalID); //Console.WriteLine ("call get_messages('{0}')", node.InternalID); using (IDataReader reader = cmd.ExecuteReader ()) { @@ -159,7 +172,7 @@ public class NodeUtils { ComparisonNode node = null; using (IDbConnection cnc = GetConnection ()) { IDbCommand cmd = GetCommandForProcedure (cnc, "get_node_by_name"); - AddParameter (cmd, "master_id", GetMasterID (cnc)); + AddParameter (cmd, "master_id", MasterID); AddParameter (cmd, "nodename", node_name); //Console.WriteLine ("call get_node_by_name ('{0}')", node_name); using (IDataReader reader = cmd.ExecuteReader ()) { @@ -192,9 +205,9 @@ public class NodeUtils { using (IDbConnection cnc = GetConnection ()) { IDbCommand cmd = GetCommandForProcedure (cnc, "get_children"); - AddParameter (cmd, "master_id", GetMasterID (cnc)); + AddParameter (cmd, "master_id", MasterID); AddParameter (cmd, "parent_name", node.InternalID); - //Console.WriteLine ("call get_children ({0}, '{1}')", GetMasterID (cnc), node.InternalID); + //Console.WriteLine ("call get_children ({0}, '{1}')", MasterID, node.InternalID); using (IDataReader reader = cmd.ExecuteReader ()) { while (reader.Read ()) { CompType comp_type = (CompType) reader ["comparison_type"]; diff --git a/webcompare/ChangeLog b/webcompare/ChangeLog index 2953fb20..709150ee 100644 --- a/webcompare/ChangeLog +++ b/webcompare/ChangeLog @@ -1,5 +1,12 @@ 2009-04-11 Gonzalo Paniagua Javier <gonzalo@novell.com> + * db/init-db.mysql: retrieve the last_updated field from the DB. + * App_Code/NodeUtils.cs: get master_id and last_updated. + * status.aspx: last updated time comes from the DB. Remove everything + after a '<' for generic type names when creating the link to MSDN. + +2009-04-11 Gonzalo Paniagua Javier <gonzalo@novell.com> + * App_Code/NodeUtils.cs: new GetNodeByName overloads. * status.aspx: get all the parent nodes for the one we're populating so that creating the links to MSDN work. diff --git a/webcompare/db/init-db.mysql b/webcompare/db/init-db.mysql index 9096ba52..4f6fc077 100644 --- a/webcompare/db/init-db.mysql +++ b/webcompare/db/init-db.mysql @@ -165,3 +165,19 @@ INSERT INTO filters VALUES (NULL, 0, 'System.Runtime.InteropServices.ComVisibleA INSERT INTO filters VALUES (NULL, 0, 'System.Void Finalize()', NULL); INSERT INTO filters VALUES (NULL, 0, 'System.ComponentModel.DesignerSerializationVisibilityAttribute', NULL); + +#### Retrieve last_updated in 'get_master_id' +DELIMITER $$ + +DROP PROCEDURE IF EXISTS `webcompare`.`get_master_id`$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `get_master_id`(in reference varchar(100), in profile varchar (100), in assembly varchar(100), in detail_level varchar (25)) +BEGIN +SELECT m.id, m.last_updated FROM master m +WHERE m.reference = reference AND m.profile = profile AND m.assembly = assembly AND m.detail_level = detail_level +ORDER BY last_updated DESC +LIMIT 1; + +END$$ + +DELIMITER ; + diff --git a/webcompare/status.aspx b/webcompare/status.aspx index 66102c4b..c024149a 100644 --- a/webcompare/status.aspx +++ b/webcompare/status.aspx @@ -92,7 +92,7 @@ public void Page_Load () tn.PopulateOnDemand = true; tree.Nodes.Add (tn); - var diff = DateTime.UtcNow - cp.GetAssemblyTime (); + var diff = DateTime.UtcNow - DB.LastUpdateTime; string t; if (diff.Days > 1) t = String.Format ("{0} days", diff.Days); @@ -197,6 +197,9 @@ static string GetFQN (ComparisonNode node) string n = GetFQN (node.Parent); int p = node.Name.IndexOf (' '); string name = p == -1 ? node.Name : node.Name.Substring (p+1); + p = name.IndexOf ('<'); + if (p != -1) + name = name.Substring (0, p); // remove generic parameters from URL return n == "" ? name : n + "." + name; } @@ -211,6 +214,9 @@ static string GetMethodFQN (ComparisonNode node) int q = node.Name.IndexOf (' '); string name = p == -1 || q == -1 ? node.Name : node.Name.Substring (q+1, p-q-1); + p = name.IndexOf ('<'); + if (p != -1) + name = name.Substring (0, p); // remove generic parameters from URL if (name == ".ctor") name = ""; |