diff options
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index a4fc382..df6b2c9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -14,7 +14,7 @@ pub const Db = struct { std.log.err("PQisthreadsafe returned 0, can't use libpq in this program", .{}); return PqError.PqError; } - var maybe_conn: ?*pq.PGconn = pq.PQconnectdb(connect_url); + const maybe_conn: ?*pq.PGconn = pq.PQconnectdb(connect_url); if (maybe_conn == null) { std.log.err("PQconnectdb returned null", .{}); return PqError.PqError; @@ -37,9 +37,9 @@ pub const Db = struct { } pub fn exec(self: Db, query: [:0]const u8) !void { - var res: ?*pq.PGresult = pq.PQexec(self.c_conn, query); + const res: ?*pq.PGresult = pq.PQexec(self.c_conn, query); defer pq.PQclear(res); - var est: pq.ExecStatusType = pq.PQresultStatus(res); + const est: pq.ExecStatusType = pq.PQresultStatus(res); if (est != pq.PGRES_COMMAND_OK) { std.log.err("PQexec error code {} message {s}", .{ est, pq.PQerrorMessage(self.c_conn) }); return PqError.PqError; @@ -149,3 +149,4 @@ pub fn addZ(comptime length: usize, value: [length]u8) [length:0]u8 { @memcpy(&terminated_value, &value); return terminated_value; } + |