From ebf89b721101fd0e1d4e1938713252e50d0bd612 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 16 Jun 2011 20:36:04 -0500 Subject: [PATCH] improve db class comments. --- system/db.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/system/db.php b/system/db.php index 987b60f3..283ca970 100644 --- a/system/db.php +++ b/system/db.php @@ -3,7 +3,7 @@ class DB { /** - * The active database connections. + * The established database connections. * * @var array */ @@ -25,6 +25,8 @@ public static function connection($connection = null) // --------------------------------------------------- // If we have already established this connection, // simply return the existing connection. + // + // Don't want to establish the same connection twice! // --------------------------------------------------- if ( ! array_key_exists($connection, static::$connections)) { @@ -35,9 +37,6 @@ public static function connection($connection = null) throw new \Exception("Database connection [$connection] is not defined."); } - // --------------------------------------------------- - // Establish the database connection. - // --------------------------------------------------- static::$connections[$connection] = DB\Connector::connect((object) $config[$connection]); } @@ -59,13 +58,13 @@ public static function query($sql, $bindings = array(), $connection = null) $result = $query->execute($bindings); // --------------------------------------------------- - // For SELECT statements, return the results in an - // array of stdClasses. + // For SELECT statements, the results will be returned + // as an array of stdClasses. // - // For UPDATE and DELETE statements, return the number - // or rows affected by the query. + // For UPDATE and DELETE statements, the number of + // rows affected by the query will be returned. // - // For everything else, return a boolean. + // For all other statements, return a boolean. // --------------------------------------------------- if (strpos(Str::upper($sql), 'SELECT') === 0) { @@ -84,6 +83,8 @@ public static function query($sql, $bindings = array(), $connection = null) /** * Begin a fluent query against a table. * + * This method is simply a convenient shortcut into Query::table. + * * @param string $table * @param string $connection * @return Query