mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 22:26:43 +02:00
typos & whitespace
This commit is contained in:
@@ -2,15 +2,10 @@
|
||||
|
||||
/**
|
||||
* This file is part of the "dibi" - smart database abstraction layer.
|
||||
*
|
||||
* Copyright (c) 2005 David Grudl (http://davidgrudl.com)
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the file license.txt that was distributed with this source code.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* dibi connection.
|
||||
*
|
||||
@@ -45,7 +40,6 @@ class DibiConnection extends DibiObject
|
||||
private $substitutes;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connection options: (see driver-specific options too)
|
||||
* - lazy (bool) => if TRUE, connection will be established only when required
|
||||
@@ -139,7 +133,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Automatically frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -151,7 +144,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connects to a database.
|
||||
* @return void
|
||||
@@ -171,7 +163,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
* @return void
|
||||
@@ -183,7 +174,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns TRUE when connection was established.
|
||||
* @return bool
|
||||
@@ -194,7 +184,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns configuration variable. If no $key is passed, returns the entire array.
|
||||
* @see self::__construct
|
||||
@@ -216,7 +205,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Apply configuration alias or default values.
|
||||
* @param array connect configuration
|
||||
@@ -224,10 +212,12 @@ class DibiConnection extends DibiObject
|
||||
* @param string alias key
|
||||
* @return void
|
||||
*/
|
||||
public static function alias(&$config, $key, $alias)
|
||||
public static function alias(& $config, $key, $alias)
|
||||
{
|
||||
$foo = & $config;
|
||||
foreach (explode('|', $key) as $key) $foo = & $foo[$key];
|
||||
foreach (explode('|', $key) as $key) {
|
||||
$foo = & $foo[$key];
|
||||
}
|
||||
|
||||
if (!isset($foo) && isset($config[$alias])) {
|
||||
$foo = $config[$alias];
|
||||
@@ -236,7 +226,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the driver and connects to a database in lazy mode.
|
||||
* @return IDibiDriver
|
||||
@@ -248,7 +237,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates (translates) and executes SQL query.
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -262,7 +250,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates SQL query.
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -276,7 +263,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates and prints SQL query.
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -300,7 +286,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates (translates) and returns SQL query as DibiDataSource.
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -314,7 +299,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates SQL query.
|
||||
* @param array
|
||||
@@ -327,7 +311,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes the SQL query.
|
||||
* @param string SQL statement.
|
||||
@@ -359,7 +342,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||
* @return int number of rows
|
||||
@@ -369,12 +351,13 @@ class DibiConnection extends DibiObject
|
||||
{
|
||||
$this->connected || $this->connect();
|
||||
$rows = $this->driver->getAffectedRows();
|
||||
if (!is_int($rows) || $rows < 0) throw new DibiException('Cannot retrieve number of affected rows.');
|
||||
if (!is_int($rows) || $rows < 0) {
|
||||
throw new DibiException('Cannot retrieve number of affected rows.');
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows. Alias for getAffectedRows().
|
||||
* @return int number of rows
|
||||
@@ -386,7 +369,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
* @param string optional sequence name
|
||||
@@ -397,12 +379,13 @@ class DibiConnection extends DibiObject
|
||||
{
|
||||
$this->connected || $this->connect();
|
||||
$id = $this->driver->getInsertId($sequence);
|
||||
if ($id < 1) throw new DibiException('Cannot retrieve last generated ID.');
|
||||
if ($id < 1) {
|
||||
throw new DibiException('Cannot retrieve last generated ID.');
|
||||
}
|
||||
return (int) $id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column. Alias for getInsertId().
|
||||
* @param string optional sequence name
|
||||
@@ -415,7 +398,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
* @param string optional savepoint name
|
||||
@@ -436,7 +418,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Commits statements in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -457,7 +438,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rollback changes in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -478,7 +458,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Result set factory.
|
||||
* @param IDibiResultDriver
|
||||
@@ -492,11 +471,9 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* fluent SQL builders ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return DibiFluent
|
||||
*/
|
||||
@@ -506,7 +483,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string column name
|
||||
* @return DibiFluent
|
||||
@@ -518,7 +494,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string table
|
||||
* @param array
|
||||
@@ -533,7 +508,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string table
|
||||
* @param array
|
||||
@@ -551,7 +525,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string table
|
||||
* @return DibiFluent
|
||||
@@ -562,11 +535,9 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* substitutions ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns substitution hashmap.
|
||||
* @return DibiHashMap
|
||||
@@ -577,7 +548,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Provides substitution.
|
||||
* @return string
|
||||
@@ -588,7 +558,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Substitution callback.
|
||||
*/
|
||||
@@ -598,11 +567,9 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* shortcuts ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes SQL query and fetch result - shortcut for query() & fetch().
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -616,11 +583,10 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes SQL query and fetch results - shortcut for query() & fetchAll().
|
||||
* @param array|mixed one or more arguments
|
||||
* @return array of DibiRow
|
||||
* @return DibiRow[]
|
||||
* @throws DibiException
|
||||
*/
|
||||
public function fetchAll($args)
|
||||
@@ -630,7 +596,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes SQL query and fetch first column - shortcut for query() & fetchSingle().
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -644,7 +609,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes SQL query and fetch pairs - shortcut for query() & fetchPairs().
|
||||
* @param array|mixed one or more arguments
|
||||
@@ -658,11 +622,9 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* misc ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Import SQL dump from file - extreme fast!
|
||||
* @param string filename
|
||||
@@ -698,7 +660,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information about the current database.
|
||||
* @return DibiDatabaseInfo
|
||||
@@ -710,7 +671,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prevents unserialization.
|
||||
*/
|
||||
@@ -720,7 +680,6 @@ class DibiConnection extends DibiObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prevents serialization.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user