From 21c24340bc947e8ae07172e7ae599f306775d376 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 30 Oct 2008 08:57:50 +0000 Subject: - Patch #327460 by chx: some more documentation improvements. --- includes/database/database.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'includes/database/database.inc') diff --git a/includes/database/database.inc b/includes/database/database.inc index 7b66f2441..b44846aa2 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -156,7 +156,9 @@ abstract class DatabaseConnection extends PDO { protected $logger = NULL; function __construct($dsn, $username, $password, $driver_options = array()) { - $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; // Because the other methods don't seem to work right. + // Because the other methods don't seem to work right. + $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; + // Call PDO::__construct and PDO::setAttribute. parent::__construct($dsn, $username, $password, $driver_options); $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DatabaseStatement', array($this))); } @@ -273,6 +275,7 @@ abstract class DatabaseConnection extends PDO { static $statements = array(); $query = self::prefixTables($query); if (empty($statements[$query])) { + // Call PDO::prepare. $statements[$query] = parent::prepare($query); } return $statements[$query]; @@ -384,7 +387,8 @@ abstract class DatabaseConnection extends PDO { try { // We allow either a pre-bound statement object or a literal string. - // In either case, we want to end up with an executed statement object. + // In either case, we want to end up with an executed statement object, + // which we pass to PDOStatement::execute. if ($query instanceof DatabaseStatement) { $stmt = $query; $stmt->execute(NULL, $options); @@ -1306,6 +1310,7 @@ class DatabaseStatement extends PDOStatement { * A single field from the next record. */ public function fetchField($index = 0) { + // Call PDOStatement::fetchColumn to fetch the field. return $this->fetchColumn($index); } @@ -1320,6 +1325,7 @@ class DatabaseStatement extends PDOStatement { * An associative array. */ public function fetchAssoc() { + // Call PDOStatement::fetch to fetch the row. return $this->fetch(PDO::FETCH_ASSOC); } } -- cgit v1.2.3