Amp\Mysql\Pool::setCharset PHP Method

setCharset() public method

public setCharset ( $charset, $collate = "" )
    public function setCharset($charset, $collate = "")
    {
        $this->connectionPool->setCharset($charset, $collate);
    }

Usage Example

Example #1
0
 function testConnect()
 {
     $complete = false;
     (new NativeReactor())->run(function ($reactor) use(&$complete) {
         $db = new Pool("host=" . DB_HOST . ";user="******";pass="******";db=connectiontest", null, $reactor);
         (yield $db->init());
         // force waiting for connection
         /* use an alternative charset... Default is utf8mb4_general_ci */
         $db->setCharset("latin1_general_ci");
         $complete = true;
     });
     $this->assertEquals(true, $complete, "Database commands did not complete.");
 }