diff options
Diffstat (limited to 'OpenSim/Framework/Data.DB4o/DB4oManager.cs')
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oManager.cs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 43f9095..0e32938 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs | |||
@@ -129,26 +129,31 @@ namespace OpenSim.Framework.Data.DB4o | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /// <summary> | 131 | /// <summary> |
132 | /// Adds a new profile to the database (Warning: Probably slow.) | 132 | /// Adds or updates a record to the user database. Do this when changes are needed |
133 | /// in the user profile that need to be persistant. | ||
134 | /// | ||
135 | /// TODO: the logic here is not ACID, the local cache will be | ||
136 | /// updated even if the persistant data is not. This may lead | ||
137 | /// to unexpected results. | ||
133 | /// </summary> | 138 | /// </summary> |
134 | /// <param name="row">The profile to add</param> | 139 | /// <param name="record">The profile to update</param> |
135 | /// <returns>Successful?</returns> | 140 | /// <returns>true on success, false on fail to persist to db</returns> |
136 | public bool AddRow(UserProfileData row) | 141 | public bool UpdateRecord(UserProfileData record) |
137 | { | 142 | { |
138 | if (userProfiles.ContainsKey(row.UUID)) | 143 | if (userProfiles.ContainsKey(record.UUID)) |
139 | { | 144 | { |
140 | userProfiles[row.UUID] = row; | 145 | userProfiles[record.UUID] = record; |
141 | } | 146 | } |
142 | else | 147 | else |
143 | { | 148 | { |
144 | userProfiles.Add(row.UUID, row); | 149 | userProfiles.Add(record.UUID, record); |
145 | } | 150 | } |
146 | 151 | ||
147 | try | 152 | try |
148 | { | 153 | { |
149 | IObjectContainer database; | 154 | IObjectContainer database; |
150 | database = Db4oFactory.OpenFile(dbfl); | 155 | database = Db4oFactory.OpenFile(dbfl); |
151 | database.Set(row); | 156 | database.Set(record); |
152 | database.Close(); | 157 | database.Close(); |
153 | return true; | 158 | return true; |
154 | } | 159 | } |
@@ -157,7 +162,5 @@ namespace OpenSim.Framework.Data.DB4o | |||
157 | return false; | 162 | return false; |
158 | } | 163 | } |
159 | } | 164 | } |
160 | |||
161 | |||
162 | } | 165 | } |
163 | } | 166 | } |