1.Dd January 24, 2024 2.Dt SQLITE3_VTAB_COLLATION 3 3.Os 4.Sh NAME 5.Nm sqlite3_vtab_collation 6.Nd determine the collation for a virtual table constraint 7.Sh SYNOPSIS 8.In sqlite3.h 9.Ft const char * 10.Fo sqlite3_vtab_collation 11.Fa "sqlite3_index_info*" 12.Fa "int" 13.Fc 14.Sh DESCRIPTION 15This function may only be called from within a call to the xBestIndex 16method of a virtual table. 17This function returns a pointer to a string that is the name of the 18appropriate collation sequence to use for text comparisons on the constraint 19identified by its arguments. 20.Pp 21The first argument must be the pointer to the sqlite3_index_info 22object that is the first parameter to the xBestIndex() method. 23The second argument must be an index into the aConstraint[] array belonging 24to the sqlite3_index_info structure passed to xBestIndex. 25.Pp 26Important: The first parameter must be the same pointer that is passed 27into the xBestMethod() method. 28The first parameter may not be a pointer to a different sqlite3_index_info 29object, even an exact copy. 30.Pp 31The return value is computed as follows: 32.Bl -enum 33.It 34.Pp 35If the constraint comes from a WHERE clause expression that contains 36a COLLATE operator, then the name of the collation 37specified by that COLLATE operator is returned. 38.It 39.Pp 40If there is no COLLATE operator, but the column that is the subject 41of the constraint specifies an alternative collating sequence via a 42COLLATE clause on the column definition within the CREATE 43TABLE statement that was passed into 44.Fn sqlite3_declare_vtab , 45then the name of that alternative collating sequence is returned. 46.It 47.Pp 48Otherwise, "BINARY" is returned. 49.El 50.Pp 51.Sh IMPLEMENTATION NOTES 52These declarations were extracted from the 53interface documentation at line 9854. 54.Bd -literal 55SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int); 56.Ed 57.Sh SEE ALSO 58.Xr sqlite3_declare_vtab 3 , 59.Xr sqlite3_index_info 3 60