PHPDaemon\Examples\ExampleWithPostgreSQLRequest::init PHP Method

init() public method

Constructor.
public init ( ) : void
return void
    public function init()
    {
        $this->appInstance->pgsql->getConnection(function ($sql) {
            if (!$sql->connected) {
                // failed to connect
                $this->wakeup();
                // wake up the request immediately
                $sql->release();
                return;
            }
            $sql->query('SELECT 123 as integer, NULL as nul, \'test\' as string', function ($sql, $success) {
                $this->queryResult = $sql->resultRows;
                // save the result
                $this->wakeup();
                // wake up the request immediately
                $sql->release();
            });
        });
        $this->sleep(5);
    }
ExampleWithPostgreSQLRequest