Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Revert "Merge PHLAK:hotfix/gravatar-trim-strtolower into develop"
Browse files Browse the repository at this point in the history
This reverts commit c21cd36, reversing
changes made to 3138073.

I mistakingly fetched #4967 instead of #4976.
  • Loading branch information
EvanDotPro committed Aug 18, 2013
1 parent c21cd36 commit d7d4193
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 106 deletions.
94 changes: 19 additions & 75 deletions library/Zend/Db/Adapter/Driver/Sqlsrv/Statement.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Zend Framework (http://framework.zend.com/)
*
Expand Down Expand Up @@ -64,12 +63,6 @@ class Statement implements StatementInterface, Profiler\ProfilerAwareInterface
*/
protected $isPrepared = false;

/**
*
* @var array
*/
protected $options = array();

/**
* Set driver
*
Expand Down Expand Up @@ -188,7 +181,7 @@ public function getSql()
}

/**
* @param string $sql
* @param string $sql
* @throws Exception\RuntimeException
* @return Statement
*/
Expand All @@ -200,11 +193,13 @@ public function prepare($sql = null)
$sql = ($sql) ?: $this->sql;

$pRef = &$this->parameterReferences;
for ($position = 0, $count = substr_count($sql, '?'); $position < $count; $position++) {
$pRef[$position] = array('', SQLSRV_PARAM_IN, null, null);
}

$this->resource = sqlsrv_prepare($this->sqlsrv, $sql, $pRef, $this->options);
$this->resource = sqlsrv_prepare($this->sqlsrv, $sql, $pRef);

$this->isPrepared = true;

return $this;
}

Expand All @@ -225,6 +220,9 @@ public function isPrepared()
*/
public function execute($parameters = null)
{
if (!$this->isPrepared) {
$this->prepare();
}

/** START Standard ParameterContainer Merging Block */
if (!$this->parameterContainer instanceof ParameterContainer) {
Expand All @@ -244,9 +242,6 @@ public function execute($parameters = null)
$this->bindParametersFromContainer();
}
/** END Standard ParameterContainer Merging Block */
if (!$this->isPrepared) {
$this->prepare();
}

if ($this->profiler) {
$this->profiler->profilerStart($this);
Expand Down Expand Up @@ -276,70 +271,19 @@ public function execute($parameters = null)
*/
protected function bindParametersFromContainer()
{
$parameters = $this->parameterContainer->getNamedArray();

$values = $this->parameterContainer->getPositionalArray();
$position = 0;
foreach ($parameters as $key => &$value) {
if ($this->parameterContainer->offsetHasErrata($key)) {
$errata = $this->parameterContainer->offsetGetErrata($key);
switch ($errata) {
case ParameterContainer::TYPE_BINARY:
$params = array();
$params[] = $value;
$params[] = \SQLSRV_PARAM_IN;
$params[] = \SQLSRV_PHPTYPE_STREAM(\SQLSRV_ENC_BINARY);
$params[] = \SQLSRV_SQLTYPE_VARBINARY('max');
$this->parameterReferences[$position++] = $params;
break;
default:
$params = array($value, \SQLSRV_PARAM_IN, null, null);
$this->parameterReferences[$position++] = $params;
}
} elseif (is_array($value)) {
$this->parameterReferences[$position++] = $value;
} else {
$params = array($value, \SQLSRV_PARAM_IN, null, null);
$this->parameterReferences[$position++] = $params;
}
foreach ($values as $value) {
$this->parameterReferences[$position++][0] = $value;
}
}

public function setQueryTimeout($queryTimeout)
{
if (is_int($queryTimeout)) {
$this->options['QueryTimeout'] = $queryTimeout;
} else {
$message = 'Invalid argument provided to ';
$message.= __METHOD__ . ' method in class ' . __CLASS__;
throw new Exception\InvalidArgumentException($message);
}
// @todo bind errata
//foreach ($this->parameterContainer as $name => &$value) {
// $p[$position][0] = $value;
// $position++;
// if ($this->parameterContainer->offsetHasErrata($name)) {
// $p[$position][3] = $this->parameterContainer->offsetGetErrata($name);
// }
//}
}

public function setSendStreamParamsAtExec($sendStreamParamsAtExec)
{
if (is_bool($sendStreamParamsAtExec)) {
$this->options['SendStreamParamsAtExec'] = $sendStreamParamsAtExec;
} else {
$message = 'Invalid argument provided to ';
$message.= __METHOD__ . ' method in class ' . __CLASS__;
throw new Exception\InvalidArgumentException($message);
}
}

public function setScrollable($scrollable)
{
switch ($scrollable) {
case \SQLSRV_CURSOR_FORWARD:
case \SQLSRV_CURSOR_STATIC:
case \SQLSRV_CURSOR_DYNAMIC:
case \SQLSRV_CURSOR_KEYSET:
$this->options['Scrollable'] = $scrollable;
break;
default:
$message = 'Invalid argument provided to ';
$message.= __METHOD__ . ' method in class ' . __CLASS__;
throw new Exception\InvalidArgumentException($message);
}
}

}
4 changes: 0 additions & 4 deletions library/Zend/Db/TableGateway/AbstractTableGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ protected function executeSelect(Select $select)

// prepare and execute
$statement = $this->sql->prepareStatementForSqlObject($select);
$this->featureSet->apply('preSelectExecute', array($statement));
$result = $statement->execute();

// build result set
Expand Down Expand Up @@ -289,7 +288,6 @@ protected function executeInsert(Insert $insert)
$this->featureSet->apply('preInsert', array($insert));

$statement = $this->sql->prepareStatementForSqlObject($insert);
$this->featureSet->apply('preInsertExecute', array($statement));
$result = $statement->execute();
$this->lastInsertValue = $this->adapter->getDriver()->getConnection()->getLastGeneratedValue();

Expand Down Expand Up @@ -350,7 +348,6 @@ protected function executeUpdate(Update $update)
$this->featureSet->apply('preUpdate', array($update));

$statement = $this->sql->prepareStatementForSqlObject($update);
$this->featureSet->apply('preUpdateExecute', array($statement));
$result = $statement->execute();

// apply postUpdate features
Expand Down Expand Up @@ -407,7 +404,6 @@ protected function executeDelete(Delete $delete)
$this->featureSet->apply('preDelete', array($delete));

$statement = $this->sql->prepareStatementForSqlObject($delete);
$this->featureSet->apply('preDeleteExecute', array($statement));
$result = $statement->execute();

// apply postDelete features
Expand Down
27 changes: 0 additions & 27 deletions library/Zend/Db/TableGateway/Feature/StatementOptionsFeature.php

This file was deleted.

0 comments on commit d7d4193

Please sign in to comment.