| 166 | } |
| 167 | |
| 168 | static u64 db_postgres_column_u64(struct db_stmt *stmt, int col) |
| 169 | { |
| 170 | PGresult *res = (PGresult*)stmt->inner_stmt; |
| 171 | be64 bin; |
| 172 | size_t expected = sizeof(bin), actual = PQgetlength(res, stmt->row, col); |
| 173 | |
| 174 | if (expected != actual) |
| 175 | db_fatal(stmt->db, |
| 176 | "u64 field doesn't match size: expected %zu, actual %zu\n", |
| 177 | expected, actual); |
| 178 | |
| 179 | memcpy(&bin, PQgetvalue(res, stmt->row, col), sizeof(bin)); |
| 180 | return be64_to_cpu(bin); |
| 181 | } |
| 182 | |
| 183 | static s64 db_postgres_column_int(struct db_stmt *stmt, int col) |
| 184 | { |
nothing calls this directly
no test coverage detected