Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rikh42/band-snb
base: a1e8c46eeb
...
head fork: rikh42/band-snb
compare: dc1c0e2b7d
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 28 additions and 2 deletions.
  1. +28 −2 core/ConnectionInfo.php
View
30 core/ConnectionInfo.php
@@ -20,15 +20,17 @@ class ConnectionInfo
protected $user = '';
protected $password = '';
protected $database = '';
+ protected $charset = '';
protected $pdo = null;
- public function __construct($host, $port, $user, $password, $database)
+ public function __construct($host, $port, $user, $password, $database, $charset='')
{
$this->host = $host;
$this->port = $port;
$this->user = $user;
$this->password = $password;
$this->database = $database;
+ $this->charset = $charset;
}
public function setServer($host, $port)
@@ -51,6 +53,12 @@ public function setDatabase($database)
$this->pdo = null;
}
+ public function setCharset($charset)
+ {
+ $this->charset = $charset;
+ $this->pdo = null;
+ }
+
public function setPDO(PDO $pdo)
{
$this->pdo = $pdo;
@@ -68,7 +76,25 @@ public function resetPDO()
public function getConnectionString()
{
- return 'mysql:host='.$this->host.';port='.$this->port.';dbname='.$this->database;
+ $items = array();
+ if (!empty($this->host)) {
+ $items[] = "host={$this->host}";
+ }
+
+ if (!empty($this->port)) {
+ $items[] = "port={$this->port}";
+ }
+
+ if (!empty($this->database)) {
+ $items[] = "dbname={$this->database}";
+ }
+
+ if (!empty($this->charset)) {
+ $items[] = "charset={$this->charset}";
+ }
+
+ $cs = implode(';', $items);
+ return 'mysql:'.$cs;
}
public function getUsername()

No commit comments for this range

Something went wrong with that request. Please try again.