1.Dd March 11, 2017 2.Dt SQLITE3_VALUE_BLOB 3 3.Os 4.Sh NAME 5.Nm sqlite3_value_blob , 6.Nm sqlite3_value_bytes , 7.Nm sqlite3_value_bytes16 , 8.Nm sqlite3_value_double , 9.Nm sqlite3_value_int , 10.Nm sqlite3_value_int64 , 11.Nm sqlite3_value_text , 12.Nm sqlite3_value_text16 , 13.Nm sqlite3_value_text16le , 14.Nm sqlite3_value_text16be , 15.Nm sqlite3_value_type , 16.Nm sqlite3_value_numeric_type 17.Nd Obtaining SQL Values 18.Sh SYNOPSIS 19.Ft const void * 20.Fo sqlite3_value_blob 21.Fa "sqlite3_value*" 22.Fc 23.Ft int 24.Fo sqlite3_value_bytes 25.Fa "sqlite3_value*" 26.Fc 27.Ft int 28.Fo sqlite3_value_bytes16 29.Fa "sqlite3_value*" 30.Fc 31.Ft double 32.Fo sqlite3_value_double 33.Fa "sqlite3_value*" 34.Fc 35.Ft int 36.Fo sqlite3_value_int 37.Fa "sqlite3_value*" 38.Fc 39.Ft sqlite3_int64 40.Fo sqlite3_value_int64 41.Fa "sqlite3_value*" 42.Fc 43.Ft const unsigned char * 44.Fo sqlite3_value_text 45.Fa "sqlite3_value*" 46.Fc 47.Ft const void * 48.Fo sqlite3_value_text16 49.Fa "sqlite3_value*" 50.Fc 51.Ft const void * 52.Fo sqlite3_value_text16le 53.Fa "sqlite3_value*" 54.Fc 55.Ft const void * 56.Fo sqlite3_value_text16be 57.Fa "sqlite3_value*" 58.Fc 59.Ft int 60.Fo sqlite3_value_type 61.Fa "sqlite3_value*" 62.Fc 63.Ft int 64.Fo sqlite3_value_numeric_type 65.Fa "sqlite3_value*" 66.Fc 67.Sh DESCRIPTION 68The C-language implementation of SQL functions and aggregates uses 69this set of interface routines to access the parameter values on the 70function or aggregate. 71.Pp 72The xFunc (for scalar functions) or xStep (for aggregates) parameters 73to sqlite3_create_function() and sqlite3_create_function16() 74define callbacks that implement the SQL functions and aggregates. 75The 3rd parameter to these callbacks is an array of pointers to protected sqlite3_value 76objects. 77There is one sqlite3_value object for each parameter to 78the SQL function. 79These routines are used to extract values from the sqlite3_value 80objects. 81.Pp 82These routines work only with protected sqlite3_value 83objects. 84Any attempt to use these routines on an unprotected sqlite3_value 85object results in undefined behavior. 86.Pp 87These routines work just like the corresponding column access functions 88except that these routines take a single protected sqlite3_value 89object pointer instead of a sqlite3_stmt* pointer and 90an integer column number. 91.Pp 92The sqlite3_value_text16() interface extracts a UTF-16 string in the 93native byte-order of the host machine. 94The sqlite3_value_text16be() and sqlite3_value_text16le() interfaces 95extract UTF-16 strings as big-endian and little-endian respectively. 96.Pp 97The sqlite3_value_numeric_type() interface attempts to apply numeric 98affinity to the value. 99This means that an attempt is made to convert the value to an integer 100or floating point. 101If such a conversion is possible without loss of information (in other 102words, if the value is a string that looks like a number) then the 103conversion is performed. 104Otherwise no conversion occurs. 105The datatype after conversion is returned. 106.Pp 107Please pay particular attention to the fact that the pointer returned 108from sqlite3_value_blob(), sqlite3_value_text(), 109or sqlite3_value_text16() can be invalidated 110by a subsequent call to sqlite3_value_bytes(), 111sqlite3_value_bytes16(), sqlite3_value_text(), 112or sqlite3_value_text16(). 113.Pp 114These routines must be called from the same thread as the SQL function 115that supplied the sqlite3_value* parameters. 116.Sh SEE ALSO 117.Xr sqlite3_column_blob 3 , 118.Xr sqlite3_value 3 , 119.Xr sqlite3_create_function 3 , 120.Xr sqlite3_value 3 , 121.Xr sqlite3_value_blob 3 , 122.Xr SQLITE_INTEGER 3 , 123.Xr sqlite3_value 3 124