we are now past change 6000, so getting rid of pre-Migration cruft

0.6.0-stable
Sean Dague 2008-08-27 19:24:45 +00:00
parent b625a36ae5
commit c75f1fcde8
1 changed files with 0 additions and 222 deletions

View File

@ -118,11 +118,6 @@ namespace OpenSim.Data.SQLite
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration(m_conn, assem, "RegionStore"); Migration m = new Migration(m_conn, assem, "RegionStore");
// TODO: After rev 6000, remove this. People should have
// been rolled onto the new migration code by then.
TestTables(m_conn, m);
m.Update(); m.Update();
lock (ds) lock (ds)
@ -1723,191 +1718,6 @@ namespace OpenSim.Data.SQLite
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
/// <summary>
/// Create the necessary database tables.
/// </summary>
/// <param name="conn"></param>
// private void InitDB(SqliteConnection conn)
// {
// string createPrims = defineTable(createPrimTable());
// string createShapes = defineTable(createShapeTable());
// string createItems = defineTable(createItemsTable());
// string createTerrain = defineTable(createTerrainTable());
// string createLand = defineTable(createLandTable());
// string createLandAccessList = defineTable(createLandAccessListTable());
// SqliteCommand pcmd = new SqliteCommand(createPrims, conn);
// SqliteCommand scmd = new SqliteCommand(createShapes, conn);
// SqliteCommand icmd = new SqliteCommand(createItems, conn);
// SqliteCommand tcmd = new SqliteCommand(createTerrain, conn);
// SqliteCommand lcmd = new SqliteCommand(createLand, conn);
// SqliteCommand lalcmd = new SqliteCommand(createLandAccessList, conn);
// try
// {
// pcmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[REGION DB]: Primitives Table Already Exists");
// }
// try
// {
// scmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[REGION DB]: Shapes Table Already Exists");
// }
// try
// {
// icmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[REGION DB]: Primitives Inventory Table Already Exists");
// }
// try
// {
// tcmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[REGION DB]: Terrain Table Already Exists");
// }
// try
// {
// lcmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[REGION DB]: Land Table Already Exists");
// }
// try
// {
// lalcmd.ExecuteNonQuery();
// }
// catch (SqliteSyntaxException)
// {
// m_log.Warn("[SQLITE]: LandAccessList Table Already Exists");
// }
// }
/// <summary>
///
/// </summary>
/// <param name="conn"></param>
/// <param name="m"></param>
/// <returns></returns>
private bool TestTables(SqliteConnection conn, Migration m)
{
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd);
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn);
SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd);
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd);
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn);
SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd);
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn);
SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd);
DataSet tmpDS = new DataSet();
try
{
pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes");
iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain");
lDa.Fill(tmpDS, "land");
lalDa.Fill(tmpDS, "landaccesslist");
}
catch (SqliteSyntaxException)
{
m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating");
return false;
}
// if we've gotten this far, and our version is still 0,
// it's because the migration was never done, so
// initialize to 1 just to sync up to where we should be.
if (m.Version == 0)
m.Version = 1;
// pDa.Fill(tmpDS, "prims");
// sDa.Fill(tmpDS, "primshapes");
// iDa.Fill(tmpDS, "primitems");
// tDa.Fill(tmpDS, "terrain");
// lDa.Fill(tmpDS, "land");
// lalDa.Fill(tmpDS, "landaccesslist");
// foreach (DataColumn col in createPrimTable().Columns)
// {
// if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName))
// {
// m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName);
// return false;
// }
// }
// foreach (DataColumn col in createShapeTable().Columns)
// {
// if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
// {
// m_log.Info("[REGION DB]: Missing required column:" + col.ColumnName);
// return false;
// }
// }
// // XXX primitems should probably go here eventually
// foreach (DataColumn col in createTerrainTable().Columns)
// {
// if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
// {
// m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName);
// return false;
// }
// }
// foreach (DataColumn col in createLandTable().Columns)
// {
// if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
// {
// m_log.Info("[REGION DB]: Missing require column:" + col.ColumnName);
// return false;
// }
// }
// foreach (DataColumn col in createLandAccessListTable().Columns)
// {
// if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
// {
// m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName);
// return false;
// }
// }
return true;
}
/*********************************************************************** /***********************************************************************
* *
* Type conversion functions * Type conversion functions
@ -1951,37 +1761,5 @@ namespace OpenSim.Data.SQLite
} }
} }
/// <summary>
/// </summary>
/// <param name="type">a Type</param>
/// <returns>an sqliteType</returns>
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
// private static string sqliteType(Type type)
// {
// if (type == typeof (String))
// {
// return "varchar(255)";
// }
// else if (type == typeof (Int32))
// {
// return "integer";
// }
// else if (type == typeof (Int64))
// {
// return "integer";
// }
// else if (type == typeof (Double))
// {
// return "float";
// }
// else if (type == typeof (Byte[]))
// {
// return "blob";
// }
// else
// {
// return "string";
// }
// }
} }
} }