29 using System.Collections.Generic;
31 using System.Reflection;
34 using Community.CsharpSqlite.Sqlite;
36 using Mono.Data.Sqlite;
39 using OpenMetaverse.StructuredData;
40 using OpenSim.Framework;
41 using OpenSim.Region.Framework.Interfaces;
43 namespace OpenSim.Data.SQLite
47 private static readonly ILog m_log =
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private SqliteConnection m_connection;
51 private string m_connectionString;
53 private Dictionary<string, FieldInfo> m_FieldMap =
54 new Dictionary<string, FieldInfo>();
56 protected virtual Assembly Assembly
58 get {
return GetType().Assembly; }
67 Initialise(connectionString);
73 Util.LoadArchSpecificWindowsDll(
"sqlite3.dll");
75 m_connectionString = connectionString;
77 m_log.Info(
"[PROFILES_DATA]: Sqlite - connecting: "+m_connectionString);
79 m_connection =
new SqliteConnection(m_connectionString);
86 private string[] FieldList
88 get {
return new List<string>(m_FieldMap.Keys).ToArray(); }
91 #region IProfilesData implementation
95 string query =
"SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = :Id";
96 IDataReader reader = null;
98 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
100 cmd.CommandText = query;
101 cmd.Parameters.AddWithValue(
":Id", creatorId);
102 reader = cmd.ExecuteReader();
105 while (reader.Read())
112 UUID.TryParse(Convert.ToString( reader[
"classifieduuid"]), out Id);
113 Name = Convert.ToString(reader[
"name"]);
117 m_log.ErrorFormat(
"[PROFILES_DATA]" +
118 ": UserAccount exception {0}", e.Message);
120 n.Add(
"classifieduuid", OSD.FromUUID(Id));
121 n.Add(
"name", OSD.FromString(Name));
131 string query = string.Empty;
133 query +=
"INSERT OR REPLACE INTO classifieds (";
134 query +=
"`classifieduuid`,";
135 query +=
"`creatoruuid`,";
136 query +=
"`creationdate`,";
137 query +=
"`expirationdate`,";
138 query +=
"`category`,";
140 query +=
"`description`,";
141 query +=
"`parceluuid`,";
142 query +=
"`parentestate`,";
143 query +=
"`snapshotuuid`,";
144 query +=
"`simname`,";
145 query +=
"`posglobal`,";
146 query +=
"`parcelname`,";
147 query +=
"`classifiedflags`,";
148 query +=
"`priceforlisting`) ";
150 query +=
":ClassifiedId,";
151 query +=
":CreatorId,";
152 query +=
":CreatedDate,";
153 query +=
":ExpirationDate,";
154 query +=
":Category,";
156 query +=
":Description,";
157 query +=
":ParcelId,";
158 query +=
":ParentEstate,";
159 query +=
":SnapshotId,";
160 query +=
":SimName,";
161 query +=
":GlobalPos,";
162 query +=
":ParcelName,";
164 query +=
":ListingPrice ) ";
167 ad.ParcelName =
"Unknown";
169 ad.ParcelId = UUID.Zero;
171 ad.Description =
"No Description";
173 DateTime epoch =
new DateTime(1970, 1, 1);
174 DateTime now = DateTime.Now;
175 TimeSpan epochnow = now - epoch;
182 duration =
new TimeSpan(7,0,0,0);
183 expiration = now.Add(duration);
184 epochexp = expiration - epoch;
188 duration =
new TimeSpan(365,0,0,0);
189 expiration = now.Add(duration);
190 epochexp = expiration - epoch;
192 ad.CreationDate = (int)epochnow.TotalSeconds;
196 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
198 cmd.CommandText = query;
199 cmd.Parameters.AddWithValue(
":ClassifiedId", ad.ClassifiedId.ToString());
200 cmd.Parameters.AddWithValue(
":CreatorId", ad.CreatorId.ToString());
201 cmd.Parameters.AddWithValue(
":CreatedDate", ad.CreationDate.ToString());
202 cmd.Parameters.AddWithValue(
":ExpirationDate", ad.ExpirationDate.ToString());
203 cmd.Parameters.AddWithValue(
":Category", ad.Category.ToString());
204 cmd.Parameters.AddWithValue(
":Name", ad.Name.ToString());
205 cmd.Parameters.AddWithValue(
":Description", ad.Description.ToString());
206 cmd.Parameters.AddWithValue(
":ParcelId", ad.ParcelId.ToString());
207 cmd.Parameters.AddWithValue(
":ParentEstate", ad.ParentEstate.ToString());
208 cmd.Parameters.AddWithValue(
":SnapshotId", ad.SnapshotId.ToString ());
209 cmd.Parameters.AddWithValue(
":SimName", ad.SimName.ToString());
210 cmd.Parameters.AddWithValue(
":GlobalPos", ad.GlobalPos.ToString());
211 cmd.Parameters.AddWithValue(
":ParcelName", ad.ParcelName.ToString());
212 cmd.Parameters.AddWithValue(
":Flags", ad.Flags.ToString());
213 cmd.Parameters.AddWithValue(
":ListingPrice", ad.Price.ToString ());
215 cmd.ExecuteNonQuery();
220 m_log.ErrorFormat(
"[PROFILES_DATA]" +
221 ": ClassifiedesUpdate exception {0}", e.Message);
229 string query = string.Empty;
231 query +=
"DELETE FROM classifieds WHERE ";
232 query +=
"classifieduuid = :ClasifiedId";
236 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
238 cmd.CommandText = query;
239 cmd.Parameters.AddWithValue(
":ClassifiedId", recordId.ToString());
241 cmd.ExecuteNonQuery();
246 m_log.ErrorFormat(
"[PROFILES_DATA]" +
247 ": DeleteClassifiedRecord exception {0}", e.Message);
255 IDataReader reader = null;
256 string query = string.Empty;
258 query +=
"SELECT * FROM classifieds WHERE ";
259 query +=
"classifieduuid = :AdId";
263 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
265 cmd.CommandText = query;
266 cmd.Parameters.AddWithValue(
":AdId", ad.ClassifiedId.ToString());
268 using (reader = cmd.ExecuteReader())
272 ad.CreatorId =
new UUID(reader[
"creatoruuid"].ToString());
273 ad.ParcelId =
new UUID(reader[
"parceluuid"].ToString ());
274 ad.SnapshotId =
new UUID(reader[
"snapshotuuid"].ToString ());
275 ad.CreationDate = Convert.ToInt32(reader[
"creationdate"]);
276 ad.ExpirationDate = Convert.ToInt32(reader[
"expirationdate"]);
277 ad.ParentEstate = Convert.ToInt32(reader[
"parentestate"]);
278 ad.Flags = (byte) Convert.ToUInt32(reader[
"classifiedflags"]);
279 ad.Category = Convert.ToInt32(reader[
"category"]);
280 ad.Price = Convert.ToInt16(reader[
"priceforlisting"]);
281 ad.Name = reader[
"name"].ToString();
282 ad.Description = reader[
"description"].ToString();
283 ad.SimName = reader[
"simname"].ToString();
284 ad.GlobalPos = reader[
"posglobal"].ToString();
285 ad.ParcelName = reader[
"parcelname"].ToString();
292 m_log.ErrorFormat(
"[PROFILES_DATA]" +
293 ": GetPickInfo exception {0}", e.Message);
300 IDataReader reader = null;
301 string query = string.Empty;
303 query +=
"SELECT `pickuuid`,`name` FROM userpicks WHERE ";
304 query +=
"creatoruuid = :Id";
309 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
311 cmd.CommandText = query;
312 cmd.Parameters.AddWithValue(
":Id", avatarId.ToString());
314 using (reader = cmd.ExecuteReader())
316 while (reader.Read())
320 record.Add(
"pickuuid",OSD.FromString((string)reader[
"pickuuid"]));
321 record.Add(
"name",OSD.FromString((string)reader[
"name"]));
329 m_log.ErrorFormat(
"[PROFILES_DATA]" +
330 ": GetAvatarPicks exception {0}", e.Message);
336 IDataReader reader = null;
337 string query = string.Empty;
340 query +=
"SELECT * FROM userpicks WHERE ";
341 query +=
"creatoruuid = :CreatorId AND ";
342 query +=
"pickuuid = :PickId";
346 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
348 cmd.CommandText = query;
349 cmd.Parameters.AddWithValue(
":CreatorId", avatarId.ToString());
350 cmd.Parameters.AddWithValue(
":PickId", pickId.ToString());
352 using (reader = cmd.ExecuteReader())
355 while (reader.Read())
357 string description = (string)reader[
"description"];
359 if (
string.IsNullOrEmpty(description))
360 description =
"No description given.";
362 UUID.TryParse((string)reader[
"pickuuid"], out pick.
PickId);
363 UUID.TryParse((string)reader[
"creatoruuid"], out pick.
CreatorId);
364 UUID.TryParse((string)reader[
"parceluuid"], out pick.
ParcelId);
365 UUID.TryParse((string)reader[
"snapshotuuid"], out pick.
SnapshotId);
366 pick.GlobalPos = (string)reader[
"posglobal"];
367 bool.TryParse((string)reader[
"toppick"].ToString(), out pick.TopPick);
368 bool.TryParse((string)reader[
"enabled"].ToString(), out pick.Enabled);
369 pick.Name = (string)reader[
"name"];
370 pick.Desc = description;
371 pick.ParcelName = (string)reader[
"user"];
372 pick.OriginalName = (string)reader[
"originalname"];
373 pick.SimName = (string)reader[
"simname"];
374 pick.SortOrder = (int)reader[
"sortorder"];
381 m_log.ErrorFormat(
"[PROFILES_DATA]" +
382 ": GetPickInfo exception {0}", e.Message);
389 string query = string.Empty;
391 query +=
"INSERT OR REPLACE INTO userpicks (";
392 query +=
"pickuuid, ";
393 query +=
"creatoruuid, ";
394 query +=
"toppick, ";
395 query +=
"parceluuid, ";
397 query +=
"description, ";
398 query +=
"snapshotuuid, ";
400 query +=
"originalname, ";
401 query +=
"simname, ";
402 query +=
"posglobal, ";
403 query +=
"sortorder, ";
404 query +=
"enabled ) ";
407 query +=
":CreatorId,";
408 query +=
":TopPick,";
409 query +=
":ParcelId,";
412 query +=
":SnapshotId,";
414 query +=
":Original,";
415 query +=
":SimName,";
416 query +=
":GlobalPos,";
417 query +=
":SortOrder,";
418 query +=
":Enabled) ";
422 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
425 int.TryParse(pick.TopPick.ToString(), out top_pick);
427 int.TryParse(pick.Enabled.ToString(), out enabled);
429 cmd.CommandText = query;
430 cmd.Parameters.AddWithValue(
":PickId", pick.PickId.ToString());
431 cmd.Parameters.AddWithValue(
":CreatorId", pick.CreatorId.ToString());
432 cmd.Parameters.AddWithValue(
":TopPick", top_pick);
433 cmd.Parameters.AddWithValue(
":ParcelId", pick.ParcelId.ToString());
434 cmd.Parameters.AddWithValue(
":Name", pick.Name.ToString());
435 cmd.Parameters.AddWithValue(
":Desc", pick.Desc.ToString());
436 cmd.Parameters.AddWithValue(
":SnapshotId", pick.SnapshotId.ToString());
437 cmd.Parameters.AddWithValue(
":User", pick.ParcelName.ToString());
438 cmd.Parameters.AddWithValue(
":Original", pick.OriginalName.ToString());
439 cmd.Parameters.AddWithValue(
":SimName",pick.SimName.ToString());
440 cmd.Parameters.AddWithValue(
":GlobalPos", pick.GlobalPos);
441 cmd.Parameters.AddWithValue(
":SortOrder", pick.SortOrder.ToString ());
442 cmd.Parameters.AddWithValue(
":Enabled", enabled);
444 cmd.ExecuteNonQuery();
449 m_log.ErrorFormat(
"[PROFILES_DATA]" +
450 ": UpdateAvatarNotes exception {0}", e.Message);
458 string query = string.Empty;
460 query +=
"DELETE FROM userpicks WHERE ";
461 query +=
"pickuuid = :PickId";
465 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
467 cmd.CommandText = query;
468 cmd.Parameters.AddWithValue(
":PickId", pickId.ToString());
469 cmd.ExecuteNonQuery();
474 m_log.ErrorFormat(
"[PROFILES_DATA]" +
475 ": DeleteUserPickRecord exception {0}", e.Message);
483 IDataReader reader = null;
484 string query = string.Empty;
486 query +=
"SELECT `notes` FROM usernotes WHERE ";
487 query +=
"useruuid = :Id AND ";
488 query +=
"targetuuid = :TargetId";
493 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
495 cmd.CommandText = query;
496 cmd.Parameters.AddWithValue(
":Id", notes.UserId.ToString());
497 cmd.Parameters.AddWithValue(
":TargetId", notes.TargetId.ToString());
499 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
501 while (reader.Read())
503 notes.Notes = OSD.FromString((string)reader[
"notes"]);
510 m_log.ErrorFormat(
"[PROFILES_DATA]" +
511 ": GetAvatarNotes exception {0}", e.Message);
518 string query = string.Empty;
521 if(
string.IsNullOrEmpty(note.Notes))
524 query +=
"DELETE FROM usernotes WHERE ";
525 query +=
"useruuid=:UserId AND ";
526 query +=
"targetuuid=:TargetId";
531 query +=
"INSERT OR REPLACE INTO usernotes VALUES ( ";
533 query +=
":TargetId,";
539 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
541 cmd.CommandText = query;
544 cmd.Parameters.AddWithValue(
":Notes", note.Notes);
545 cmd.Parameters.AddWithValue(
":TargetId", note.TargetId.ToString ());
546 cmd.Parameters.AddWithValue(
":UserId", note.UserId.ToString());
548 cmd.ExecuteNonQuery();
553 m_log.ErrorFormat(
"[PROFILES_DATA]" +
554 ": UpdateAvatarNotes exception {0}", e.Message);
562 IDataReader reader = null;
563 string query = string.Empty;
565 query +=
"SELECT * FROM userprofile WHERE ";
566 query +=
"useruuid = :Id";
568 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
570 cmd.CommandText = query;
571 cmd.Parameters.AddWithValue(
":Id", props.UserId.ToString());
576 reader = cmd.ExecuteReader();
580 m_log.ErrorFormat(
"[PROFILES_DATA]" +
581 ": GetAvatarProperties exception {0}", e.Message);
585 if(reader != null && reader.Read())
587 props.WebUrl = (string)reader[
"profileURL"];
588 UUID.TryParse((string)reader[
"profileImage"], out props.ImageId);
589 props.AboutText = (string)reader[
"profileAboutText"];
590 UUID.TryParse((string)reader[
"profileFirstImage"], out props.FirstLifeImageId);
591 props.FirstLifeText = (string)reader[
"profileFirstText"];
592 UUID.TryParse((string)reader[
"profilePartner"], out props.PartnerId);
593 props.WantToMask = (int)reader[
"profileWantToMask"];
594 props.WantToText = (string)reader[
"profileWantToText"];
595 props.SkillsMask = (int)reader[
"profileSkillsMask"];
596 props.SkillsText = (string)reader[
"profileSkillsText"];
597 props.Language = (string)reader[
"profileLanguages"];
601 props.WebUrl = string.Empty;
602 props.ImageId = UUID.Zero;
603 props.AboutText = string.Empty;
604 props.FirstLifeImageId = UUID.Zero;
605 props.FirstLifeText = string.Empty;
606 props.PartnerId = UUID.Zero;
607 props.WantToMask = 0;
608 props.WantToText = string.Empty;
609 props.SkillsMask = 0;
610 props.SkillsText = string.Empty;
611 props.Language = string.Empty;
612 props.PublishProfile =
false;
613 props.PublishMature =
false;
615 query =
"INSERT INTO userprofile (";
616 query +=
"useruuid, ";
617 query +=
"profilePartner, ";
618 query +=
"profileAllowPublish, ";
619 query +=
"profileMaturePublish, ";
620 query +=
"profileURL, ";
621 query +=
"profileWantToMask, ";
622 query +=
"profileWantToText, ";
623 query +=
"profileSkillsMask, ";
624 query +=
"profileSkillsText, ";
625 query +=
"profileLanguages, ";
626 query +=
"profileImage, ";
627 query +=
"profileAboutText, ";
628 query +=
"profileFirstImage, ";
629 query +=
"profileFirstText) VALUES (";
630 query +=
":userId, ";
631 query +=
":profilePartner, ";
632 query +=
":profileAllowPublish, ";
633 query +=
":profileMaturePublish, ";
634 query +=
":profileURL, ";
635 query +=
":profileWantToMask, ";
636 query +=
":profileWantToText, ";
637 query +=
":profileSkillsMask, ";
638 query +=
":profileSkillsText, ";
639 query +=
":profileLanguages, ";
640 query +=
":profileImage, ";
641 query +=
":profileAboutText, ";
642 query +=
":profileFirstImage, ";
643 query +=
":profileFirstText)";
645 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
647 put.CommandText = query;
648 put.Parameters.AddWithValue(
":userId", props.UserId.ToString());
649 put.Parameters.AddWithValue(
":profilePartner", props.PartnerId.ToString());
650 put.Parameters.AddWithValue(
":profileAllowPublish", props.PublishProfile);
651 put.Parameters.AddWithValue(
":profileMaturePublish", props.PublishMature);
652 put.Parameters.AddWithValue(
":profileURL", props.WebUrl);
653 put.Parameters.AddWithValue(
":profileWantToMask", props.WantToMask);
654 put.Parameters.AddWithValue(
":profileWantToText", props.WantToText);
655 put.Parameters.AddWithValue(
":profileSkillsMask", props.SkillsMask);
656 put.Parameters.AddWithValue(
":profileSkillsText", props.SkillsText);
657 put.Parameters.AddWithValue(
":profileLanguages", props.Language);
658 put.Parameters.AddWithValue(
":profileImage", props.ImageId.ToString());
659 put.Parameters.AddWithValue(
":profileAboutText", props.AboutText);
660 put.Parameters.AddWithValue(
":profileFirstImage", props.FirstLifeImageId.ToString());
661 put.Parameters.AddWithValue(
":profileFirstText", props.FirstLifeText);
663 put.ExecuteNonQuery();
672 string query = string.Empty;
674 query +=
"UPDATE userprofile SET ";
675 query +=
"profileURL=:profileURL, ";
676 query +=
"profileImage=:image, ";
677 query +=
"profileAboutText=:abouttext,";
678 query +=
"profileFirstImage=:firstlifeimage,";
679 query +=
"profileFirstText=:firstlifetext ";
680 query +=
"WHERE useruuid=:uuid";
684 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
686 cmd.CommandText = query;
687 cmd.Parameters.AddWithValue(
":profileURL", props.WebUrl);
688 cmd.Parameters.AddWithValue(
":image", props.ImageId.ToString());
689 cmd.Parameters.AddWithValue(
":abouttext", props.AboutText);
690 cmd.Parameters.AddWithValue(
":firstlifeimage", props.FirstLifeImageId.ToString());
691 cmd.Parameters.AddWithValue(
":firstlifetext", props.FirstLifeText);
692 cmd.Parameters.AddWithValue(
":uuid", props.UserId.ToString());
694 cmd.ExecuteNonQuery();
699 m_log.ErrorFormat(
"[PROFILES_DATA]" +
700 ": AgentPropertiesUpdate exception {0}", e.Message);
709 string query = string.Empty;
711 query +=
"UPDATE userprofile SET ";
712 query +=
"profileWantToMask=:WantMask, ";
713 query +=
"profileWantToText=:WantText,";
714 query +=
"profileSkillsMask=:SkillsMask,";
715 query +=
"profileSkillsText=:SkillsText, ";
716 query +=
"profileLanguages=:Languages ";
717 query +=
"WHERE useruuid=:uuid";
721 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
723 cmd.CommandText = query;
724 cmd.Parameters.AddWithValue(
":WantMask", up.WantToMask);
725 cmd.Parameters.AddWithValue(
":WantText", up.WantToText);
726 cmd.Parameters.AddWithValue(
":SkillsMask", up.SkillsMask);
727 cmd.Parameters.AddWithValue(
":SkillsText", up.SkillsText);
728 cmd.Parameters.AddWithValue(
":Languages", up.Language);
729 cmd.Parameters.AddWithValue(
":uuid", up.UserId.ToString());
731 cmd.ExecuteNonQuery();
736 m_log.ErrorFormat(
"[PROFILES_DATA]" +
737 ": AgentInterestsUpdate exception {0}", e.Message);
747 string query = string.Empty;
749 query +=
"UPDATE usersettings SET ";
750 query +=
"imviaemail=:ImViaEmail, ";
751 query +=
"visible=:Visible, ";
752 query +=
"email=:EMail ";
753 query +=
"WHERE useruuid=:uuid";
757 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
759 cmd.CommandText = query;
760 cmd.Parameters.AddWithValue(
":ImViaEmail", pref.IMViaEmail);
761 cmd.Parameters.AddWithValue(
":Visible", pref.Visible);
762 cmd.Parameters.AddWithValue(
":EMail", pref.EMail);
763 cmd.Parameters.AddWithValue(
":uuid", pref.UserId.ToString());
765 cmd.ExecuteNonQuery();
770 m_log.ErrorFormat(
"[PROFILES_DATA]" +
771 ": AgentInterestsUpdate exception {0}", e.Message);
780 IDataReader reader = null;
781 string query = string.Empty;
783 query +=
"SELECT imviaemail,visible,email FROM ";
784 query +=
"usersettings WHERE ";
785 query +=
"useruuid = :Id";
791 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
793 cmd.CommandText = query;
794 cmd.Parameters.AddWithValue(
"?Id", pref.UserId.ToString());
796 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
800 bool.TryParse((string)reader[
"imviaemail"], out pref.IMViaEmail);
801 bool.TryParse((string)reader[
"visible"], out pref.Visible);
802 pref.EMail = (string)reader[
"email"];
806 query =
"INSERT INTO usersettings VALUES ";
807 query +=
"(:Id,'false','false', :Email)";
809 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
811 put.Parameters.AddWithValue(
":Id", pref.UserId.ToString());
812 put.Parameters.AddWithValue(
":Email", pref.EMail);
813 put.ExecuteNonQuery();
822 m_log.ErrorFormat(
"[PROFILES_DATA]" +
823 ": Get preferences exception {0}", e.Message);
832 IDataReader reader = null;
833 string query = string.Empty;
835 query +=
"SELECT * FROM `userdata` WHERE ";
836 query +=
"UserId = :Id AND ";
837 query +=
"TagId = :TagId";
841 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
843 cmd.CommandText = query;
844 cmd.Parameters.AddWithValue(
":Id", props.UserId.ToString());
845 cmd.Parameters.AddWithValue (
":TagId", props.TagId.ToString());
847 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
851 props.DataKey = (string)reader[
"DataKey"];
852 props.DataVal = (string)reader[
"DataVal"];
856 query +=
"INSERT INTO userdata VALUES ( ";
859 query +=
":DataKey,";
860 query +=
":DataVal) ";
862 using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
864 put.Parameters.AddWithValue(
":Id", props.UserId.ToString());
865 put.Parameters.AddWithValue(
":TagId", props.TagId.ToString());
866 put.Parameters.AddWithValue(
":DataKey", props.DataKey.ToString());
867 put.Parameters.AddWithValue(
":DataVal", props.DataVal.ToString());
869 put.ExecuteNonQuery();
877 m_log.ErrorFormat(
"[PROFILES_DATA]" +
878 ": Requst application data exception {0}", e.Message);
886 string query = string.Empty;
888 query +=
"UPDATE userdata SET ";
889 query +=
"TagId = :TagId, ";
890 query +=
"DataKey = :DataKey, ";
891 query +=
"DataVal = :DataVal WHERE ";
892 query +=
"UserId = :UserId AND ";
893 query +=
"TagId = :TagId";
897 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
899 cmd.CommandText = query;
900 cmd.Parameters.AddWithValue(
":UserId", props.UserId.ToString());
901 cmd.Parameters.AddWithValue(
":TagId", props.TagId.ToString ());
902 cmd.Parameters.AddWithValue(
":DataKey", props.DataKey.ToString ());
903 cmd.Parameters.AddWithValue(
":DataVal", props.DataKey.ToString ());
905 cmd.ExecuteNonQuery();
910 m_log.ErrorFormat(
"[PROFILES_DATA]" +
911 ": SetUserData exception {0}", e.Message);
918 IDataReader reader = null;
920 string query =
"SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = :Id";
927 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
929 cmd.CommandText = query;
930 cmd.Parameters.AddWithValue(
":Id", avatarId.ToString());
932 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
936 data.Add(
new OSDString((
string)reader[
"snapshotuuid"].ToString()));
941 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
943 cmd.CommandText = query;
944 cmd.Parameters.AddWithValue(
":Id", avatarId.ToString());
946 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
950 data.Add(
new OSDString((
string)reader[
"snapshotuuid"].ToString ()));
955 query =
"SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = :Id";
957 using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
959 cmd.CommandText = query;
960 cmd.Parameters.AddWithValue(
":Id", avatarId.ToString());
962 using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
966 data.Add(
new OSDString((
string)reader[
"profileImage"].ToString ()));
967 data.Add(
new OSDString((
string)reader[
"profileFirstImage"].ToString ()));
974 m_log.ErrorFormat(
"[PROFILES_DATA]" +
975 ": GetAvatarNotes exception {0}", e.Message);
OSDArray GetUserImageAssets(UUID avatarId)
bool DeleteClassifiedRecord(UUID recordId)
bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
OpenMetaverse.StructuredData.OSDArray OSDArray
UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
OpenMetaverse.StructuredData.OSDMap OSDMap
bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
OSDArray GetClassifiedRecords(UUID creatorId)
bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
bool GetUserPreferences(ref UserPreferences pref, ref string result)
OSDArray GetAvatarPicks(UUID avatarId)
bool UpdatePicksRecord(UserProfilePick pick)
bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
bool SetUserAppData(UserAppData props, ref string result)
SQLiteUserProfilesData(string connectionString)
bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
bool GetAvatarNotes(ref UserProfileNotes notes)
bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
bool GetUserAppData(ref UserAppData props, ref string result)
void Initialise(string connectionString)
bool DeletePicksRecord(UUID pickId)