Name
sqlite3_table_column_metadata() — Lookup extended column metadata
Definition
int sqlite3_table_column_metadata( sqlite3* db, const char* db_name, const char* tbl_name, const char* col_name, const char** datatype, const char** collation, int* not_null, int* primary_key, int* autoincrement );
-
db
A database connection.
-
db_name
A logical database name, encoded in UTF-8. The name may be
main
,temp
, or a name given toATTACH DATABASE
.-
tbl_name
A table name.
-
col_name
A column name.
-
datatype
A reference to a string. The declared datatype will be passed back. This is the datatype that appears in the
CREATE TABLE
statement.-
collation
A reference to a string. The declared collation will be passed back.
-
not_null
A reference to an integer. If a nonzero value is passed back, the column has a
NOT NULL
constraint.-
primary_key
A reference to an integer. If a nonzero value is passed back, the column is part of the table’s primary key.
-
autoincrement
A reference to an integer. If a nonzero value is passed back, the column is set to
AUTOINCREMENT
. This implies the column is aROWID
alias, and has been designated as anINTEGER PRIMARY KEY
.- Returns
An SQLite result code.
Description
This function is used to retrieve information about a specific
column. Given a database connection, a logical database name, a
table name, and the name of the column, this function will pass
back the original datatype (as given in the CREATE TABLE
statement) and the default collation name. A set of flags will also be returned, ...
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.