这是我的疑问:
$query = $db->prepare("
EXPLAIN SELECT transaction.id, transaction.dateCreated, transaction.dateUpdated, transaction.brandId, transaction.clientId, transaction.serviceId, transaction.currencyCode, transaction.type, transaction.token, transaction.amount, transaction.reason, transaction.referenceOrderId, transaction.serviceTransactionId, transaction.chainMode, transaction.bonusCode, transaction.codeId, transaction.codeMessage, su.name AS user_name, su.surname AS user_surname, b.name AS brand_name, su.email_address, su.player_id, sandbox, integrationId
FROM transaction_AstroPay transaction
LEFT JOIN tokens t ON transaction.token = t.token
LEFT JOIN sys_users su ON su.id=t.user_id
LEFT JOIN brands b ON b.api_brand_code = transaction.brandId
WHERE transaction.clientId = :clientId
");
$query->bindParam(':clientId',$clientId,PDO::PARAM_INT);
$query->execute();
$result = $query->fetchAll(PDO::FETCH_ASSOC);
执行良好的查询,并从数据库中提取数据。
我的问题是如何获得有关花费多少时间的详细信息。在mysqli
EXPLAIN SELECT
正在运作。
我们在mysqli
中收集了这样的信息:
$sql = 'EXPLAIN SELECT * FROM table WHERE condition = "condition"';
$result = $mysqli->query($sql);
$row = $result->fetch_array(MYSQLI_NUM);
echo $row[0];
我如何在PDO中执行此操作?