我使用PDO
和sqlsrv
驅動程序。我想打印出所有通過__construct
初始化的連接查詢。PHP打印發送給MSSQL的所有查詢
我的設置如下;
public function __construct() {
try{
$this->connRead = new PDO("sqlsrv:server=" . DB_SERVER . "; Database =" . DB_NAME, DB_USER_READ, DB_PASSWORD_READ);
$this->connRead->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){ echo 'Connection failed: ' . $e->getMessage(); }
}
public function __destruct() { $this->connRead = null; $this->connWrite= null; }
然後我會提出一個請求/調用,
$sSQL = "SELECT foo FROM Table"
$st = $this->connRead->prepare($sSQL);
$st->execute();
在加載頁面我希望能夠打印使用$this->connRead
在純文本瀏覽器的所有查詢。是否有可能做到這一點?
可能的重複:http://stackoverflow.com/questions/5299669/how-to-see-query-history-in-sql-server-management-工作室 – feeela