diff options
author | drh <drh@noemail.net> | 2017-07-17 00:40:19 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-07-17 00:40:19 +0000 |
commit | ae3ec3f920f39802f81d6ef64283e2925d64ec57 (patch) | |
tree | 7dedb20e1a8bbb316c91802b7913739d20b0abec /ext/misc/remember.c | |
parent | fe8eadc94dc15a77245b7537b1230385caba9161 (diff) | |
download | sqlite-ae3ec3f920f39802f81d6ef64283e2925d64ec57.tar.gz sqlite-ae3ec3f920f39802f81d6ef64283e2925d64ec57.zip |
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
Diffstat (limited to 'ext/misc/remember.c')
-rw-r--r-- | ext/misc/remember.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/misc/remember.c b/ext/misc/remember.c index 97efb6ae8..b6ab2af25 100644 --- a/ext/misc/remember.c +++ b/ext/misc/remember.c @@ -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); } |