@@ -71,12 +71,14 @@ public function free() {
71
71
public function query ($ str ,$ bind =array ()) {
72
72
$ this ->initConnect (false );
73
73
if ( !$ this ->_linkID ) return false ;
74
- $ this ->queryStr = $ str ;
75
74
//释放前次的查询结果
76
75
if ( $ this ->queryID ) $ this ->free ();
77
76
N ('db_query ' ,1 );
78
77
// 记录开始执行时间
79
78
G ('queryStartTime ' );
79
+ $ str = str_replace (array_keys ($ bind ),'? ' ,$ str );
80
+ $ bind = array_values ($ bind );
81
+ $ this ->queryStr = $ str ;
80
82
$ this ->queryID = sqlsrv_query ($ this ->_linkID ,$ str ,$ bind , array ( "Scrollable " => SQLSRV_CURSOR_KEYSET ));
81
83
$ this ->debug ();
82
84
if ( false === $ this ->queryID ) {
@@ -98,12 +100,14 @@ public function query($str,$bind=array()) {
98
100
public function execute ($ str ,$ bind =array ()) {
99
101
$ this ->initConnect (true );
100
102
if ( !$ this ->_linkID ) return false ;
101
- $ this ->queryStr = $ str ;
102
103
//释放前次的查询结果
103
104
if ( $ this ->queryID ) $ this ->free ();
104
105
N ('db_write ' ,1 );
105
106
// 记录开始执行时间
106
107
G ('queryStartTime ' );
108
+ $ str = str_replace (array_keys ($ bind ),'? ' ,$ str );
109
+ $ bind = array_values ($ bind );
110
+ $ this ->queryStr = $ str ;
107
111
$ this ->queryID = sqlsrv_query ($ this ->_linkID ,$ str ,$ bind );
108
112
$ this ->debug ();
109
113
if ( false === $ this ->queryID ) {
0 commit comments