Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Also move the static SQLiteIndex marshalling methods into the SQLiteIndex class itself. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
82d24cdca30b6d936b31e17ce7ecab34 |
User & Date: | mistachkin 2013-07-05 22:44:40.130 |
Context
2013-07-06
| ||
00:16 | Enhance the comments for the SQLiteModuleNoop class. check-in: bf02fc9d80 user: mistachkin tags: trunk | |
2013-07-05
| ||
22:44 | Also move the static SQLiteIndex marshalling methods into the SQLiteIndex class itself. check-in: 82d24cdca3 user: mistachkin tags: trunk | |
22:36 | Move the static SQLiteValue marshalling method into the SQLiteValue class itself. check-in: bd1c5de6ec user: mistachkin tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLiteModule.cs.
︙ | |||
327 328 329 330 331 332 333 | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | - + | { pValue = IntPtr.Zero; } #endregion /////////////////////////////////////////////////////////////////////// |
︙ | |||
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | int nOrderBy ) { inputs = new SQLiteIndexInputs(nConstraint, nOrderBy); outputs = new SQLiteIndexOutputs(nConstraint); } #endregion /////////////////////////////////////////////////////////////////////// #region Internal Marshal Helper Methods /// <summary> /// Converts a native pointer to a native sqlite3_index_info structure /// into a new <see cref="SQLiteIndex" /> object instance. /// </summary> /// <param name="pIndex"> /// The native pointer to the native sqlite3_index_info structure to /// convert. /// </param> /// <param name="index"> /// Upon success, this parameter will be modified to contain the newly /// created <see cref="SQLiteIndex" /> object instance. /// </param> internal static void FromIntPtr( IntPtr pIndex, ref SQLiteIndex index ) { if (pIndex == IntPtr.Zero) return; int offset = 0; int nConstraint = SQLiteMarshal.ReadInt32(pIndex, offset); offset += sizeof(int); IntPtr pConstraint = SQLiteMarshal.ReadIntPtr(pIndex, offset); offset += IntPtr.Size; int nOrderBy = SQLiteMarshal.ReadInt32(pIndex, offset); offset += sizeof(int); IntPtr pOrderBy = SQLiteMarshal.ReadIntPtr(pIndex, offset); index = new SQLiteIndex(nConstraint, nOrderBy); int sizeOfConstraintType = Marshal.SizeOf(typeof( UnsafeNativeMethods.sqlite3_index_constraint)); for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++) { UnsafeNativeMethods.sqlite3_index_constraint constraint = new UnsafeNativeMethods.sqlite3_index_constraint(); Marshal.PtrToStructure(SQLiteMarshal.IntPtrForOffset( pConstraint, iConstraint * sizeOfConstraintType), constraint); index.Inputs.Constraints[iConstraint] = new SQLiteIndexConstraint(constraint); } int sizeOfOrderByType = Marshal.SizeOf(typeof( UnsafeNativeMethods.sqlite3_index_orderby)); for (int iOrderBy = 0; iOrderBy < nOrderBy; iOrderBy++) { UnsafeNativeMethods.sqlite3_index_orderby orderBy = new UnsafeNativeMethods.sqlite3_index_orderby(); Marshal.PtrToStructure(SQLiteMarshal.IntPtrForOffset( pOrderBy, iOrderBy * sizeOfOrderByType), orderBy); index.Inputs.OrderBys[iOrderBy] = new SQLiteIndexOrderBy(orderBy); } } /////////////////////////////////////////////////////////////////////// /// <summary> /// Populates the outputs of a pre-allocated native sqlite3_index_info /// structure using an existing <see cref="SQLiteIndex" /> object /// instance. /// </summary> /// <param name="index"> /// The existing <see cref="SQLiteIndex" /> object instance containing /// the output data to use. /// </param> /// <param name="pIndex"> /// The native pointer to the pre-allocated native sqlite3_index_info /// structure. /// </param> internal static void ToIntPtr( SQLiteIndex index, IntPtr pIndex ) { if ((index == null) || (index.Inputs == null) || (index.Inputs.Constraints == null) || (index.Outputs == null) || (index.Outputs.ConstraintUsages == null)) { return; } if (pIndex == IntPtr.Zero) return; int offset = 0; int nConstraint = SQLiteMarshal.ReadInt32(pIndex, offset); if (nConstraint != index.Inputs.Constraints.Length) return; if (nConstraint != index.Outputs.ConstraintUsages.Length) return; offset += sizeof(int) + IntPtr.Size + sizeof(int) + IntPtr.Size; IntPtr pConstraintUsage = SQLiteMarshal.ReadIntPtr(pIndex, offset); int sizeOfConstraintUsageType = Marshal.SizeOf(typeof( UnsafeNativeMethods.sqlite3_index_constraint_usage)); for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++) { UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage = new UnsafeNativeMethods.sqlite3_index_constraint_usage( index.Outputs.ConstraintUsages[iConstraint]); Marshal.StructureToPtr( constraintUsage, SQLiteMarshal.IntPtrForOffset( pConstraintUsage, iConstraint * sizeOfConstraintUsageType), false); index.Outputs.ConstraintUsages[iConstraint] = new SQLiteIndexConstraintUsage(constraintUsage); } offset += IntPtr.Size; SQLiteMarshal.WriteInt32(pIndex, offset, index.Outputs.IndexNumber); offset += sizeof(int); SQLiteMarshal.WriteIntPtr(pIndex, offset, SQLiteString.Utf8IntPtrFromString(index.Outputs.IndexString)); offset += IntPtr.Size; // // NOTE: We just allocated the IndexString field; therefore, we // need to set the NeedToFreeIndexString field to non-zero. // SQLiteMarshal.WriteInt32(pIndex, offset, 1); offset += sizeof(int); SQLiteMarshal.WriteInt32(pIndex, offset, index.Outputs.OrderByConsumed); offset += sizeof(int); SQLiteMarshal.WriteDouble(pIndex, offset, index.Outputs.EstimatedCost); } #endregion /////////////////////////////////////////////////////////////////////// #region Public Properties private SQLiteIndexInputs inputs; /// <summary> /// The <see cref="SQLiteIndexInputs" /> object instance containing |
︙ | |||
4123 4124 4125 4126 4127 4128 4129 | 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | #if !PLATFORM_COMPACTFRAMEWORK Marshal.WriteIntPtr(pointer, offset, value); #else Marshal.WriteIntPtr(IntPtrForOffset(pointer, offset), value); #endif } #endregion |
︙ | |||
6660 6661 6662 6663 6664 6665 6666 | 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 | - + - + | { SQLiteVirtualTable table = TableFromIntPtr(pVtab); if (table != null) { SQLiteIndex index = null; |
︙ |