working now. Needs cleanup, but I'll have to do that after the next meeting

afrisby
Sean Dague 2007-11-13 15:50:56 +00:00
parent 7810b068f4
commit 4bc4844646
1 changed files with 16 additions and 7 deletions

View File

@ -252,12 +252,13 @@ namespace OpenSim.DataStore.MonoSqlite
lock (ds) lock (ds)
{ {
SqliteCommand cmd = new SqliteCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + SqliteCommand cmd = new SqliteCommand("insert into terrain(RegionUUID, Revision, Heightfield)" +
"values(:RegionUUID, :Revision, :Heightfield)", conn); " values(:RegionUUID, :Revision, :Heightfield)", conn);
using(cmd) using(cmd)
{ {
cmd.Parameters.Add(":RegionUUID", regionID);
cmd.Parameters.Add(":Revision", revision); cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
cmd.Parameters.Add(":Heightfield", serializeTerrain(ter)); cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter)));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -269,10 +270,11 @@ namespace OpenSim.DataStore.MonoSqlite
terret.Initialize(); terret.Initialize();
SqliteCommand cmd = new SqliteCommand("select RegionUUID, Revision, Heightfield from terrain" + SqliteCommand cmd = new SqliteCommand("select RegionUUID, Revision, Heightfield from terrain" +
"where RegionUUID=:RegionUUID order by Revision desc limit 1", conn); " where RegionUUID=:RegionUUID order by Revision desc limit 1", conn);
cmd.Parameters.Add(":RegionUUID", regionID); SqliteParameter param = new SqliteParameter();
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
using (SqliteDataReader row = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (SqliteDataReader row = cmd.ExecuteReader())
{ {
int rev = 0; int rev = 0;
if (row.Read()) if (row.Read())
@ -853,6 +855,13 @@ namespace OpenSim.DataStore.MonoSqlite
return param; return param;
} }
private SqliteParameter createParamWithValue(string name, Type type, Object o)
{
SqliteParameter param = createSqliteParameter(name, type);
param.Value = o;
return param;
}
private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
{ {
da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]);