aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL
diff options
context:
space:
mode:
authorUbitUmarov2015-09-02 19:54:53 +0100
committerUbitUmarov2015-09-02 19:54:53 +0100
commita11edceb00b5b86f825bd957bdac9edb91f893dd (patch)
treec192eae26f3aadf365a66f32fc6d9ade2f0a0c61 /OpenSim/Data/MySQL
parentbad merge? (diff)
downloadopensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.zip
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.gz
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.bz2
opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.xz
seems to compile ( tests comented out)
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs47
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs47
-rw-r--r--OpenSim/Data/MySQL/MySQLUserProfilesData.cs48
3 files changed, 33 insertions, 109 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index cb5a38e..76b1e38 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -202,52 +202,15 @@ namespace OpenSim.Data.MySQL
202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); 202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
203 cmd.Parameters.AddWithValue("?data", asset.Data); 203 cmd.Parameters.AddWithValue("?data", asset.Data);
204 cmd.ExecuteNonQuery(); 204 cmd.ExecuteNonQuery();
205 } 205 return true;
206
207 string assetDescription = asset.Description;
208 if (asset.Description.Length > 64)
209 {
210 assetDescription = asset.Description.Substring(0, 64);
211 m_log.WarnFormat(
212 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
213 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
214 }
215
216 try
217 {
218 using (cmd)
219 {
220 // create unix epoch time
221 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
222 cmd.Parameters.AddWithValue("?id", asset.ID);
223 cmd.Parameters.AddWithValue("?name", assetName);
224 cmd.Parameters.AddWithValue("?description", assetDescription);
225 cmd.Parameters.AddWithValue("?assetType", asset.Type);
226 cmd.Parameters.AddWithValue("?local", asset.Local);
227 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
228 cmd.Parameters.AddWithValue("?create_time", now);
229 cmd.Parameters.AddWithValue("?access_time", now);
230 cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
231 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
232 cmd.Parameters.AddWithValue("?data", asset.Data);
233 cmd.ExecuteNonQuery();
234 return true;
235 }
236 }
237 catch (Exception e)
238 {
239 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
240 asset.FullID, asset.Name, e.Message);
241 return false;
242 } 206 }
243 } 207 }
208
244 catch (Exception e) 209 catch (Exception e)
245 { 210 {
246 m_log.Error( 211 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
247 string.Format( 212 asset.FullID, asset.Name, e.Message);
248 "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", 213 return false;
249 asset.FullID, asset.Name)
250 , e);
251 } 214 }
252 } 215 }
253 } 216 }
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 81b5ec4..549d129 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -1105,7 +1105,7 @@ namespace OpenSim.Data.MySQL
1105 "use_estate_sun, fixed_sun, sun_position, " + 1105 "use_estate_sun, fixed_sun, sun_position, " +
1106 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + 1106 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1107 "sunvectorz, loaded_creation_datetime, " + 1107 "sunvectorz, loaded_creation_datetime, " +
1108 "loaded_creation_id, map_tile_ID, " + 1108 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1109 "TelehubObject, parcel_tile_ID) " + 1109 "TelehubObject, parcel_tile_ID) " +
1110 "values (?RegionUUID, ?BlockTerraform, " + 1110 "values (?RegionUUID, ?BlockTerraform, " +
1111 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 1111 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
@@ -1122,53 +1122,14 @@ namespace OpenSim.Data.MySQL
1122 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + 1122 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1123 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + 1123 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1124 "?LoadedCreationDateTime, ?LoadedCreationID, " + 1124 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1125 "?TerrainImageID, " + 1125 "?TerrainImageID, ?block_search, ?casino, " +
1126 "?TelehubObject, ?ParcelImageID)"; 1126 "?TelehubObject, ?ParcelImageID)";
1127 1127
1128 using (MySqlCommand cmd = dbcon.CreateCommand())
1129 {
1130 cmd.CommandText = "replace into regionsettings (regionUUID, " +
1131 "block_terraform, block_fly, allow_damage, " +
1132 "restrict_pushing, allow_land_resell, " +
1133 "allow_land_join_divide, block_show_in_search, " +
1134 "agent_limit, object_bonus, maturity, " +
1135 "disable_scripts, disable_collisions, " +
1136 "disable_physics, terrain_texture_1, " +
1137 "terrain_texture_2, terrain_texture_3, " +
1138 "terrain_texture_4, elevation_1_nw, " +
1139 "elevation_2_nw, elevation_1_ne, " +
1140 "elevation_2_ne, elevation_1_se, " +
1141 "elevation_2_se, elevation_1_sw, " +
1142 "elevation_2_sw, water_height, " +
1143 "terrain_raise_limit, terrain_lower_limit, " +
1144 "use_estate_sun, fixed_sun, sun_position, " +
1145 "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
1146 "sunvectorz, loaded_creation_datetime, " +
1147 "loaded_creation_id, map_tile_ID, block_search, casino, " +
1148 "TelehubObject, parcel_tile_ID) " +
1149 "values (?RegionUUID, ?BlockTerraform, " +
1150 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
1151 "?AllowLandResell, ?AllowLandJoinDivide, " +
1152 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
1153 "?Maturity, ?DisableScripts, ?DisableCollisions, " +
1154 "?DisablePhysics, ?TerrainTexture1, " +
1155 "?TerrainTexture2, ?TerrainTexture3, " +
1156 "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " +
1157 "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " +
1158 "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
1159 "?WaterHeight, ?TerrainRaiseLimit, " +
1160 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
1161 "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
1162 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
1163 "?LoadedCreationDateTime, ?LoadedCreationID, " +
1164 "?TerrainImageID, ?block_search, ?casino, " +
1165 "?TelehubObject, ?ParcelImageID)";
1166
1167 ExecuteNonQuery(cmd); 1128 ExecuteNonQuery(cmd);
1168 } 1129 }
1169 }
1170 1130
1171 SaveSpawnPoints(rs); 1131 SaveSpawnPoints(rs);
1132 }
1172 } 1133 }
1173 1134
1174 public virtual List<LandData> LoadLandObjects(UUID regionUUID) 1135 public virtual List<LandData> LoadLandObjects(UUID regionUUID)
diff --git a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
index c213dd1..c241e90 100644
--- a/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserProfilesData.cs
@@ -896,16 +896,16 @@ namespace OpenSim.Data.MySQL
896 } 896 }
897 897
898 #region User Preferences 898 #region User Preferences
899 public OSDArray GetUserPreferences(UUID avatarId) 899 public bool GetUserPreferences(ref UserPreferences pref, ref string result)
900 { 900 {
901 string query = string.Empty; 901 string query = string.Empty;
902 902
903 query += "SELECT imviaemail,visible,email FROM "; 903 query += "SELECT imviaemail,visible,email FROM ";
904 query += "usersettings WHERE "; 904 query += "usersettings WHERE ";
905 query += "useruuid = ?Id"; 905 query += "useruuid = ?Id";
906 906
907 OSDArray data = new OSDArray(); 907 OSDArray data = new OSDArray();
908 908
909 try 909 try
910 { 910 {
911 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 911 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -913,33 +913,30 @@ namespace OpenSim.Data.MySQL
913 dbcon.Open(); 913 dbcon.Open();
914 using (MySqlCommand cmd = new MySqlCommand(query, dbcon)) 914 using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
915 { 915 {
916 cmd.Parameters.AddWithValue("?Id", avatarId.ToString()); 916 cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
917 917
918 using (MySqlDataReader reader = cmd.ExecuteReader()) 918 using (MySqlDataReader reader = cmd.ExecuteReader())
919 { 919 {
920 if(reader.HasRows) 920 if (reader.HasRows)
921 { 921 {
922 reader.Read(); 922 reader.Read();
923 OSDMap record = new OSDMap(); 923 bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
924 924 bool.TryParse((string)reader["visible"], out pref.Visible);
925 record.Add("imviaemail",OSD.FromString((string)reader["imviaemail"])); 925 pref.EMail = (string)reader["email"];
926 record.Add("visible",OSD.FromString((string)reader["visible"]));
927 record.Add("email",OSD.FromString((string)reader["email"]));
928 data.Add(record);
929 } 926 }
930 else 927 else
931 { 928 {
932 dbcon.Close(); 929 dbcon.Close();
933 dbcon.Open(); 930 dbcon.Open();
934 931
935 query = "INSERT INTO usersettings VALUES "; 932 query = "INSERT INTO usersettings VALUES ";
936 query += "(?uuid,'false','false', ?Email)"; 933 query += "(?uuid,'false','false', ?Email)";
937 934
938 using (MySqlCommand put = new MySqlCommand(query, dbcon)) 935 using (MySqlCommand put = new MySqlCommand(query, dbcon))
939 { 936 {
940 937
941// put.Parameters.AddWithValue("?Email", pref.EMail); 938 put.Parameters.AddWithValue("?Email", pref.EMail);
942// put.Parameters.AddWithValue("?uuid", pref.UserId.ToString()); 939 put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());
943 940
944 put.ExecuteNonQuery(); 941 put.ExecuteNonQuery();
945 } 942 }
@@ -952,20 +949,22 @@ namespace OpenSim.Data.MySQL
952 { 949 {
953 m_log.ErrorFormat("[PROFILES_DATA]" + 950 m_log.ErrorFormat("[PROFILES_DATA]" +
954 ": Get preferences exception {0}", e.Message); 951 ": Get preferences exception {0}", e.Message);
952 result = e.Message;
953 return false;
955 } 954 }
956 return data; 955 return true;
957 } 956 }
958 957
959 public bool UpdateUserPreferences(bool emailIm, bool visible, UUID avatarId ) 958 public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
960 { 959 {
961 string query = string.Empty; 960 string query = string.Empty;
962 961
963 query += "UPDATE userpsettings SET "; 962 query += "UPDATE usersettings SET ";
964 query += "imviaemail=?ImViaEmail, "; 963 query += "imviaemail=?ImViaEmail, ";
965 query += "visible=?Visible, "; 964 query += "visible=?Visible, ";
966 query += "email=?EMail "; 965 query += "email=?EMail ";
967 query += "WHERE useruuid=?uuid"; 966 query += "WHERE useruuid=?uuid";
968 967
969 try 968 try
970 { 969 {
971 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString)) 970 using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
@@ -986,6 +985,7 @@ namespace OpenSim.Data.MySQL
986 { 985 {
987 m_log.ErrorFormat("[PROFILES_DATA]" + 986 m_log.ErrorFormat("[PROFILES_DATA]" +
988 ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException); 987 ": UserPreferencesUpdate exception {0} {1}", e.Message, e.InnerException);
988 result = e.Message;
989 return false; 989 return false;
990 } 990 }
991 return true; 991 return true;