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

ADOdb and Previewing Prepared Statements (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'"

这个class提供了一个解决方案:

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'