+static int zpm_sqlite_vercmp(void *not_used, int lena, const void *a,
+ int lenb, const void *b) {
+ /* not sure what the ints are, possibly string lengths */
+ if (not_used != 0) fprintf(stderr, "sqlite vercmp not_used = %p\n",
+ not_used);
+ if (lena == 0 && lenb > 0) return 1;
+ return zpm_vercmp(a, b);
+}
+
+int zpm_addvercmp(struct zpm *pkg) {
+ return sqlite3_create_collation(
+ pkg->db, "vercmp", SQLITE_UTF8, NULL,
+ zpm_sqlite_vercmp
+ );
+}
+