equal
deleted
inserted
replaced
237 |
237 |
238 // success, wait for the connection to be established |
238 // success, wait for the connection to be established |
239 return conn; |
239 return conn; |
240 |
240 |
241 error: |
241 error: |
242 if (conn) { |
242 if (conn) |
243 if (conn->pg_conn) |
243 evpq_release(conn); |
244 PQfinish(conn->pg_conn); |
|
245 |
|
246 free(conn); |
|
247 } |
|
248 |
244 |
249 return NULL; |
245 return NULL; |
250 } |
246 } |
251 |
247 |
252 static int _evpq_check_query (struct evpq_conn *conn) { |
248 static int _evpq_check_query (struct evpq_conn *conn) { |
317 error: |
313 error: |
318 return -1; |
314 return -1; |
319 |
315 |
320 } |
316 } |
321 |
317 |
|
318 void evpq_release (struct evpq_conn *conn) { |
|
319 if (conn->ev) |
|
320 event_free(conn->ev); |
|
321 |
|
322 if (conn->pg_conn) |
|
323 PQfinish(conn->pg_conn); |
|
324 |
|
325 free(conn); |
|
326 } |
|
327 |
322 enum evpq_state evpq_state (struct evpq_conn *conn) { |
328 enum evpq_state evpq_state (struct evpq_conn *conn) { |
323 return conn->state; |
329 return conn->state; |
324 } |
330 } |
325 |
331 |
326 const PGconn *evpq_pgconn (struct evpq_conn *conn) { |
332 const PGconn *evpq_pgconn (struct evpq_conn *conn) { |