mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add an experimental "pointer type" parameter to sqlite3_bind_pointer(),
sqlite3_result_pointer(), and sqlite3_value_pointer(). The pointer type is a string that must compare equal using strcmp() or else the pointer comes through as a NULL. FossilOrigin-Name: 211cce04e97d2e325a6ea3e99738fc71115d673dc13daeffb03ac3140deb11de
This commit is contained in:
@ -21,8 +21,9 @@
|
||||
** 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_bind_pointer()) and
|
||||
** bind the id of the counter to $ID and run the prepared statement.
|
||||
** of the output variable to $PTR using sqlite3_bind_pointer() with a
|
||||
** pointer type of "carray" 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
|
||||
@ -47,7 +48,7 @@ static void rememberFunc(
|
||||
sqlite3_int64 *ptr;
|
||||
assert( argc==2 );
|
||||
v = sqlite3_value_int64(argv[0]);
|
||||
ptr = sqlite3_value_pointer(argv[1]);
|
||||
ptr = sqlite3_value_pointer(argv[1], "carray");
|
||||
if( ptr ) *ptr = v;
|
||||
sqlite3_result_int64(pCtx, v);
|
||||
}
|
||||
|
Reference in New Issue
Block a user