I'm hoping to get some help declaring and using a nested struct type with Cython. In the sqlite3.h header file, there is this:
struct sqlite3_index_info {
int nConstraint; /* Number of entries in aConstraint */
struct sqlite3_index_constraint {
int iColumn; /* Column on left-hand side of constraint */
unsigned char op; /* Constraint operator */
unsigned char usable; /* True if this constraint is usable */
int iTermOffset; /* Used internally - xBestIndex should ignore */
} *aConstraint; /* Table of WHERE clause constraints */
... more members ...
}
That is the only place sqlite3_index_constraint
is declared.
In an example C library provided by the author of SQLite, these structs are used:
const struct sqlite3_index_constraint *pConstraint;
pConstraint = pIdxInfo->aConstraint;
I've tried to declare the "sqlite3_index_constraint" separately, so I have:
const struct sqlite3_index_constraint *pConstraint;
pConstraint = pIdxInfo->aConstraint;
In my code I try to cdef sqlite3_index_constraint *pConstraint
and it cythonizes, but fails to compile with:
error: unknown type name ‘sqlite3_index_constraint’