aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2007-08-09 03:56:11 +0000
committerSean Dague2007-08-09 03:56:11 +0000
commit35920434314d6197adadc80c3917da3a97c4d3fb (patch)
tree6a35adc02ed3081cfc038218957d27e07a4664dc /OpenSim
parentdecrease insanity level significantly by factoring all the columns into (diff)
downloadopensim-SC-35920434314d6197adadc80c3917da3a97c4d3fb.zip
opensim-SC-35920434314d6197adadc80c3917da3a97c4d3fb.tar.gz
opensim-SC-35920434314d6197adadc80c3917da3a97c4d3fb.tar.bz2
opensim-SC-35920434314d6197adadc80c3917da3a97c4d3fb.tar.xz
Start defining prim shape definition. Officially bed time now
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs52
1 files changed, 45 insertions, 7 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 60736aa..9d0a043 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -114,7 +114,45 @@ namespace OpenSim.DataStore.MonoSqliteStorage
114 return data; 114 return data;
115 } 115 }
116 116
117 private SqliteCommand createPrimInsertCommand(Dictionary<string, DbType> defs) 117 private Dictionary<string, DbType> createShapeDataDefs()
118 {
119 Dictionary<string, DbType> data = new Dictionary<string, DbType>();
120 data.Add("id", DbType.Int32);
121 data.Add("prim_id", DbType.Int32);
122 // shape is an enum
123 data.Add("Shape", DbType.Int32);
124 // vectors
125 data.Add("ScaleX", DbType.Double);
126 data.Add("ScaleY", DbType.Double);
127 data.Add("ScaleZ", DbType.Double);
128 // paths
129 data.Add("PCode", DbType.Int32);
130 data.Add("PathBegin", DbType.Int32);
131 data.Add("PathEnd", DbType.Int32);
132 data.Add("PathScaleX", DbType.Int32);
133 data.Add("PathScaleY", DbType.Int32);
134 data.Add("PathShearX", DbType.Int32);
135 data.Add("PathShearY", DbType.Int32);
136 data.Add("PathSkew", DbType.Int32);
137 data.Add("PathCurve", DbType.Int32);
138 data.Add("PathRadiusOffset", DbType.Int32);
139 data.Add("PathRevolutions", DbType.Int32);
140 data.Add("PathTaperX", DbType.Int32);
141 data.Add("PathTaperY", DbType.Int32);
142 data.Add("PathTwist", DbType.Int32);
143 data.Add("PathTwistBegin", DbType.Int32);
144 // profile
145 data.Add("ProfileBegin", DbType.Int32);
146 data.Add("ProfileEnd", DbType.Int32);
147 data.Add("ProfileCurve", DbType.Int32);
148 data.Add("ProfileHollow", DbType.Int32);
149 // text TODO: this isn't right, but I'm not sure the right
150 // way to specify this as a blob atm
151 data.Add("Texture", DbType.Binary);
152 return data;
153 }
154
155 private SqliteCommand createInsertCommand(string table, Dictionary<string, DbType> defs)
118 { 156 {
119 /** 157 /**
120 * This is subtle enough to deserve some commentary. 158 * This is subtle enough to deserve some commentary.
@@ -128,7 +166,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
128 string[] cols = new string[defs.Keys.Count]; 166 string[] cols = new string[defs.Keys.Count];
129 defs.Keys.CopyTo(cols, 0); 167 defs.Keys.CopyTo(cols, 0);
130 168
131 string sql = "insert into prims("; 169 string sql = "insert into " + table + "(";
132 sql += String.Join(", ", cols); 170 sql += String.Join(", ", cols);
133 // important, the first ':' needs to be here, the rest get added in the join 171 // important, the first ':' needs to be here, the rest get added in the join
134 sql += ") values (:"; 172 sql += ") values (:";
@@ -144,13 +182,13 @@ namespace OpenSim.DataStore.MonoSqliteStorage
144 return cmd; 182 return cmd;
145 } 183 }
146 184
147 private SqliteCommand createPrimUpdateCommand(Dictionary<string, DbType> defs) 185 private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs)
148 { 186 {
149 string sql = "update prims set "; 187 string sql = "update " + table + " set ";
150 foreach (string key in defs.Keys) { 188 foreach (string key in defs.Keys) {
151 sql += key + "= :" + key + ", "; 189 sql += key + "= :" + key + ", ";
152 } 190 }
153 sql += " where UUID=:UUID"; 191 sql += " where " + pk;
154 SqliteCommand cmd = new SqliteCommand(sql); 192 SqliteCommand cmd = new SqliteCommand(sql);
155 193
156 // this provides the binding for all our parameters, so 194 // this provides the binding for all our parameters, so
@@ -165,10 +203,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage
165 { 203 {
166 Dictionary<string, DbType> primDataDefs = createPrimDataDefs(); 204 Dictionary<string, DbType> primDataDefs = createPrimDataDefs();
167 205
168 da.InsertCommand = createPrimInsertCommand(primDataDefs); 206 da.InsertCommand = createInsertCommand("prims", primDataDefs);
169 da.InsertCommand.Connection = conn; 207 da.InsertCommand.Connection = conn;
170 208
171 da.UpdateCommand = createPrimUpdateCommand(primDataDefs); 209 da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", primDataDefs);
172 da.UpdateCommand.Connection = conn; 210 da.UpdateCommand.Connection = conn;
173 211
174 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); 212 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");