@@ -21,11 +21,6 @@ class Statement
2121 */
2222 protected $ yql ;
2323
24- /**
25- * @var string
26- */
27- protected $ query_id ;
28-
2924 /**
3025 * @var string
3126 */
@@ -67,7 +62,7 @@ public function __construct(Session $session, $yql)
6762 public function execute (array $ parameters = [])
6863 {
6964 $ q = new Query ([
70- 'id ' => $ this ->query_id ,
65+ 'yql_text ' => $ this ->yql ,
7166 ]);
7267
7368 return $ this ->session ->query ($ q , $ this ->prepareParameters ($ parameters ));
@@ -81,23 +76,6 @@ public function isCached()
8176 return $ this ->cached ;
8277 }
8378
84- /**
85- * @return string
86- */
87- public function getQueryId ()
88- {
89- return $ this ->query_id ;
90- }
91-
92- /**
93- * @param string $query_id
94- */
95- public function saveQueryId ($ query_id )
96- {
97- $ this ->query_id = $ query_id ;
98- static ::$ qcache [$ this ->qhash ] = $ this ->query_id ;
99- }
100-
10179 /**
10280 * @param array $parameters
10381 * @return array
@@ -132,9 +110,8 @@ protected function prepareParameters($parameters)
132110 */
133111 protected function checkQueryCache ()
134112 {
135- $ this ->qhash = sha1 ($ this ->session ->id () . '~ ' . trim ($ this ->yql ));
136- $ this ->query_id = static ::$ qcache [$ this ->qhash ] ?? null ;
137- if ($ this ->query_id )
113+ $ this ->qhash = sha1 (trim ($ this ->yql ));
114+ if (in_array ($ this ->qhash , static ::$ qcache ))
138115 {
139116 $ this ->cached = true ;
140117 }
@@ -154,4 +131,8 @@ protected function detectParams()
154131 }
155132 }
156133 }
134+
135+ public function saveInCache (){
136+ static ::$ qcache [$ this ->qhash ] = $ this ->qhash ;
137+ }
157138}
0 commit comments