Example #1
0
 public function __construct($hostname, $port, $username, $password, $dbname, $minpool, $maxpool)
 {
     SqlDriverManager::install("mysql");
     $this->pooling = SqlDriverManager::getPool('mysql://' . $hostname . ':' . $port . '/' . $dbname, 'mysql', array('username' => $username, 'password' => $password));
     //$this->pooling->setMaxPoolSize($maxpool);
     $this->pooling->setMaxPoolSize(1);
     $this->pool = $this->pooling->getConnection();
     $this->pool->query('USE bloon;')->update();
 }
Example #2
0
--TEST--
Test create table #1
--FILE--
<?php 
use php\sql\SqlDriverManager;
$pool = SqlDriverManager::getPool(':sqlite::memory:', 'sqlite');
$conn = $pool->getConnection();
$statement = $conn->query('create table person (id integer, name string)');
var_dump($statement->update());
$result = $conn->query('select COUNT(*) from person')->fetch();
var_dump($result->toArray());
?>
--EXPECTF--
int(0)
array(1) {
  ["COUNT(*)"]=>
  int(0)
}