Skip to content

Commit

Permalink
Fix double query running in dbquery
Browse files Browse the repository at this point in the history
  • Loading branch information
danielholmes committed Mar 19, 2018
1 parent 7504313 commit 816b876
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dholmes/bga-workbench",
"version": "0.1.1",
"version": "0.1.2",
"type": "library",
"description": "BoardGameArena Workbench",
"minimum-stability": "stable",
Expand Down
10 changes: 7 additions & 3 deletions src/BGAWorkbench/Stubs/APP_DbObject.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ class APP_DbObject extends APP_Object

/**
* @param string $sql
* @return a mysqli_result
* @return mysqli_result
*/
public static function DbQuery($sql)
{
// Haven't yet found equivalent result type of mysqli->query via doctrine
$conn = self::getDbConnection();
self::$affectedRows = $conn->executeQuery($sql)->rowCount();
//self::$affectedRows = $conn->executeQuery($sql)->rowCount();
$host = $conn->getHost();
if (!is_null($conn->getPort())) {
$host .= ':' . $conn->getPort();
}
return (new mysqli($host, $conn->getUsername(), $conn->getPassword(), $conn->getDatabase()))->query($sql);
$miConn = new mysqli($host, $conn->getUsername(), $conn->getPassword(), $conn->getDatabase());
$result = $miConn->query($sql);
self::$affectedRows = $miConn->affected_rows;
return $result;
}

/**
Expand Down

0 comments on commit 816b876

Please sign in to comment.