diff options
author | John Hurliman | 2009-10-04 13:57:51 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-04 13:57:51 -0700 |
commit | 29a4614529bbda02b9c690d2d1812be1d1e7bbae (patch) | |
tree | 89725829b37d502158a114c862a56a075b005b1b /OpenSim/Data/MySQL/MySQLFramework.cs | |
parent | Guarding a line that is sometimes throwing a null pointer exception. (diff) | |
download | opensim-SC-29a4614529bbda02b9c690d2d1812be1d1e7bbae.zip opensim-SC-29a4614529bbda02b9c690d2d1812be1d1e7bbae.tar.gz opensim-SC-29a4614529bbda02b9c690d2d1812be1d1e7bbae.tar.bz2 opensim-SC-29a4614529bbda02b9c690d2d1812be1d1e7bbae.tar.xz |
* MySQL data tests now pass by fixing a bad fix for a bad cast on the asset Local member in MySQLAssetData
* First pass at applying the using(){} pattern to IDisposable objects. Always use the using pattern on IDisposable objects whenever possible, do not manually call .Close() or .Dispose() unless there is no other way to write the code. This pass mostly covers OpenSim.Data.MySQL, and should have no functional change (tests still pass)
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLFramework.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLFramework.cs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs index 6c73249..c756c9c 100644 --- a/OpenSim/Data/MySQL/MySQLFramework.cs +++ b/OpenSim/Data/MySQL/MySQLFramework.cs | |||
@@ -40,6 +40,8 @@ namespace OpenSim.Data.MySQL | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class MySqlFramework | 41 | public class MySqlFramework |
42 | { | 42 | { |
43 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
43 | protected MySqlConnection m_Connection; | 45 | protected MySqlConnection m_Connection; |
44 | 46 | ||
45 | protected MySqlFramework(string connectionString) | 47 | protected MySqlFramework(string connectionString) |
@@ -70,12 +72,11 @@ namespace OpenSim.Data.MySQL | |||
70 | } | 72 | } |
71 | catch (MySqlException e) | 73 | catch (MySqlException e) |
72 | { | 74 | { |
73 | Console.WriteLine(e.ToString()); | 75 | m_log.Error(e.Message, e); |
74 | if (errorSeen) | 76 | if (errorSeen) |
75 | throw; | 77 | throw; |
76 | 78 | ||
77 | // This is "Server has gone away" and "Server lost" | 79 | // This is "Server has gone away" and "Server lost" |
78 | // | ||
79 | if (e.Number == 2006 || e.Number == 2013) | 80 | if (e.Number == 2006 || e.Number == 2013) |
80 | { | 81 | { |
81 | errorSeen = true; | 82 | errorSeen = true; |
@@ -94,7 +95,7 @@ Console.WriteLine(e.ToString()); | |||
94 | } | 95 | } |
95 | catch (Exception e) | 96 | catch (Exception e) |
96 | { | 97 | { |
97 | Console.WriteLine(e.ToString()); | 98 | m_log.Error(e.Message, e); |
98 | return 0; | 99 | return 0; |
99 | } | 100 | } |
100 | } | 101 | } |
@@ -112,12 +113,5 @@ Console.WriteLine(e.ToString()); | |||
112 | 113 | ||
113 | return cmd.ExecuteReader(); | 114 | return cmd.ExecuteReader(); |
114 | } | 115 | } |
115 | |||
116 | protected void CloseReaderCommand(MySqlCommand cmd) | ||
117 | { | ||
118 | cmd.Connection.Close(); | ||
119 | cmd.Connection.Dispose(); | ||
120 | cmd.Dispose(); | ||
121 | } | ||
122 | } | 116 | } |
123 | } | 117 | } |