Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update header comments on the carray() and remember() extensions to bring out the fact that the pointer arguments must be bound using sqlite3_bind_pointer(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
55f5396576d186f310cb0fa66fbdb8ea |
User & Date: | drh 2017-07-13 19:11:13.037 |
Context
2017-07-13
| ||
20:11 | Fix documentation typo. No changes to code. (check-in: 9319f7b71f user: drh tags: trunk) | |
19:11 | Update header comments on the carray() and remember() extensions to bring out the fact that the pointer arguments must be bound using sqlite3_bind_pointer(). (check-in: 55f5396576 user: drh tags: trunk) | |
18:09 | Add new interfaces sqlite3_bind_pointer(), sqlite3_result_pointer(), and sqlite3_value_pointer() used to safely move pointer values through SQL without exposing underlying memory address information. (check-in: 72de49f204 user: drh tags: trunk) | |
Changes
Changes to ext/misc/carray.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 | ** This file demonstrates how to create a table-valued-function that ** returns the values in a C-language array. ** Examples: ** ** SELECT * FROM carray($ptr,5) ** ** The query above returns 5 integers contained in a C-language array | | | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ** This file demonstrates how to create a table-valued-function that ** returns the values in a C-language array. ** Examples: ** ** SELECT * FROM carray($ptr,5) ** ** The query above returns 5 integers contained in a C-language array ** at the address $ptr. $ptr is a pointer to the array of integers. ** The pointer value must be assigned to $ptr using the ** sqlite3_bind_pointer() interface. ** ** There is an optional third parameter to determine the datatype of ** the C-language array. Allowed values of the third parameter are ** 'int32', 'int64', 'double', 'char*'. Example: ** ** SELECT * FROM carray($ptr,10,'char*'); ** |
︙ | ︙ |
Changes to ext/misc/remember.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** This allows, for example, a counter to incremented and the original ** value retrieved, atomically, using a single statement: ** ** UPDATE counterTab SET cnt=remember(cnt,$PTR)+1 WHERE id=$ID ** ** Prepare the above statement once. Then to use it, bind the address | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** ** This allows, for example, a counter to incremented and the original ** value retrieved, atomically, using a single statement: ** ** UPDATE counterTab SET cnt=remember(cnt,$PTR)+1 WHERE id=$ID ** ** Prepare the above statement once. Then to use it, bind the address ** of the output variable to $PTR (using sqlite3_binary_pointer()) and ** bind the id of the counter to $ID and run the prepared statement. ** ** One can imagine doing similar things with floating-point values and ** strings, but this demonstration extension will stick to using just ** integers. */ #include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 |
︙ | ︙ |