Explorar el Código

added PDO::fetchAll values to bind

Piotr Labudda hace 9 años
padre
commit
3620b23be9
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      SE/se-lib/Core/Pdo.php

+ 7 - 2
SE/se-lib/Core/Pdo.php

@@ -427,9 +427,14 @@ EOF_STRUCT_MYSQL;
 		return $sth->fetch();
 	}
 
-	public function fetchAll($sql) {
-		DBG::log($sql, 'sql');
+	public function fetchAll($sql, $values = []) {
 		$sth = $this->prepare($sql);
+		if (!empty($values)) {
+			$this->bindValues($sth, $values);
+			DBG::log($this->getRawSql($sth), 'sql');
+		} else {
+			DBG::log($sql, 'sql');
+		}
 		$sth->execute();
 		return $sth->fetchAll();
 	}