|
@@ -24,10 +24,9 @@ class DbRawController
|
|
public function db(): JsonResponse
|
|
public function db(): JsonResponse
|
|
{
|
|
{
|
|
$statement = $this->connection->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
|
|
$statement = $this->connection->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
|
|
- $statement->execute([mt_rand(1, 10000)]);
|
|
|
|
- $world = $statement->fetch(FetchMode::ASSOCIATIVE);
|
|
|
|
|
|
+ $world = $statement->execute([mt_rand(1, 10000)]);
|
|
|
|
|
|
- return new JsonResponse($world);
|
|
|
|
|
|
+ return new JsonResponse($world->fetchAssociative());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -43,8 +42,8 @@ class DbRawController
|
|
|
|
|
|
$statement = $this->connection->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
|
|
$statement = $this->connection->prepare('SELECT id,randomNumber FROM World WHERE id = ?');
|
|
for ($i = 0; $i < $queries; ++$i) {
|
|
for ($i = 0; $i < $queries; ++$i) {
|
|
- $statement->execute([mt_rand(1, 10000)]);
|
|
|
|
- $worlds[] = $statement->fetch(FetchMode::ASSOCIATIVE);
|
|
|
|
|
|
+ $world = $statement->execute([mt_rand(1, 10000)]);
|
|
|
|
+ $worlds[] = $world->fetchAssociative();
|
|
}
|
|
}
|
|
|
|
|
|
return new JsonResponse($worlds);
|
|
return new JsonResponse($worlds);
|
|
@@ -65,8 +64,8 @@ class DbRawController
|
|
|
|
|
|
for ($i = 0; $i < $queries; ++$i) {
|
|
for ($i = 0; $i < $queries; ++$i) {
|
|
$id = mt_rand(1, 10000);
|
|
$id = mt_rand(1, 10000);
|
|
- $readStatement->execute([$id]);
|
|
|
|
- $world = $readStatement->fetch(FetchMode::ASSOCIATIVE);
|
|
|
|
|
|
+ $world = $readStatement->execute([$id]);
|
|
|
|
+ $world = $world->fetchAssociative();
|
|
$writeStatement->execute(
|
|
$writeStatement->execute(
|
|
[$world['randomNumber'] = mt_rand(1, 10000), $id]
|
|
[$world['randomNumber'] = mt_rand(1, 10000), $id]
|
|
);
|
|
);
|