| 181 | } |
| 182 | |
| 183 | static s64 db_postgres_column_int(struct db_stmt *stmt, int col) |
| 184 | { |
| 185 | PGresult *res = (PGresult*)stmt->inner_stmt; |
| 186 | be32 bin; |
| 187 | size_t expected = sizeof(bin), actual = PQgetlength(res, stmt->row, col); |
| 188 | |
| 189 | if (expected != actual) |
| 190 | db_fatal(stmt->db, |
| 191 | "s32 field doesn't match size: expected %zu, actual %zu\n", |
| 192 | expected, actual); |
| 193 | |
| 194 | memcpy(&bin, PQgetvalue(res, stmt->row, col), sizeof(bin)); |
| 195 | return be32_to_cpu(bin); |
| 196 | } |
| 197 | |
| 198 | static size_t db_postgres_column_bytes(struct db_stmt *stmt, int col) |
| 199 | { |
nothing calls this directly
no test coverage detected