Постфиксная запись типов вместо префиксной
This commit is contained in:
parent
04662a94df
commit
11370eecc9
33 changed files with 95 additions and 79 deletions
|
|
@ -44,13 +44,13 @@ class Database extends PDO
|
|||
|
||||
if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') {
|
||||
$port = (isset($dsn['port'])) ? "port={$dsn['port']};" : "";
|
||||
/*.Database.*/$connection = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
|
||||
$connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']);
|
||||
if ($dsn['phptype'] == 'pgsql') {
|
||||
$connection->query('SET client_encoding="UTF-8"');
|
||||
}
|
||||
}
|
||||
if ($dsn['phptype'] == 'sqlite') {
|
||||
/*.Database.*/$connection = new static("{$dsn['phptype']}:{$dsn['database']}");
|
||||
$connection/*: Database*/ = new static("{$dsn['phptype']}:{$dsn['database']}");
|
||||
$connection->setAttribute(PDO::ATTR_TIMEOUT, 5);
|
||||
$mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL';
|
||||
$connection->query("PRAGMA journal_mode=$mode");
|
||||
|
|
@ -62,7 +62,7 @@ class Database extends PDO
|
|||
|
||||
public function executeQuery($query, $values=null)
|
||||
{
|
||||
/*.PDOStatement.*/$stmt = $this->prepare($query);
|
||||
$stmt/*: PDOStatement*/ = $this->prepare($query);
|
||||
|
||||
$stmt->execute($values);
|
||||
$stmt->cache = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
|
@ -80,7 +80,7 @@ class Database extends PDO
|
|||
*/
|
||||
public function fetchAllArray($query, $values = null)
|
||||
{
|
||||
/*.PDOStatement.*/$sth = $this->prepare($query);
|
||||
$sth/*: PDOStatement*/ = $this->prepare($query);
|
||||
$prep = $this->prepareValues($values);
|
||||
$sth->execute($prep);
|
||||
return $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
|
@ -91,7 +91,7 @@ class Database extends PDO
|
|||
*/
|
||||
public function fetchOneArray($query, $values = null)
|
||||
{
|
||||
/*.PDOStatement.*/$sth = $this->prepare($query);
|
||||
$sth/*: PDOStatement*/ = $this->prepare($query);
|
||||
$prep = $this->prepareValues($values);
|
||||
$sth->execute($prep);
|
||||
return $sth->fetch(PDO::FETCH_ASSOC);
|
||||
|
|
@ -182,7 +182,7 @@ class Database extends PDO
|
|||
}
|
||||
|
||||
function prepare($query, $options = NULL) {
|
||||
/*.PDOStatement.*/$result = parent::prepare($query);
|
||||
$result/*: PDOStatement*/ = parent::prepare($query);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue