Skip to content

Commit 816b876

Browse files
committed
Fix double query running in dbquery
1 parent 7504313 commit 816b876

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dholmes/bga-workbench",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"type": "library",
55
"description": "BoardGameArena Workbench",
66
"minimum-stability": "stable",

src/BGAWorkbench/Stubs/APP_DbObject.inc.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ class APP_DbObject extends APP_Object
1010

1111
/**
1212
* @param string $sql
13-
* @return a mysqli_result
13+
* @return mysqli_result
1414
*/
1515
public static function DbQuery($sql)
1616
{
17+
// Haven't yet found equivalent result type of mysqli->query via doctrine
1718
$conn = self::getDbConnection();
18-
self::$affectedRows = $conn->executeQuery($sql)->rowCount();
19+
//self::$affectedRows = $conn->executeQuery($sql)->rowCount();
1920
$host = $conn->getHost();
2021
if (!is_null($conn->getPort())) {
2122
$host .= ':' . $conn->getPort();
2223
}
23-
return (new mysqli($host, $conn->getUsername(), $conn->getPassword(), $conn->getDatabase()))->query($sql);
24+
$miConn = new mysqli($host, $conn->getUsername(), $conn->getPassword(), $conn->getDatabase());
25+
$result = $miConn->query($sql);
26+
self::$affectedRows = $miConn->affected_rows;
27+
return $result;
2428
}
2529

2630
/**

0 commit comments

Comments
 (0)