Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Modify marshalling for the xUpdate method. More work on docs. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | virtualTables |
Files: | files | file ages | folders |
SHA1: |
7825b411c71113ca124cefb79650e5b2 |
User & Date: | mistachkin 2013-06-25 02:06:33.353 |
Context
2013-06-25
| ||
04:17 | Add SQLiteNativeModule class. Revise table/cursor error handling methods of the SQLiteModule class to add the static variants of them. Rename the old CreateNativeModuleImpl method to GetNativeModuleImpl. Add new CreateNativeModuleImpl method that returns the default ISQLiteNativeModule implementation. More work on docs. check-in: c6554ef4c6 user: mistachkin tags: virtualTables | |
02:06 | Modify marshalling for the xUpdate method. More work on docs. check-in: 7825b411c7 user: mistachkin tags: virtualTables | |
01:25 | Fix several compilation errors and warnings. More work in progress on docs. check-in: d0f5ab8e16 user: mistachkin tags: virtualTables | |
Changes
Changes to System.Data.SQLite/SQLiteModule.cs.
︙ | ︙ | |||
2162 2163 2164 2165 2166 2167 2168 | int argc, IntPtr[] argv ); /////////////////////////////////////////////////////////////////////// /// <summary> | > > > > > > > | > > > > > > > > > | > | | | | | | | | | | | 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 | int argc, IntPtr[] argv ); /////////////////////////////////////////////////////////////////////// /// <summary> /// The xNext method advances a virtual table cursor to the next row of /// a result set initiated by xFilter. If the cursor is already /// pointing at the last row when this routine is called, then the /// cursor no longer points to valid data and a subsequent call to the /// xEof method must return true (non-zero). If the cursor is /// successfully advanced to another row of content, then subsequent /// calls to xEof must return false (zero). /// /// This method must return SQLITE_OK if successful, or an sqlite error /// code if an error occurs. /// /// The xNext method is required for every virtual table /// implementation. /// </summary> /// <param name="pCursor"> /// The native pointer to the sqlite3_vtab_cursor derived structure. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xNext( IntPtr pCursor ); /////////////////////////////////////////////////////////////////////// /// <summary> /// The xEof method must return false (zero) if the specified cursor /// currently points to a valid row of data, or true (non-zero) /// otherwise. This method is called by the SQL engine immediately /// after each xFilter and xNext invocation. /// /// The xEof method is required for every virtual table implementation. /// </summary> /// <param name="pCursor"> /// The native pointer to the sqlite3_vtab_cursor derived structure. /// </param> /// <returns> /// Non-zero if no more rows are available; zero otherwise. /// </returns> int xEof( IntPtr pCursor ); /////////////////////////////////////////////////////////////////////// /// <summary> /// The SQLite core invokes this method in order to find the value for /// the N-th column of the current row. N is zero-based so the first /// column is numbered 0. The xColumn method may return its result back /// to SQLite using one of the following interface: /// /// * sqlite3_result_blob() /// * sqlite3_result_double() /// * sqlite3_result_int() /// * sqlite3_result_int64() /// * sqlite3_result_null() /// * sqlite3_result_text() /// * sqlite3_result_text16() /// * sqlite3_result_text16le() /// * sqlite3_result_text16be() /// * sqlite3_result_zeroblob() /// /// If the xColumn method implementation calls none of the functions /// above, then the value of the column defaults to an SQL NULL. /// /// To raise an error, the xColumn method should use one of the /// result_text() methods to set the error message text, then return an /// appropriate error code. The xColumn method must return SQLITE_OK on |
︙ | ︙ | |||
2364 2365 2366 2367 2368 2369 2370 | /// The xUpdate method is optional. If the xUpdate pointer in the /// sqlite3_module for a virtual table is a NULL pointer, then the /// virtual table is read-only. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> | | | | > | | | > > | > > > > > > > > > > | > > > > > > > > | > > > > > | > > > > > | > > | | | > > > | < > > > > > | > > > > > | > > > > > > > > > > > > > > | > > > | > > > > > > > > > > > > > > > | > > > | > > > > > > > > > > > > > > > > | | 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 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 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 | /// The xUpdate method is optional. If the xUpdate pointer in the /// sqlite3_module for a virtual table is a NULL pointer, then the /// virtual table is read-only. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="argc"> /// The number of new or modified column values contained in /// <paramref name="argv" />. /// </param> /// <param name="argv"> /// The array of native pointers to sqlite3_value structures containing /// the new or modified column values, if any. /// </param> /// <param name="rowId"> /// Upon success, this parameter must be modified to contain the unique /// integer row identifier for the row that was inserted, if any. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xUpdate( IntPtr pVtab, int argc, IntPtr[] argv, ref long rowId ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method begins a transaction on a virtual table. This is method /// is optional. The xBegin pointer of sqlite3_module may be NULL. /// /// This method is always followed by one call to either the xCommit or /// xRollback method. Virtual table transactions do not nest, so the /// xBegin method will not be invoked more than once on a single /// virtual table without an intervening call to either xCommit or /// xRollback. Multiple calls to other methods can and likely will /// occur in between the xBegin and the corresponding xCommit or /// xRollback. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xBegin( IntPtr pVtab ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method signals the start of a two-phase commit on a virtual /// table. This is method is optional. The xSync pointer of /// sqlite3_module may be NULL. /// /// This method is only invoked after call to the xBegin method and /// prior to an xCommit or xRollback. In order to implement two-phase /// commit, the xSync method on all virtual tables is invoked prior to /// invoking the xCommit method on any virtual table. If any of the /// xSync methods fail, the entire transaction is rolled back. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xSync( IntPtr pVtab ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method causes a virtual table transaction to commit. This is /// method is optional. The xCommit pointer of sqlite3_module may be /// NULL. /// /// A call to this method always follows a prior call to xBegin and /// xSync. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xCommit( IntPtr pVtab ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method causes a virtual table transaction to rollback. This is /// method is optional. The xRollback pointer of sqlite3_module may be /// NULL. /// /// A call to this method always follows a prior call to xBegin. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xRollback( IntPtr pVtab ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method provides notification that the virtual table /// implementation that the virtual table will be given a new name. If /// this method returns SQLITE_OK then SQLite renames the table. If /// this method returns an error code then the renaming is prevented. /// /// The xRename method is required for every virtual table /// implementation. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="nArg"> /// The number of arguments to the function being sought. /// </param> /// <param name="zName"> /// The name of the function being sought. /// </param> /// <param name="callback"> /// Upon success, this parameter must be modified to contain the /// delegate responsible for implementing the specified function. /// </param> /// <param name="pClientData"> /// Upon success, this parameter must be modified to contain the /// native user data pointer associated with /// <paramref name="callback" />. /// </param> /// <returns> /// Non-zero if the specified function was found; zero otherwise. /// </returns> int xFindFunction( IntPtr pVtab, int nArg, IntPtr zName, ref SQLiteCallback callback, ref IntPtr pClientData ); /////////////////////////////////////////////////////////////////////// /// <summary> /// This method provides notification that the virtual table /// implementation that the virtual table will be given a new name. If /// this method returns SQLITE_OK then SQLite renames the table. If /// this method returns an error code then the renaming is prevented. /// /// The xRename method is required for every virtual table /// implementation. /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="zNew"> /// The native pointer to the UTF-8 encoded string containing the new /// name for the virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xRename( IntPtr pVtab, IntPtr zNew ); /////////////////////////////////////////////////////////////////////// /// <summary> /// These methods provide the virtual table implementation an /// opportunity to implement nested transactions. They are always /// optional and will only be called in SQLite version 3.7.7 and later. /// /// When xSavepoint(X,N) is invoked, that is a signal to the virtual /// table X that it should save its current state as savepoint N. A /// subsequent call to xRollbackTo(X,R) means that the state of the /// virtual table should return to what it was when xSavepoint(X,R) was /// last called. The call to xRollbackTo(X,R) will invalidate all /// savepoints with N>R; none of the invalided savepoints will be /// rolled back or released without first being reinitialized by a call /// to xSavepoint(). A call to xRelease(X,M) invalidates all savepoints /// where N>=M. /// /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will /// ever be called except in between calls to xBegin() and either /// xCommit() or xRollback(). /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="iSavepoint"> /// This is an integer identifier under which the the current state of /// the virtual table should be saved. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xSavepoint( IntPtr pVtab, int iSavepoint ); /////////////////////////////////////////////////////////////////////// /// <summary> /// These methods provide the virtual table implementation an /// opportunity to implement nested transactions. They are always /// optional and will only be called in SQLite version 3.7.7 and later. /// /// When xSavepoint(X,N) is invoked, that is a signal to the virtual /// table X that it should save its current state as savepoint N. A /// subsequent call to xRollbackTo(X,R) means that the state of the /// virtual table should return to what it was when xSavepoint(X,R) was /// last called. The call to xRollbackTo(X,R) will invalidate all /// savepoints with N>R; none of the invalided savepoints will be /// rolled back or released without first being reinitialized by a call /// to xSavepoint(). A call to xRelease(X,M) invalidates all savepoints /// where N>=M. /// /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will /// ever be called except in between calls to xBegin() and either /// xCommit() or xRollback(). /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="iSavepoint"> /// This is an integer used to indicate that any saved states with an /// identifier greater than or equal to this should be deleted by the /// virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xRelease( IntPtr pVtab, int iSavepoint ); /////////////////////////////////////////////////////////////////////// /// <summary> /// These methods provide the virtual table implementation an /// opportunity to implement nested transactions. They are always /// optional and will only be called in SQLite version 3.7.7 and later. /// /// When xSavepoint(X,N) is invoked, that is a signal to the virtual /// table X that it should save its current state as savepoint N. A /// subsequent call to xRollbackTo(X,R) means that the state of the /// virtual table should return to what it was when xSavepoint(X,R) was /// last called. The call to xRollbackTo(X,R) will invalidate all /// savepoints with N>R; none of the invalided savepoints will be /// rolled back or released without first being reinitialized by a call /// to xSavepoint(). A call to xRelease(X,M) invalidates all savepoints /// where N>=M. /// /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will /// ever be called except in between calls to xBegin() and either /// xCommit() or xRollback(). /// </summary> /// <param name="pVtab"> /// The native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="iSavepoint"> /// This is an integer identifier used to specify a specific saved /// state for the virtual table for it to restore itself back to, which /// should also have the effect of deleting all saved states with an /// integer identifier greater than this one. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> SQLiteErrorCode xRollbackTo( IntPtr pVtab, int iSavepoint |
︙ | ︙ | |||
4427 4428 4429 4430 4431 4432 4433 | return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// private SQLiteErrorCode xUpdate( IntPtr pVtab, | | | | | < < | | 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 | return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// private SQLiteErrorCode xUpdate( IntPtr pVtab, int argc, IntPtr[] argv, ref long rowId ) { try { SQLiteVirtualTable table = TableFromIntPtr(pVtab); if (table != null) { return Update( table, SQLiteMarshal.ValueArrayFromIntPtrArray(argv), ref rowId); } } catch (Exception e) /* NOTE: Must catch ALL. */ { SetTableError(pVtab, e.ToString()); } |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
1782 1783 1784 1785 1786 1787 1788 | /////////////////////////////////////////////////////////////////////////// #if !PLATFORM_COMPACTFRAMEWORK [UnmanagedFunctionPointer(CallingConvention.Cdecl)] #endif public delegate SQLiteErrorCode xUpdate( IntPtr pVtab, | | > | | 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | /////////////////////////////////////////////////////////////////////////// #if !PLATFORM_COMPACTFRAMEWORK [UnmanagedFunctionPointer(CallingConvention.Cdecl)] #endif public delegate SQLiteErrorCode xUpdate( IntPtr pVtab, int argc, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] IntPtr[] argv, ref long rowId ); /////////////////////////////////////////////////////////////////////////// #if !PLATFORM_COMPACTFRAMEWORK [UnmanagedFunctionPointer(CallingConvention.Cdecl)] |
︙ | ︙ |