1 #define _POSIX_C_SOURCE 200809L
10 int zpm_script_hash(struct zpm *zpm, char *pkgstr, char *phase, char *hash) {
12 char *template = "select hash from scripts_pkgid where pkgid = %Q and stage = %Q";
15 pkgid = zpm_findpkg(zpm, pkgstr);
17 st = zpm_dbquery(zpm, template, pkgid, phase);
23 zpm->errmsg = strdup(sqlite3_errmsg(zpm->db));
27 switch (sqlite3_step(st)) {
29 strncpy(hash, (const char *) sqlite3_column_text(st, 0),
31 hash[ZPM_HASH_STRLEN] = 0;
33 default: zpm->error = 1; /* fall through */
34 zpm->errmsg = strdup(sqlite3_errmsg(zpm->db));
37 return 0; break; /* not found */