@@ -132,7 +132,9 @@ public function parse($query)
132132
133133 // Getting the action's parameters
134134 $ this ->parsedQuery ['parameters ' ] = explode (', ' , trim (str_replace ($ this ->parsedQuery ['action ' ], '' , $ queryParts [1 ]), ' () ' ));
135- $ this ->parsedQuery ['parameters ' ] = !empty ($ this ->parsedQuery ['parameters ' ][0 ]) ? $ this ->parsedQuery ['parameters ' ] : array ();
135+ $ this ->parsedQuery ['parameters ' ] = array_map (function ($ field ) {
136+ return trim ($ field , ' ' );
137+ }, (!empty ($ this ->parsedQuery ['parameters ' ][0 ]) ? $ this ->parsedQuery ['parameters ' ] : array ()));
136138
137139 // Parsing values for some actions
138140 if (in_array (strtolower ($ this ->parsedQuery ['action ' ]), array ('insert ' , 'replace ' ), TRUE )) {
@@ -203,7 +205,9 @@ public function parse($query)
203205 */
204206 private function _parseOrderExtension ($ clause )
205207 {
206- $ parsedClause = explode (', ' , $ clause );
208+ $ parsedClause = array_map (function ($ field ) {
209+ return trim ($ field , self ::TRIM_CHAR );
210+ }, explode (', ' , $ clause ));
207211 $ parsedClause = NULL !== $ parsedClause [0 ] ? $ parsedClause : array ();
208212 if (count ($ parsedClause ) === 0 ) {
209213 throw new Exception ("JSONDB Query Parse Error: At least one parameter expected for the \"order() \" extension. " );
@@ -315,7 +319,9 @@ private function _parseLimitExtension($clause)
315319 */
316320 private function _parseInExtension ($ clause )
317321 {
318- $ parsedClause = explode (', ' , $ clause );
322+ $ parsedClause = array_map (function ($ field ) {
323+ return trim ($ field , self ::TRIM_CHAR );
324+ }, explode (', ' , $ clause ));
319325 $ parsedClause = NULL !== $ parsedClause [0 ] ? $ parsedClause : array ();
320326 if (count ($ parsedClause ) === 0 ) {
321327 throw new Exception ("JSONDB Query Parse Error: At least one parameter expected for the \"in() \" extension. " );
@@ -349,7 +355,9 @@ private function _parseWithExtension($clause)
349355 */
350356 private function _parseAsExtension ($ clause )
351357 {
352- $ parsedClause = explode (', ' , $ clause );
358+ $ parsedClause = array_map (function ($ field ) {
359+ return trim ($ field , self ::TRIM_CHAR );
360+ }, explode (', ' , $ clause ));
353361 $ parsedClause = NULL !== $ parsedClause [0 ] ? $ parsedClause : array ();
354362 if (count ($ parsedClause ) === 0 ) {
355363 throw new Exception ("JSONDB Query Parse Error: At least one parameter expected for the \"as() \" extension. " );
@@ -366,7 +374,9 @@ private function _parseAsExtension($clause)
366374 */
367375 private function _parseGroupExtension ($ clause )
368376 {
369- $ parsedClause = explode (', ' , $ clause );
377+ $ parsedClause = array_map (function ($ field ) {
378+ return trim ($ field , self ::TRIM_CHAR );
379+ }, explode (', ' , $ clause ));
370380 $ parsedClause = NULL !== $ parsedClause [0 ] ? $ parsedClause : array ();
371381 if (count ($ parsedClause ) === 0 ) {
372382 throw new Exception ("JSONDB Query Parse Error: At least one parameter expected for the \"as() \" extension. " );
0 commit comments