浏览代码

added PDO::

Piotr Labudda 8 年之前
父节点
当前提交
daeaa1ae80
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      SE/se-lib/Core/Pdo.php

+ 6 - 0
SE/se-lib/Core/Pdo.php

@@ -433,6 +433,12 @@ EOF_STRUCT_MYSQL;
 		return $sth->fetchColumn();
 	}
 
+	public function fetchValuesList($sql, $values = []) { // for sql like `select ID from ...` @returns array of ID
+		return array_map(function ($row) {
+			return reset($row);
+		}, $this->fetchAll($sql, $values));
+	}
+
 	public function fetchFirst($sql, $values = []) { // fetch only first row
 		$sth = $this->prepare($sql);
 		if (!empty($values)) {