Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persistent connections working again #1295

Merged
merged 3 commits into from
Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Propel/Generator/Reverse/OracleSchemaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Propel\Generator\Model\Index;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Model\Table;
use Propel\Runtime\Connection\StatementInterface;

/**
* Oracle database schema parser.
Expand Down Expand Up @@ -229,11 +228,11 @@ protected function addForeignKeys(Table $table)
// local store to avoid duplicates
$foreignKeys = [];

/* @var StatementInterface $stmt */
/* @var \PDOStatement $stmt */
$stmt = $this->dbh->query("SELECT CONSTRAINT_NAME, DELETE_RULE, R_CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'R' AND TABLE_NAME = '" . $table->getName(). "'");
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
// Local reference
/* @var StatementInterface $stmt2 */
/* @var \PDOStatement $stmt2 */
$stmt2 = $this->dbh->query("SELECT COLUMN_NAME FROM USER_CONS_COLUMNS WHERE CONSTRAINT_NAME = '".$row['CONSTRAINT_NAME']."' AND TABLE_NAME = '" . $table->getName(). "'");
$localReferenceInfo = $stmt2->fetch(\PDO::FETCH_ASSOC);

Expand Down
3 changes: 1 addition & 2 deletions src/Propel/Generator/Util/QuickBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Propel\Runtime\Connection\PdoConnection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\ConnectionWrapper;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Propel;

class QuickBuilder
Expand Down Expand Up @@ -228,7 +227,7 @@ public function buildSQL(ConnectionInterface $con)
}
try {
$stmt = $con->prepare($statement);
if ($stmt instanceof StatementInterface) {
if ($stmt instanceof \PDOStatement) {
// only execute if has no error
$stmt->execute();
}
Expand Down
3 changes: 1 addition & 2 deletions src/Propel/Generator/Util/SqlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Propel\Generator\Util;

use \Propel\Runtime\Connection\ConnectionInterface;
use \Propel\Runtime\Connection\StatementInterface;

/**
* Service class for parsing a large SQL string into an array of SQL statements
Expand Down Expand Up @@ -93,7 +92,7 @@ protected static function executeStatements($statements, ConnectionInterface $co

foreach ($statements as $statement) {
$stmt = $connection->prepare($statement);
if ($stmt instanceof StatementInterface) {
if ($stmt instanceof \PDOStatement) {
// only execute if has no error
$stmt->execute();
$executed++;
Expand Down
13 changes: 6 additions & 7 deletions src/Propel/Runtime/Adapter/Pdo/MysqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Propel\Runtime\Adapter\SqlAdapterInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Map\ColumnMap;

/**
Expand Down Expand Up @@ -143,15 +142,15 @@ public function random($seed = null)
/**
* @see AdapterInterface::bindValue()
*
* @param StatementInterface $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
* @param \PDOStatement $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
*
* @return boolean
*/
public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
{
$pdoType = $cMap->getPdoType();
// FIXME - This is a temporary hack to get around apparent bugs w/ PDO+MYSQL
Expand Down
13 changes: 6 additions & 7 deletions src/Propel/Runtime/Adapter/Pdo/OracleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Propel\Runtime\Adapter\AdapterInterface;
use Propel\Runtime\Adapter\SqlAdapterInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Exception\InvalidArgumentException;
use Propel\Runtime\Map\ColumnMap;
use Propel\Generator\Model\PropelTypes;
Expand Down Expand Up @@ -207,15 +206,15 @@ public function turnSelectColumnsToAliases(Criteria $criteria)
/**
* @see AdapterInterface::bindValue()
*
* @param StatementInterface $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
* @param \PDOStatement $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
*
* @return boolean
*/
public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
{
if (PropelTypes::CLOB_EMU === $cMap->getType()) {
return $stmt->bindParam(':p'.$position, $value, $cMap->getPdoType(), strlen($value));
Expand Down
21 changes: 10 additions & 11 deletions src/Propel/Runtime/Adapter/Pdo/PdoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Propel\Runtime\Adapter\Exception\AdapterException;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\PdoConnection;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Exception\InvalidArgumentException;
use Propel\Runtime\Map\ColumnMap;
use Propel\Runtime\Map\DatabaseMap;
Expand Down Expand Up @@ -552,11 +551,11 @@ public function turnSelectColumnsToAliases(Criteria $criteria)
* $stmt->execute();
* </code>
*
* @param StatementInterface $stmt
* @param array $params array('column' => ..., 'table' => ..., 'value' => ...)
* @param DatabaseMap $dbMap
* @param \PDOStatement $stmt
* @param array $params array('column' => ..., 'table' => ..., 'value' => ...)
* @param DatabaseMap $dbMap
*/
public function bindValues(StatementInterface $stmt, array $params, DatabaseMap $dbMap)
public function bindValues(\PDOStatement $stmt, array $params, DatabaseMap $dbMap)
{
$position = 0;
foreach ($params as $param) {
Expand All @@ -582,15 +581,15 @@ public function bindValues(StatementInterface $stmt, array $params, DatabaseMap
* Binds a value to a positioned parameter in a statement,
* given a ColumnMap object to infer the binding type.
*
* @param StatementInterface $stmt The statement to bind
* @param string $parameter Parameter identifier
* @param mixed $value The value to bind
* @param ColumnMap $cMap The ColumnMap of the column to bind
* @param null|integer $position The position of the parameter to bind
* @param \PDOStatement $stmt The statement to bind
* @param string $parameter Parameter identifier
* @param mixed $value The value to bind
* @param ColumnMap $cMap The ColumnMap of the column to bind
* @param null|integer $position The position of the parameter to bind
*
* @return boolean
*/
public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
{
if ($cMap->isTemporal()) {
$value = $this->formatTemporalValue($value, $cMap);
Expand Down
101 changes: 0 additions & 101 deletions src/Propel/Runtime/Adapter/Pdo/PdoStatement.php

This file was deleted.

1 change: 1 addition & 0 deletions src/Propel/Runtime/Adapter/Pdo/PgsqlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Propel\Runtime\Adapter\Pdo;

use PDOStatement;
use Propel\Runtime\Adapter\AdapterInterface;
use Propel\Runtime\Adapter\SqlAdapterInterface;
use Propel\Runtime\Connection\ConnectionInterface;
Expand Down
13 changes: 6 additions & 7 deletions src/Propel/Runtime/Adapter/Pdo/SqlsrvAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Propel\Runtime\Adapter\SqlAdapterInterface;
use Propel\Runtime\Adapter\Exception\UnsupportedEncodingException;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Map\ColumnMap;
use Propel\Runtime\Map\DatabaseMap;
Expand Down Expand Up @@ -92,15 +91,15 @@ public function cleanupSQL(&$sql, array &$params, Criteria $values, DatabaseMap
/**
* @see AdapterInterface::bindValue()
*
* @param PDOStatement $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
* @param \PDOStatement $stmt
* @param string $parameter
* @param mixed $value
* @param ColumnMap $cMap
* @param null|integer $position
*
* @return boolean
*/
public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null)
{
if ($cMap->isTemporal()) {
$value = $this->formatTemporalValue($value, $cMap);
Expand Down
21 changes: 10 additions & 11 deletions src/Propel/Runtime/Adapter/SqlAdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Propel\Runtime\Adapter;

use Propel\Runtime\Connection\StatementInterface;
use Propel\Runtime\Map\ColumnMap;
use Propel\Runtime\Map\DatabaseMap;
use Propel\Runtime\ActiveQuery\Criteria;
Expand Down Expand Up @@ -113,23 +112,23 @@ public function turnSelectColumnsToAliases(Criteria $criteria);
* $stmt->execute();
* </code>
*
* @param StatementInterface $stmt
* @param array $params array('column' => ..., 'table' => ..., 'value' => ...)
* @param DatabaseMap $dbMap
* @param \PDOStatement $stmt
* @param array $params array('column' => ..., 'table' => ..., 'value' => ...)
* @param DatabaseMap $dbMap
*/
public function bindValues(StatementInterface $stmt, array $params, DatabaseMap $dbMap);
public function bindValues(\PDOStatement $stmt, array $params, DatabaseMap $dbMap);

/**
* Binds a value to a positioned parameter in a statement,
* given a ColumnMap object to infer the binding type.
*
* @param StatementInterface $stmt The statement to bind
* @param string $parameter Parameter identifier
* @param mixed $value The value to bind
* @param ColumnMap $cMap The ColumnMap of the column to bind
* @param null|integer $position The position of the parameter to bind
* @param \PDOStatement $stmt The statement to bind
* @param string $parameter Parameter identifier
* @param mixed $value The value to bind
* @param ColumnMap $cMap The ColumnMap of the column to bind
* @param null|integer $position The position of the parameter to bind
*
* @return boolean
*/
public function bindValue(StatementInterface $stmt, $parameter, $value, ColumnMap $cMap, $position = null);
public function bindValue(\PDOStatement $stmt, $parameter, $value, ColumnMap $cMap, $position = null);
}
5 changes: 3 additions & 2 deletions src/Propel/Runtime/Connection/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ public function exec($statement);
* database server.
* @param array $driver_options
*
* @return \Propel\Runtime\Connection\StatementInterface|bool A Statement object if the database server
* successfully prepares, FALSE otherwise.
* @return \PDOStatement|bool A Statement object if the database server
* successfully prepares, FALSE otherwise.

* @throws \Propel\Runtime\Connection\Exception\ConnectionException depending on error handling.
*/
public function prepare($statement, $driver_options = null);
Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Runtime/Connection/ConnectionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function setAttribute($attribute, $value)
* @param array $driver_options One $array or more key => value pairs to set attribute values
* for the PDOStatement object that this method returns.
*
* @return StatementInterface
* @return \PDOStatement
*/
public function prepare($statement, $driver_options = null)
{
Expand Down Expand Up @@ -424,7 +424,7 @@ public function exec($sql)
* @param string $statement The SQL statement to prepare and execute.
* Data inside the query should be properly escaped.
*
* @return StatementInterface
* @return \PDOStatement
*/
public function query($statement)
{
Expand Down
5 changes: 2 additions & 3 deletions src/Propel/Runtime/Connection/PdoConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Propel\Runtime\DataFetcher\PDODataFetcher;

/**
* PDO extension that implements ConnectionInterface and builds statements implementing StatementInterface.
* PDO extension that implements ConnectionInterface and builds \PDOStatement statements.
*/
class PdoConnection extends \PDO implements ConnectionInterface
{
Expand Down Expand Up @@ -58,7 +58,6 @@ public function __construct($dsn, $user = null, $password = null, array $options

parent::__construct($dsn, $user, $password, $pdoOptions);

$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, ['\Propel\Runtime\Adapter\Pdo\PdoStatement', []]);
$this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
}

Expand Down Expand Up @@ -146,7 +145,7 @@ public function lastInsertId($name = null)
*
* @param string $statement
* @param array $driver_options
* @return bool|\PDOStatement|StatementInterface|void
* @return bool|\PDOStatement|void
*/
public function prepare($statement, $driver_options = null)
{
Expand Down
Loading