php - ADOdb和预览准备好的语句(PHP)

根据: https : //adodb.org/dokuwiki/doku.php?id=v5 : userguide : portable_sql#prepare_execute

$stmt = $db->prepare("SELECT * FROM customers WHERE custid=? AND state=?");
$rs = $db->execute($stmt, array(999,'New York'));

首先,如何在不执行的情况下预览ADOdb准备的SQL? 即:

"SELECT * FROM customers WHERE custid=999 AND state='New York'"

此类提供了一个解决方案:

https://github.com/jasny/dbquery-mysql/blob/master/src/Jasny/DB/MySQL/QuerySplitter.php

$stmt = "SELECT * FROM customers WHERE custid=? AND state=?";
$params = array(999,'New York');

$split = new QuerySplitter;
$query = $split->bind($stmt , $params);
die($query);

//SELECT * FROM customers WHERE custid=99 AND state='New York'

转载请注明来自askonline.tech,本文标题:php - ADOdb和预览准备好的语句(PHP)


 Top