Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 7, 2017
1 parent 81c1078 commit 0ec1522
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Connection implements ConnectionInterface
protected $transactions = 0;

/**
* Have there been changes to the database.
* Indicates if changes have been made to the database.
*
* @var int
*/
Expand Down Expand Up @@ -399,19 +399,6 @@ protected function getPdoForSelect($useReadPdo = true)
return $useReadPdo ? $this->getReadPdo() : $this->getPdo();
}

/**
* Set if any records have been modified.
*
* @param bool $changes
* @return void
*/
public function setRecordsModified($changes = true)
{
if (! $this->recordsModified) {
$this->recordsModified = $changes;
}
}

/**
* Run an insert statement against the database.
*
Expand Down Expand Up @@ -466,7 +453,7 @@ public function statement($query, $bindings = [])

$this->bindValues($statement, $this->prepareBindings($bindings));

$this->setRecordsModified();
$this->recordsHaveBeenModified();

return $statement->execute();
});
Expand Down Expand Up @@ -495,7 +482,7 @@ public function affectingStatement($query, $bindings = [])

$statement->execute();

$this->setRecordsModified($statement->rowCount() > 0);
$this->recordsHaveBeenModified($statement->rowCount() > 0);

return $statement->rowCount();
});
Expand All @@ -514,9 +501,9 @@ public function unprepared($query)
return true;
}

$change = ($this->getPdo()->exec($query) === false ? false : true);

$this->setRecordsModified($change);
$this->recordsHaveBeenModified(
$change = ($this->getPdo()->exec($query) === false ? false : true)
);

return $change;
});
Expand Down Expand Up @@ -848,6 +835,19 @@ public function raw($value)
return new Expression($value);
}

/**
* Indicate if any records have been modified.
*
* @param bool $value
* @return void
*/
public function recordsHaveBeenModified($value = true)
{
if (! $this->recordsModified) {
$this->recordsModified = $value;
}
}

/**
* Is Doctrine available?
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PostgresProcessor extends Processor
*/
public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
{
$result = $query->getConnection()->select($sql, $values)[0];
$result = $query->getConnection()->selectFromWriteConnection($sql, $values)[0];

$sequence = $sequence ?: 'id';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu
*/
protected function processInsertGetIdForOdbc(Connection $connection)
{
$result = $connection->select(
$result = $connection->selectFromWriteConnection(
'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid'
);

Expand Down

0 comments on commit 0ec1522

Please sign in to comment.