public function testEnsure() { $settingsDb = $this->connectionSettingsRW; $r1 = new Resource($settingsDb); $r2 = new Resource($settingsDb); $this->assertSame(Resource::ensure(), 0); pg_close($r1->get()); $this->assertFalse($r1->isAlive()); $this->assertSame(Resource::ensure(), 1); $this->assertTrue($r1->isAlive()); $this->assertSame(Resource::ensure(), 0); pg_close($r1->get()); $r1->terminate(); $this->assertSame(Resource::ensure(), 0); $r2->terminate(); }
public function quoteBytea($value) { return "'" . pg_escape_bytea($this->resource->get(), $value) . "'"; }