int sqlite3_table_column_metadata( sqlite3 *db, /* Connection handle */ const char *zDbName, /* Database name or NULL */ const char *zTableName, /* Table name */ const char *zColumnName, /* Column name */ char const **pzDataType, /* OUTPUT: Declared data type */ char const **pzCollSeq, /* OUTPUT: Collation sequence name */ int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ int *pPrimaryKey, /* OUTPUT: True if column part of PK */ int *pAutoinc /* OUTPUT: True if column is auto-increment */ );
R-60317-50382:[The sqlite3_table_column_metadata(X,D,T,C,....) routine returns information about column C of table T in database D on database connection X. ] R-37760-36374:[The sqlite3_table_column_metadata() interface returns SQLITE_OK and fills in the non-NULL pointers in the final five arguments with appropriate values if the specified column exists. ] R-14849-03112:[The sqlite3_table_column_metadata() interface returns SQLITE_ERROR and if the specified column does not exist. ] R-63822-07193:[If the column-name parameter to sqlite3_table_column_metadata() is a NULL pointer, then this routine simply checks for the existence of the table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it does not. ]
R-47355-18032:[The column is identified by the second, third and fourth parameters to this function. ] R-23149-10450:[The second parameter is either the name of the database (i.e. "main", "temp", or an attached database) containing the specified table or NULL. ] R-15618-12639:[If it is NULL, then all attached databases are searched for the table using the same algorithm used by the database engine to resolve unqualified table references. ]
R-27192-61982:[The third and fourth parameters to this function are the table and column name of the desired column, respectively. ]
R-20784-11852:[Metadata is returned by writing to the memory locations passed as the 5th and subsequent parameters to this function. ] R-07046-65439:[Any of these arguments may be NULL, in which case the corresponding element of metadata is omitted. ]
R-17527-22739:[
]
Parameter Output
Type Description
5th const char* Data type
6th const char* Name of default collation sequence
7th int True if column has a NOT NULL constraint
8th int True if column is part of the PRIMARY KEY
9th int True if column is AUTOINCREMENT
R-18978-08031:[The memory pointed to by the character pointers returned for the declaration type and collation sequence is valid until the next call to any SQLite API function. ]
R-16748-44311:[If the specified table is actually a view, an error code is returned. ]
R-16368-45976:[If the specified column is "rowid", "oid" or "_rowid_" and the table is not a WITHOUT ROWID table and an INTEGER PRIMARY KEY column has been explicitly declared, then the output parameters are set for the explicitly declared column. ] R-43309-20049:[If there is no INTEGER PRIMARY KEY column, then the outputs for the rowid are set as follows:
data type: "INTEGER" collation sequence: "BINARY" not null: 0 primary key: 1 auto increment: 0]
R-20796-14963:[This function causes all database schemas to be read from disk and parsed, if that has not already been done, and returns an error if any errors are encountered while loading the schema. ]