* Change SQLite asset UUID to dashed format to be consistent

* Remaining inconsistent uuids (non dashed) are in region store for sqlite and mysql
* Migration of these will happen at a later date, unless someone else wants to do it
0.6.5-rc1
Justin Clarke Casey 2009-04-09 19:23:19 +00:00
parent 67333d48fc
commit 7f8552fe63
2 changed files with 13 additions and 6 deletions

View File

@ -0,0 +1,7 @@
BEGIN;
update assets
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21)
where UUID not like '%-%';
COMMIT;

View File

@ -102,7 +102,7 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
using (IDataReader reader = cmd.ExecuteReader()) using (IDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
@ -127,7 +127,7 @@ namespace OpenSim.Data.SQLite
/// <param name="asset">Asset Base</param> /// <param name="asset">Asset Base</param>
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.FullID))
{ {
//m_log.Info("[ASSET DB]: Asset exists already, ignoring."); //m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
@ -138,7 +138,7 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
@ -164,7 +164,7 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
@ -204,7 +204,7 @@ namespace OpenSim.Data.SQLite
lock (this) { lock (this) {
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
using (IDataReader reader = cmd.ExecuteReader()) using (IDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
@ -230,7 +230,7 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }