sqlite3rtree.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. ** 2010 August 30
  3. **
  4. ** The author disclaims copyright to this source code. In place of
  5. ** a legal notice, here is a blessing:
  6. **
  7. ** May you do good and not evil.
  8. ** May you find forgiveness for yourself and forgive others.
  9. ** May you share freely, never taking more than you give.
  10. **
  11. *************************************************************************
  12. */
  13. #ifndef _SQLITE3RTREE_H_
  14. #define _SQLITE3RTREE_H_
  15. #include <sqlite3.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
  20. /*
  21. ** Register a geometry callback named zGeom that can be used as part of an
  22. ** R-Tree geometry query as follows:
  23. **
  24. ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
  25. */
  26. int sqlite3_rtree_geometry_callback(
  27. sqlite3 *db,
  28. const char *zGeom,
  29. #ifdef SQLITE_RTREE_INT_ONLY
  30. int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes),
  31. #else
  32. int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes),
  33. #endif
  34. void *pContext
  35. );
  36. /*
  37. ** A pointer to a structure of the following type is passed as the first
  38. ** argument to callbacks registered using rtree_geometry_callback().
  39. */
  40. struct sqlite3_rtree_geometry {
  41. void *pContext; /* Copy of pContext passed to s_r_g_c() */
  42. int nParam; /* Size of array aParam[] */
  43. double *aParam; /* Parameters passed to SQL geom function */
  44. void *pUser; /* Callback implementation user data */
  45. void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
  46. };
  47. #ifdef __cplusplus
  48. } /* end of the 'extern "C"' block */
  49. #endif
  50. #endif /* ifndef _SQLITE3RTREE_H_ */