- Fixed a bug occuring when a field was already escaped
This commit is contained in:
		
							parent
							
								
									1469d167c4
								
							
						
					
					
						commit
						4df9ececba
					
				| @ -193,7 +193,7 @@ class MsSQL implements AdapterInterface { | |||||||
|             case static::IDENTIFIER_DATABASE: |             case static::IDENTIFIER_DATABASE: | ||||||
|             case static::IDENTIFIER_TABLE: |             case static::IDENTIFIER_TABLE: | ||||||
|             case static::IDENTIFIER_FIELD: |             case static::IDENTIFIER_FIELD: | ||||||
|                 return "[" . str_replace(["[", "]"], [ "[[", "]]" ], $segment) . "]"; |                 return "[" . trim(str_replace(["[", "]"], [ "[[", "]]" ], $segment), '[]') . "]"; | ||||||
| 
 | 
 | ||||||
|             case static::IDENTIFIER_VALUE: |             case static::IDENTIFIER_VALUE: | ||||||
|                 return "'$segment'"; |                 return "'$segment'"; | ||||||
|  | |||||||
| @ -130,7 +130,7 @@ class MySQL implements AdapterInterface { | |||||||
|             case static::IDENTIFIER_DATABASE: |             case static::IDENTIFIER_DATABASE: | ||||||
|             case static::IDENTIFIER_TABLE: |             case static::IDENTIFIER_TABLE: | ||||||
|             case static::IDENTIFIER_FIELD: |             case static::IDENTIFIER_FIELD: | ||||||
|                 return "`" . str_replace("`", "``", $segment) . "`"; |                 return "`" . trim(str_replace("`", "``", $segment), '`') . "`"; | ||||||
| 
 | 
 | ||||||
|             case static::IDENTIFIER_VALUE: |             case static::IDENTIFIER_VALUE: | ||||||
|                 return "\"$segment\"";
 |                 return "\"$segment\"";
 | ||||||
|  | |||||||
| @ -79,12 +79,12 @@ class Repository | |||||||
|         return Ulmus::runSelectQuery($this->queryBuilder, $this->adapter)->fetchColumn(0); |         return Ulmus::runSelectQuery($this->queryBuilder, $this->adapter)->fetchColumn(0); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function deleteOne() |     protected function deleteOne() | ||||||
|     { |     { | ||||||
|         return $this->limit(1)->deleteSqlQuery()->runQuery(); |         return $this->limit(1)->deleteSqlQuery()->runQuery(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function deleteAll() |     protected function deleteAll() | ||||||
|     { |     { | ||||||
|         return $this->deleteSqlQuery()->runQuery(); |         return $this->deleteSqlQuery()->runQuery(); | ||||||
|     } |     } | ||||||
| @ -161,7 +161,6 @@ class Repository | |||||||
| 
 | 
 | ||||||
|                 $entity->entityFillFromDataset($dataset); |                 $entity->entityFillFromDataset($dataset); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|                 return $update ? (bool) $update->rowCount() : false; |                 return $update ? (bool) $update->rowCount() : false; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @ -726,7 +725,7 @@ class Repository | |||||||
| 
 | 
 | ||||||
|     public function escapeFieldList(array $fieldList) : array |     public function escapeFieldList(array $fieldList) : array | ||||||
|     { |     { | ||||||
|         foreach($fieldList as & $list) { |         foreach($fieldList as &$list) { | ||||||
|             $list['name'] = $this->escapeField($list['name']); |             $list['name'] = $this->escapeField($list['name']); | ||||||
| 
 | 
 | ||||||
|             $fieldTag = array_filter($list['tags'] ?? [], fn($item) => $item['object'] instanceof Field)[0]['object'] ?? null; |             $fieldTag = array_filter($list['tags'] ?? [], fn($item) => $item['object'] instanceof Field)[0]['object'] ?? null; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user