From: | Chengyu Fan <chengyu(dot)fan(at)hotmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | How to create shared_ptr for PGconn? |
Date: | 2015-03-16 16:32:34 |
Message-ID: | SNT147-W83D05010E77E704F2527DE3020@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Does anyone know how to create the shared_ptr for PGconn? I always get compile errors ...
Below is my code:-----------------------const char * dbInfo = "xxx";PGconn *conn = PGconnectdb(dbInfo);if (PGstatus(conn) != CONNECTION_OK) { std::cout << PQerrorMessage(conn) << std::endl; return 1;}
std::shared_ptr<PGconn> pConn(conn);-----------
Error messages for the code above:
main.cpp:153:27: note: in instantiation of function template specialization 'std::__1::shared_ptr<pg_conn>::shared_ptr<pg_conn, void>' requested here
std::shared_ptr<PGconn> pConn(rawConn);
/usr/local/Cellar/postgresql/9.4.1/include/libpq-fe.h:129:16: note: forward declaration of 'pg_conn'
typedef struct pg_conn PGconn;
Thanks,Chengyu
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-03-16 16:35:53 | Re: get_object_address support for additional object types |
Previous Message | Alvaro Herrera | 2015-03-16 16:29:53 | Re: Providing catalog view to pg_hba.conf file - Patch submission |