1.Dd December 19, 2018 2.Dt SQLITE3_COLUMN_DATABASE_NAME 3 3.Os 4.Sh NAME 5.Nm sqlite3_column_database_name , 6.Nm sqlite3_column_database_name16 , 7.Nm sqlite3_column_table_name , 8.Nm sqlite3_column_table_name16 , 9.Nm sqlite3_column_origin_name , 10.Nm sqlite3_column_origin_name16 11.Nd Source Of Data In A Query Result 12.Sh SYNOPSIS 13.Ft const char * 14.Fo sqlite3_column_database_name 15.Fa "sqlite3_stmt*" 16.Fa "int" 17.Fc 18.Ft const void * 19.Fo sqlite3_column_database_name16 20.Fa "sqlite3_stmt*" 21.Fa "int" 22.Fc 23.Ft const char * 24.Fo sqlite3_column_table_name 25.Fa "sqlite3_stmt*" 26.Fa "int" 27.Fc 28.Ft const void * 29.Fo sqlite3_column_table_name16 30.Fa "sqlite3_stmt*" 31.Fa "int" 32.Fc 33.Ft const char * 34.Fo sqlite3_column_origin_name 35.Fa "sqlite3_stmt*" 36.Fa "int" 37.Fc 38.Ft const void * 39.Fo sqlite3_column_origin_name16 40.Fa "sqlite3_stmt*" 41.Fa "int" 42.Fc 43.Sh DESCRIPTION 44These routines provide a means to determine the database, table, and 45table column that is the origin of a particular result column in SELECT 46statement. 47The name of the database or table or column can be returned as either 48a UTF-8 or UTF-16 string. 49The _database_ routines return the database name, the _table_ routines 50return the table name, and the origin_ routines return the column name. 51The returned string is valid until the prepared statement 52is destroyed using sqlite3_finalize() or until the 53statement is automatically reprepared by the first call to sqlite3_step() 54for a particular run or until the same information is requested again 55in a different encoding. 56.Pp 57The names returned are the original un-aliased names of the database, 58table, and column. 59.Pp 60The first argument to these interfaces is a prepared statement. 61These functions return information about the Nth result column returned 62by the statement, where N is the second function argument. 63The left-most column is column 0 for these routines. 64.Pp 65If the Nth column returned by the statement is an expression or subquery 66and is not a column value, then all of these functions return NULL. 67These routine might also return NULL if a memory allocation error occurs. 68Otherwise, they return the name of the attached database, table, or 69column that query result column was extracted from. 70.Pp 71As with all other SQLite APIs, those whose names end with "16" return 72UTF-16 encoded strings and the other functions return UTF-8. 73.Pp 74These APIs are only available if the library was compiled with the 75SQLITE_ENABLE_COLUMN_METADATA C-preprocessor 76symbol. 77.Pp 78If two or more threads call one or more of these routines against the 79same prepared statement and column at the same time then the results 80are undefined. 81.Pp 82If two or more threads call one or more column metadata interfaces 83for the same prepared statement and result column 84at the same time then the results are undefined. 85.Sh SEE ALSO 86.Xr sqlite3_stmt 3 , 87.Xr sqlite3_column_database_name 3 , 88.Xr sqlite3_finalize 3 , 89.Xr sqlite3_step 3 90