summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
52ddc4b)
Author: noodles
Date: 2002/11/10 18:01:36
Making use of DISTINCT for pulling sigs out and strtol doesn't like 64 bit hex
conversions.
PGresult *result = NULL;
uint64_t signer;
char statement[1024];
PGresult *result = NULL;
uint64_t signer;
char statement[1024];
int numsigs = 0;
bool intrans = false;
int numsigs = 0;
bool intrans = false;
if (!intrans) {
result = PQexec(dbconn, "BEGIN");
if (!intrans) {
result = PQexec(dbconn, "BEGIN");
}
snprintf(statement, 1023,
}
snprintf(statement, 1023,
- "SELECT signer FROM onak_sigs WHERE signee = '%llX'",
+ "SELECT DISTINCT signer FROM onak_sigs WHERE signee = '%llX'",
keyid);
result = PQexec(dbconn, statement);
if (PQresultStatus(result) == PGRES_TUPLES_OK) {
numsigs = PQntuples(result);
for (i = 0; i < numsigs; i++) {
keyid);
result = PQexec(dbconn, statement);
if (PQresultStatus(result) == PGRES_TUPLES_OK) {
numsigs = PQntuples(result);
for (i = 0; i < numsigs; i++) {
- signer = strtol(PQgetvalue(result, i, 0), NULL, 16);
+ j = 0;
+ signer = 0;
+ str = PQgetvalue(result, i, 0);
+ while (str[j] != 0) {
+ signer <<= 4;
+ if (str[j] >= '0' && str[j] <= '9') {
+ signer += str[j] - '0';
+ } else {
+ signer += str[j] - 'A' + 10;
+ }
+ j++;
+ }
sigs = lladd(sigs, createandaddtohash(signer));
}
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {
sigs = lladd(sigs, createandaddtohash(signer));
}
} else if (PQresultStatus(result) != PGRES_TUPLES_OK) {