PHP to D Conversion

Aldo aldocd4 at outlook.com
Fri Oct 18 08:56:30 UTC 2019


On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:
> class avmtest
> {
> 	private conn;
> 

You need to specify the type of conn. private Connection conn;

> 	auto avmconnect()
> 	{
> 	auto connectionStr = 
> "host=test.srv.com;port=3910;user=testusr;pwd=xxxx#;db=test";
> 	Connection conn = new Connection(connectionStr);
> 	scope(exit) conn.close();
>     }

You are using a new connection here, maybe you want to use 
this->conn instead of Connection conn;

By the way you are closing it everytime with scope(exit).


More information about the Digitalmars-d-learn mailing list