Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch strictStatement Excluding Merge-Ins
This is equivalent to a diff from f680c43ce0 to 0ff60021ce
2013-07-05
| ||
22:36 | Move the static SQLiteValue marshalling method into the SQLiteValue class itself. check-in: bd1c5de6ec user: mistachkin tags: trunk | |
20:48 | Adjustments to ticket [5363fd4af6] test case. Closed-Leaf check-in: 0ff60021ce user: mistachkin tags: strictStatement | |
18:57 | Merge updates from trunk. check-in: adb53faf97 user: mistachkin tags: strictStatement | |
02:10 | Adjustments to the #if directives related to the vtshim extension module. check-in: f680c43ce0 user: mistachkin tags: trunk | |
01:31 | For the xCreate/xConnect/xDisconnect/xDestroy methods of the SQLiteModule class, refactor out the common code into private methods. Changes to comments. check-in: 9e6f8b4fca user: mistachkin tags: trunk | |
Changes to System.Data.SQLite/SQLite3.cs.
︙ | |||
554 555 556 557 558 559 560 561 562 563 564 565 566 567 | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | + | { SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override bool Step(SQLiteStatement stmt) { stmt.CheckDisposed(); SQLiteErrorCode n; Random rnd = null; uint starttick = (uint)Environment.TickCount; uint timeout = (uint)(stmt._command._commandTimeout * 1000); while (true) { |
︙ | |||
601 602 603 604 605 606 607 608 609 610 611 612 613 614 | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | + | } } } } internal override SQLiteErrorCode Reset(SQLiteStatement stmt) { stmt.CheckDisposed(); SQLiteErrorCode n; #if !SQLITE_STANDARD n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt); #else n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt); #endif |
︙ | |||
643 644 645 646 647 648 649 650 651 652 653 654 655 656 | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | + | internal override string GetLastError() { return SQLiteBase.GetLastError(_sql, _sql); } internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain) { if (previous != null) previous.CheckDisposed(); if (!String.IsNullOrEmpty(strSql)) { // // NOTE: SQLite does not support the concept of separate schemas // in one database; therefore, remove the base schema name // used to smooth integration with the base .NET Framework // data classes. |
︙ | |||
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | + + + | SQLiteLog.LogMessage(String.Format( "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...", handleIntPtr, index, typeof(Byte[]), (value != null) ? ToHexadecimalString(value) : "<null>")); } internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value); #else throw new NotImplementedException(); #endif if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, int value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, uint value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } |
︙ | |||
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | + + + | n = UnsafeNativeMethods.sqlite3_bind_uint(handle, index, value); } if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, long value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); #else throw new NotImplementedException(); #endif if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, ulong value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64(handle, index, value); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64_interop(handle, index, ref value); #else throw new NotImplementedException(); #endif if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } |
︙ | |||
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | + | SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1)); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, dt); } |
︙ | |||
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 | 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 | + + + + | break; } } } internal override void Bind_Blob(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, byte[] blobData) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, blobData); } #endif SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_blob(handle, index, blobData, blobData.Length, (IntPtr)(-1)); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void Bind_Null(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index); } #endif SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_null(handle, index); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override int Bind_ParamCount(SQLiteStatement stmt, SQLiteConnectionFlags flags) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle); if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(String.Format( CultureInfo.CurrentCulture, "Statement {0} paramter count is {1}.", handleIntPtr, value)); } return value; } internal override string Bind_ParamName(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; string name; #if !SQLITE_STANDARD int len; name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(handle, index, out len), len); #else |
︙ | |||
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 | 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 | + + + + + | } return name; } internal override int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName)); if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(String.Format( CultureInfo.CurrentCulture, "Statement {0} paramter index of name {{{1}}} is #{2}.", handleIntPtr, paramName, index)); } return index; } internal override int ColumnCount(SQLiteStatement stmt) { stmt.CheckDisposed(); return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt); } internal override string ColumnName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name(stmt._sqlite_stmt, index), -1); #endif } internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index); } internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity) { stmt.CheckDisposed(); int len; #if !SQLITE_STANDARD IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len); #else len = -1; IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index); #endif |
︙ | |||
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | + + + + | // return "TEXT"; //} } } internal override int ColumnIndex(SQLiteStatement stmt, string columnName) { stmt.CheckDisposed(); int x = ColumnCount(stmt); for (int n = 0; n < x; n++) { if (String.Compare(columnName, ColumnName(stmt, n), StringComparison.OrdinalIgnoreCase) == 0) return n; } return -1; } internal override string ColumnOriginalName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1); #endif } internal override string ColumnDatabaseName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1); #endif } internal override string ColumnTableName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1); #endif } |
︙ | |||
1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | + + + + + + + + + + + + | notNull = (nnotNull == 1); primaryKey = (nprimaryKey == 1); autoIncrement = (nautoInc == 1); } internal override double GetDouble(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); double value; #if !PLATFORM_COMPACTFRAMEWORK value = UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index); #elif !SQLITE_STANDARD UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, out value); #else throw new NotImplementedException(); #endif return value; } internal override sbyte GetSByte(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((sbyte)(GetInt32(stmt, index) & byte.MaxValue)); } internal override byte GetByte(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((byte)(GetInt32(stmt, index) & byte.MaxValue)); } internal override short GetInt16(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((short)(GetInt32(stmt, index) & ushort.MaxValue)); } internal override ushort GetUInt16(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((ushort)(GetInt32(stmt, index) & ushort.MaxValue)); } internal override int GetInt32(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index); } internal override uint GetUInt32(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((uint)GetInt32(stmt, index)); } internal override long GetInt64(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); long value; #if !PLATFORM_COMPACTFRAMEWORK value = UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index); #elif !SQLITE_STANDARD UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value); #else throw new NotImplementedException(); #endif return value; } internal override ulong GetUInt64(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return unchecked((ulong)GetInt64(stmt, index)); } internal override string GetText(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index)); #endif } internal override DateTime GetDateTime(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); if (_datetimeFormat == SQLiteDateFormats.Ticks) return ToDateTime(GetInt64(stmt, index), _datetimeKind); else if (_datetimeFormat == SQLiteDateFormats.JulianDay) return ToDateTime(GetDouble(stmt, index), _datetimeKind); else if (_datetimeFormat == SQLiteDateFormats.UnixEpoch) return ToDateTime(GetInt32(stmt, index), _datetimeKind); #if !SQLITE_STANDARD int len; return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); #else return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index)); #endif } internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength) { stmt.CheckDisposed(); int nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index); // If no destination buffer, return the size needed. if (bDest == null) return nlen; int nCopied = nLength; |
︙ | |||
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | + + | } return nCopied; } internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength) { stmt.CheckDisposed(); int nlen; int nCopied = nLength; string str = GetText(stmt, index); nlen = str.Length; if (bDest == null) return nlen; if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; if (nCopied > 0) str.CopyTo(nDataOffset, bDest, nStart, nCopied); else nCopied = 0; return nCopied; } internal override bool IsNull(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); return (ColumnAffinity(stmt, index) == TypeAffinity.Null); } internal override int AggregateCount(IntPtr context) { return UnsafeNativeMethods.sqlite3_aggregate_count(context); } |
︙ | |||
2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 | + | /// <param name="stmt">The statement being step()'d through</param> /// <param name="flags">The flags associated with the connection.</param> /// <param name="index">The column index to retrieve</param> /// <param name="typ">The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information.</param> /// <returns>Returns the data in the column</returns> internal override object GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, SQLiteType typ) { stmt.CheckDisposed(); if (IsNull(stmt, index)) return DBNull.Value; TypeAffinity aff = typ.Affinity; Type t = null; if (typ.Type != DbType.Object) { t = SQLiteConvert.SQLiteTypeToType(typ); |
︙ | |||
2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 | 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 | + + | default: return GetText(stmt, index); } } internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage) { stmt.CheckDisposed(); #if !SQLITE_STANDARD return UnsafeNativeMethods.sqlite3_table_cursor_interop(stmt._sqlite_stmt, db, rootPage); #else return -1; #endif } internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor) { stmt.CheckDisposed(); #if !SQLITE_STANDARD long rowid; SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_cursor_rowid_interop(stmt._sqlite_stmt, cursor, out rowid); if (rc == SQLiteErrorCode.Ok) return rowid; return 0; #else |
︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | |||
207 208 209 210 211 212 213 214 215 216 217 218 219 220 | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | + | SetTimeout(0); GC.KeepAlive(_sql); } internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt) { stmt.CheckDisposed(); switch (_datetimeFormat) { case SQLiteDateFormats.Ticks: case SQLiteDateFormats.JulianDay: case SQLiteDateFormats.UnixEpoch: { base.Bind_DateTime(stmt, flags, index, dt); |
︙ | |||
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | + + + + + + + | break; } } } internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value) { stmt.CheckDisposed(); SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } #endif SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text16(handle, index, value, value.Length * 2, (IntPtr)(-1)); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override DateTime GetDateTime(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); if (_datetimeFormat == SQLiteDateFormats.Ticks) return ToDateTime(GetInt64(stmt, index), _datetimeKind); else if (_datetimeFormat == SQLiteDateFormats.JulianDay) return ToDateTime(GetDouble(stmt, index), _datetimeKind); else if (_datetimeFormat == SQLiteDateFormats.UnixEpoch) return ToDateTime(GetInt32(stmt, index), _datetimeKind); return ToDateTime(GetText(stmt, index)); } internal override string ColumnName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_name16_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF16ToString(UnsafeNativeMethods.sqlite3_column_name16(stmt._sqlite_stmt, index), -1); #endif } internal override string GetText(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16(stmt._sqlite_stmt, index), UnsafeNativeMethods.sqlite3_column_bytes16(stmt._sqlite_stmt, index)); #endif } internal override string ColumnOriginalName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16(stmt._sqlite_stmt, index), -1); #endif } internal override string ColumnDatabaseName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16(stmt._sqlite_stmt, index), -1); #endif } internal override string ColumnTableName(SQLiteStatement stmt, int index) { stmt.CheckDisposed(); #if !SQLITE_STANDARD int len; return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len); #else return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index), -1); #endif } |
︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | |||
783 784 785 786 787 788 789 790 791 792 793 794 795 796 | 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | + | /// Determines the data type of a column in a statement /// </summary> /// <param name="stmt">The statement to retrieve information for</param> /// <param name="i">The column to retrieve type information on</param> /// <param name="typ">The SQLiteType to receive the affinity for the given column</param> internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ) { stmt.CheckDisposed(); typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity)); } /// <summary> /// Converts a SQLiteType to a .NET Type object /// </summary> /// <param name="t">The SQLiteType to convert</param> |
︙ |
Changes to System.Data.SQLite/SQLiteKeyReader.cs.
︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | + | /// a given statement. /// </summary> /// <param name="cnn"></param> /// <param name="reader"></param> /// <param name="stmt"></param> internal SQLiteKeyReader(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt) { stmt.CheckDisposed(); Dictionary<string, int> catalogs = new Dictionary<string, int>(); Dictionary<string, List<string>> tables = new Dictionary<string, List<string>>(); List<string> list; List<KeyInfo> keys = new List<KeyInfo>(); // Record the statement so we can use it later for sync'ing _stmt = stmt; |
︙ |
Changes to System.Data.SQLite/SQLiteParameterCollection.cs.
︙ | |||
409 410 411 412 413 414 415 416 417 418 419 420 421 422 | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | + | /// <summary> /// This function attempts to map all parameters in the collection to all statements in a Command. /// Since named parameters may span multiple statements, this function makes sure all statements are bound /// to the same named parameter. Unnamed parameters are bound in sequence. /// </summary> internal void MapParameters(SQLiteStatement activeStatement) { if (activeStatement != null) activeStatement.CheckDisposed(); if (_unboundFlag == false || _parameterList.Count == 0 || _command._statementList == null) return; int nUnnamed = 0; string s; int n; int y = -1; SQLiteStatement stmt; |
︙ |
Changes to System.Data.SQLite/SQLiteStatement.cs.
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | + + | /// <param name="sqlbase">The base SQLite object</param> /// <param name="flags">The flags associated with the parent connection object</param> /// <param name="stmt">The statement</param> /// <param name="strCommand">The command text for this statement</param> /// <param name="previous">The previous command in a multi-statement command</param> internal SQLiteStatement(SQLiteBase sqlbase, SQLiteConnectionFlags flags, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous) { if (previous != null) previous.CheckDisposed(); _sql = sqlbase; _sqlite_stmt = stmt; _sqlStatement = strCommand; _flags = flags; // Determine parameters for this statement (if any) and prepare space for them. int nCmdStart = 0; |
︙ | |||
108 109 110 111 112 113 114 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | - + | } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; |
︙ |
Added Tests/tkt-5363fd4af6.eagle.