File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,11 @@ public function connect() {
8181 public function queryAndFetchAll ( $ queryStr ) {
8282 try {
8383 $ sleeper = new \ThriftSQL \Utils \Sleeper ();
84+ $ queryCleaner = new \ThriftSQL \Utils \QueryCleaner ();
8485
8586 $ TExecuteStatementResp = $ this ->_client ->ExecuteStatement ( new \ThriftSQL \TExecuteStatementReq ( array (
8687 'sessionHandle ' => $ this ->_sessionHandle ,
87- 'statement ' => $ queryStr ,
88+ 'statement ' => $ queryCleaner -> clean ( $ queryStr ) ,
8889 'runAsync ' => true ,
8990 ) ) );
9091
Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ public function connect() {
5353 public function queryAndFetchAll ( $ queryStr ) {
5454 try {
5555 $ sleeper = new \ThriftSQL \Utils \Sleeper ();
56+ $ queryCleaner = new \ThriftSQL \Utils \QueryCleaner ();
5657
5758 $ QueryHandle = $ this ->_client ->query ( new \ThriftSQL \Query ( array (
58- 'query ' => $ queryStr ,
59+ 'query ' => $ queryCleaner -> clean ( $ queryStr ) ,
5960 ) ) );
6061
6162 // Wait for results
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace ThriftSQL \Utils ;
3+
4+ /**
5+ * Util to clean up queries; e.g. remove trailing `;`.
6+ */
7+
8+ class QueryCleaner {
9+
10+ public function clean ( $ queryStr ) {
11+ // Very simplistic
12+ return trim ( $ queryStr , "; \t\n\r\0\x0B" );
13+ }
14+
15+ }
Original file line number Diff line number Diff line change 192192 'ThriftSQL\TTypeQualifiers ' => __DIR__ . '/Packages/TCLIService/Types.php ' ,
193193 'ThriftSQL\TUnionTypeEntry ' => __DIR__ . '/Packages/TCLIService/Types.php ' ,
194194 'ThriftSQL\TUserDefinedTypeEntry ' => __DIR__ . '/Packages/TCLIService/Types.php ' ,
195+ 'ThriftSQL\Utils\QueryCleaner ' => __DIR__ . '/ThriftSQL/Utils/QueryCleaner.php ' ,
195196 'ThriftSQL\Utils\Sleeper ' => __DIR__ . '/ThriftSQL/Utils/Sleeper.php ' ,
196197 'Thrift\Base\TBase ' => __DIR__ . '/Thrift/Base/TBase.php ' ,
197198 'Thrift\ClassLoader\ThriftClassLoader ' => __DIR__ . '/Thrift/ClassLoader/ThriftClassLoader.php ' ,
You can’t perform that action at this time.
0 commit comments