1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-18 11:51:18 +02:00

typos & whitespace

This commit is contained in:
David Grudl
2013-12-30 23:19:42 +01:00
parent 6f99db544f
commit 8112fe10d0
51 changed files with 592 additions and 1412 deletions

View File

@@ -4,9 +4,6 @@
* dibi - smart database abstraction layer (http://dibiphp.com)
*
* Copyright (c) 2005, 2012 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.
*/
@@ -43,9 +40,6 @@ if (interface_exists('Nette\Diagnostics\IBarPanel') || interface_exists('IBarPan
}
/**
* Interface for database drivers.
*
@@ -112,7 +106,6 @@ class dibi
public static $defaultDriver = 'mysql';
/**
* Static class - cannot be instantiated.
*/
@@ -122,11 +115,9 @@ class dibi
}
/********************* connections handling ****************d*g**/
/**
* Creates a new DibiConnection object and connects it to specified database.
* @param mixed connection parameters
@@ -140,7 +131,6 @@ class dibi
}
/**
* Disconnects from database (doesn't destroy DibiConnection object).
* @return void
@@ -151,7 +141,6 @@ class dibi
}
/**
* Returns TRUE when connection was established.
* @return bool
@@ -162,7 +151,6 @@ class dibi
}
/**
* Retrieve active connection.
* @param string connection registy name
@@ -187,7 +175,6 @@ class dibi
}
/**
* Sets connection.
* @param DibiConnection
@@ -199,7 +186,6 @@ class dibi
}
/**
* Change active connection.
* @param string connection registy name
@@ -212,11 +198,9 @@ class dibi
}
/********************* monostate for active connection ****************d*g**/
/**
* Generates and executes SQL query - Monostate for DibiConnection::query().
* @param array|mixed one or more arguments
@@ -230,7 +214,6 @@ class dibi
}
/**
* Executes the SQL query - Monostate for DibiConnection::nativeQuery().
* @param string SQL statement.
@@ -242,7 +225,6 @@ class dibi
}
/**
* Generates and prints SQL query - Monostate for DibiConnection::test().
* @param array|mixed one or more arguments
@@ -255,7 +237,6 @@ class dibi
}
/**
* Generates and returns SQL query as DibiDataSource - Monostate for DibiConnection::test().
* @param array|mixed one or more arguments
@@ -268,7 +249,6 @@ class dibi
}
/**
* Executes SQL query and fetch result - Monostate for DibiConnection::query() & fetch().
* @param array|mixed one or more arguments
@@ -282,11 +262,10 @@ class dibi
}
/**
* Executes SQL query and fetch results - Monostate for DibiConnection::query() & fetchAll().
* @param array|mixed one or more arguments
* @return array of DibiRow
* @return DibiRow[]
* @throws DibiException
*/
public static function fetchAll($args)
@@ -296,7 +275,6 @@ class dibi
}
/**
* Executes SQL query and fetch first column - Monostate for DibiConnection::query() & fetchSingle().
* @param array|mixed one or more arguments
@@ -310,7 +288,6 @@ class dibi
}
/**
* Executes SQL query and fetch pairs - Monostate for DibiConnection::query() & fetchPairs().
* @param array|mixed one or more arguments
@@ -324,7 +301,6 @@ class dibi
}
/**
* Gets the number of affected rows.
* Monostate for DibiConnection::getAffectedRows()
@@ -337,7 +313,6 @@ class dibi
}
/**
* Gets the number of affected rows. Alias for getAffectedRows().
* @return int number of rows
@@ -349,7 +324,6 @@ class dibi
}
/**
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* Monostate for DibiConnection::getInsertId()
@@ -363,7 +337,6 @@ class dibi
}
/**
* Retrieves the ID generated for an AUTO_INCREMENT column. Alias for getInsertId().
* @param string optional sequence name
@@ -376,7 +349,6 @@ class dibi
}
/**
* Begins a transaction - Monostate for DibiConnection::begin().
* @param string optional savepoint name
@@ -389,7 +361,6 @@ class dibi
}
/**
* Commits statements in a transaction - Monostate for DibiConnection::commit($savepoint = NULL).
* @param string optional savepoint name
@@ -402,7 +373,6 @@ class dibi
}
/**
* Rollback changes in a transaction - Monostate for DibiConnection::rollback().
* @param string optional savepoint name
@@ -415,7 +385,6 @@ class dibi
}
/**
* Gets a information about the current database - Monostate for DibiConnection::getDatabaseInfo().
* @return DibiDatabaseInfo
@@ -426,7 +395,6 @@ class dibi
}
/**
* Import SQL dump from file - extreme fast!
* @param string filename
@@ -438,24 +406,21 @@ class dibi
}
/**
* Replacement for majority of dibi::methods() in future.
*/
public static function __callStatic($name, $args)
{
//if ($name = 'select', 'update', ...') {
// return self::command()->$name($args);
// return self::command()->$name($args);
//}
return call_user_func_array(array(self::getConnection(), $name), $args);
}
/********************* fluent SQL builders ****************d*g**/
/**
* @return DibiFluent
*/
@@ -465,7 +430,6 @@ class dibi
}
/**
* @param string column name
* @return DibiFluent
@@ -477,7 +441,6 @@ class dibi
}
/**
* @param string table
* @param array
@@ -489,7 +452,6 @@ class dibi
}
/**
* @param string table
* @param array
@@ -501,7 +463,6 @@ class dibi
}
/**
* @param string table
* @return DibiFluent
@@ -512,13 +473,11 @@ class dibi
}
/********************* data types ****************d*g**/
/**
* @return DibiDateTime
* @deprecated
*/
public static function datetime($time = NULL)
{
@@ -527,7 +486,6 @@ class dibi
}
/**
* @deprecated
*/
@@ -538,11 +496,9 @@ class dibi
}
/********************* substitutions ****************d*g**/
/**
* Returns substitution hashmap - Monostate for DibiConnection::getSubstitutes().
* @return DibiHashMap
@@ -553,7 +509,6 @@ class dibi
}
/** @deprecated */
public static function addSubst($expr, $subst)
{
@@ -562,7 +517,6 @@ class dibi
}
/** @deprecated */
public static function removeSubst($expr)
{
@@ -578,7 +532,6 @@ class dibi
}
/** @deprecated */
public static function setSubstFallback($callback)
{
@@ -587,11 +540,9 @@ class dibi
}
/********************* misc tools ****************d*g**/
/**
* Prints out a syntax highlighted version of the SQL command or DibiResult.
* @param string|DibiResult
@@ -605,7 +556,9 @@ class dibi
$sql->dump();
} else {
if ($sql === NULL) $sql = self::$sql;
if ($sql === NULL) {
$sql = self::$sql;
}
static $keywords1 = 'SELECT|(?:ON\s+DUPLICATE\s+KEY)?UPDATE|INSERT(?:\s+INTO)?|REPLACE(?:\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|LIMIT|OFFSET|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN|TRUNCATE';
static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|RLIKE|REGEXP|TRUE|FALSE';
@@ -638,20 +591,20 @@ class dibi
}
private static function highlightCallback($matches)
{
if (!empty($matches[1])) // comment
if (!empty($matches[1])) { // comment
return '<em style="color:gray">' . $matches[1] . '</em>';
if (!empty($matches[2])) // error
} elseif (!empty($matches[2])) { // error
return '<strong style="color:red">' . $matches[2] . '</strong>';
if (!empty($matches[3])) // most important keywords
} elseif (!empty($matches[3])) { // most important keywords
return '<strong style="color:blue">' . $matches[3] . '</strong>';
if (!empty($matches[4])) // other keywords
} elseif (!empty($matches[4])) { // other keywords
return '<strong style="color:green">' . $matches[4] . '</strong>';
}
}
}