Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: Hi All, Request your help in converting a PHP code to D equivalent code You can get one connection object and close it :) ```D import hunt.database; class AvmTest { private Database _db; this() { _db = new Datab

Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Monday, 21 October 2019 at 15:36:25 UTC, Andre Pany wrote: On Monday, 21 October 2019 at 15:29:33 UTC, zoujiaqing wrote: On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: [...] import hunt.database; class avmtest { private Database db; this() { db = new Databas

Re: PHP to D Conversion

2019-10-21 Thread Andre Pany via Digitalmars-d-learn
On Monday, 21 October 2019 at 15:29:33 UTC, zoujiaqing wrote: On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: [...] import hunt.database; class avmtest { private Database db; this() { db = new Database("mysql://testusr:x...@test.srv.com:3910/test"); }

Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: Hi All, Request your help in converting a PHP code to D equivalent code PHP Code: class avmtest { private $con; function __construct() { global $config; $this->con = new mysqli(test.srv.

Re: PHP to D Conversion

2019-10-21 Thread Andre Pany via Digitalmars-d-learn
On Monday, 21 October 2019 at 11:36:00 UTC, Vino wrote: On Saturday, 19 October 2019 at 20:40:36 UTC, Boris Carvajal wrote: [...] Hi Boris, [...] Hi, Where do you call avmconnect? Is this.conn null when connection fails? What happens if the query does not contains rows? Kind regards Andre

Re: PHP to D Conversion

2019-10-21 Thread Vino via Digitalmars-d-learn
On Saturday, 19 October 2019 at 20:40:36 UTC, Boris Carvajal wrote: On Saturday, 19 October 2019 at 19:08:45 UTC, Vino wrote: On Friday, 18 October 2019 at 14:56:05 UTC, Andre Pany wrote: On Friday, 18 October 2019 at 09:21:46 UTC, Vino wrote: On Friday, 18 October 2019 at 09:17:24 UTC, Vino w

Re: PHP to D Conversion

2019-10-19 Thread Boris Carvajal via Digitalmars-d-learn
On Saturday, 19 October 2019 at 19:08:45 UTC, Vino wrote: On Friday, 18 October 2019 at 14:56:05 UTC, Andre Pany wrote: On Friday, 18 October 2019 at 09:21:46 UTC, Vino wrote: On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote: [...] And now getting the error : Program exited with code

Re: PHP to D Conversion

2019-10-19 Thread Vino via Digitalmars-d-learn
On Friday, 18 October 2019 at 14:56:05 UTC, Andre Pany wrote: On Friday, 18 October 2019 at 09:21:46 UTC, Vino wrote: On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote: [...] And now getting the error : Program exited with code -1073741819 Hi, Maybe port 8080 is blocked, because ther

Re: PHP to D Conversion

2019-10-18 Thread Andre Pany via Digitalmars-d-learn
On Friday, 18 October 2019 at 09:21:46 UTC, Vino wrote: On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote: On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote: [...] App.d import vibe.vibe; import avm.test; void main() { auto settings = new HTTPServerSettings; settin

Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn
On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote: On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote: [...] App.d import vibe.vibe; import avm.test; void main() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["127.0.

Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn
On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote: On Friday, 18 October 2019 at 08:54:40 UTC, Jacob Carlborg wrote: On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: [...] The instance variable in the D code, `conn`, doesn't have a type. I guess the type should be `Connection`.

Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn
On Friday, 18 October 2019 at 08:54:40 UTC, Jacob Carlborg wrote: On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: [...] The instance variable in the D code, `conn`, doesn't have a type. I guess the type should be `Connection`. In the D version of `avmconnect` you're declaring a loca

Re: PHP to D Conversion

2019-10-18 Thread Aldo via Digitalmars-d-learn
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=#;db=test"; Conne

Re: PHP to D Conversion

2019-10-18 Thread Jacob Carlborg via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: Hi All, Request your help in converting a PHP code to D equivalent code PHP Code: class avmtest { private $con; function __construct() { global $config; $this->con = new mysqli(test.srv.

PHP to D Conversion

2019-10-17 Thread Vino via Digitalmars-d-learn
Hi All, Request your help in converting a PHP code to D equivalent code PHP Code: class avmtest { private $con; function __construct() { global $config; $this->con = new mysqli(test.srv.com:3910, testusr, #, test); if($this-