1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 05:37:39 +02:00

typos & whitespace

This commit is contained in:
David Grudl
2013-07-02 18:42:55 +02:00
parent 9e23730cb0
commit e87c112d71
55 changed files with 612 additions and 1299 deletions

View File

@@ -45,7 +45,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
private $fmtDate, $fmtDateTime;
/**
* @throws DibiNotSupportedException
*/
@@ -57,13 +56,12 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Connects to a database.
* @return void
* @throws DibiException
*/
public function connect(array &$config)
public function connect(array & $config)
{
$foo = & $config['charset'];
$this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
@@ -84,7 +82,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Disconnects from a database.
* @return void
@@ -95,7 +92,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Executes the SQL query.
* @param string SQL statement.
@@ -121,7 +117,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
* @return int|FALSE number of rows or FALSE on error
@@ -132,7 +127,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
* @return int|FALSE int on success or FALSE on failure
@@ -144,7 +138,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Begins a transaction (if supported).
* @param string optional savepoint name
@@ -156,7 +149,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Commits statements in a transaction.
* @param string optional savepoint name
@@ -173,7 +165,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Rollback changes in a transaction.
* @param string optional savepoint name
@@ -190,7 +181,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns the connection resource.
* @return mixed
@@ -201,7 +191,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns the connection reflector.
* @return IDibiReflector
@@ -212,7 +201,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Result set driver factory.
* @param resource
@@ -226,11 +214,9 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/********************* SQL ****************d*g**/
/**
* Encodes data for use in a SQL statement.
* @param mixed value
@@ -241,30 +227,29 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function escape($value, $type)
{
switch ($type) {
case dibi::TEXT:
case dibi::BINARY:
return "'" . str_replace("'", "''", $value) . "'"; // TODO: not tested
case dibi::TEXT:
case dibi::BINARY:
return "'" . str_replace("'", "''", $value) . "'"; // TODO: not tested
case dibi::IDENTIFIER:
// @see http://download.oracle.com/docs/cd/B10500_01/server.920/a96540/sql_elements9a.htm
return '"' . str_replace('"', '""', $value) . '"';
case dibi::IDENTIFIER:
// @see http://download.oracle.com/docs/cd/B10500_01/server.920/a96540/sql_elements9a.htm
return '"' . str_replace('"', '""', $value) . '"';
case dibi::BOOL:
return $value ? 1 : 0;
case dibi::BOOL:
return $value ? 1 : 0;
case dibi::DATE:
return $value instanceof DateTime ? $value->format($this->fmtDate) : date($this->fmtDate, $value);
case dibi::DATE:
return $value instanceof DateTime ? $value->format($this->fmtDate) : date($this->fmtDate, $value);
case dibi::DATETIME:
return $value instanceof DateTime ? $value->format($this->fmtDateTime) : date($this->fmtDateTime, $value);
case dibi::DATETIME:
return $value instanceof DateTime ? $value->format($this->fmtDateTime) : date($this->fmtDateTime, $value);
default:
throw new InvalidArgumentException('Unsupported type.');
default:
throw new InvalidArgumentException('Unsupported type.');
}
}
/**
* Encodes string for use in a LIKE statement.
* @param string
@@ -279,7 +264,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Decodes data from result set.
* @param string value
@@ -296,19 +280,17 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Injects LIMIT/OFFSET to the SQL query.
* @param string &$sql The SQL query that will be modified.
* @param int $limit
* @param int $offset
* @return void
*/
public function applyLimit(&$sql, $limit, $offset)
public function applyLimit(& $sql, $limit, $offset)
{
if ($offset > 0) {
// see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t ' . ($limit >= 0 ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '') . ') WHERE "__rnum" > '. (int) $offset;
$sql = 'SELECT * FROM (SELECT t.*, ROWNUM AS "__rnum" FROM (' . $sql . ') t '
. ($limit >= 0 ? 'WHERE ROWNUM <= ' . ((int) $offset + (int) $limit) : '')
. ') WHERE "__rnum" > '. (int) $offset;
} elseif ($limit >= 0) {
$sql = 'SELECT * FROM (' . $sql . ') WHERE ROWNUM <= ' . (int) $limit;
@@ -316,11 +298,9 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/********************* result set ****************d*g**/
/**
* Automatically frees the resources allocated for this result set.
* @return void
@@ -331,7 +311,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns the number of rows in a result set.
* @return int
@@ -342,7 +321,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Fetches the row at current position and moves the internal cursor to the next position.
* @param bool TRUE for associative array, FALSE for numeric
@@ -354,7 +332,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Moves cursor position without fetching row.
* @param int the 0-based cursor pos to seek to
@@ -366,7 +343,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Frees the resources allocated for this result set.
* @return void
@@ -378,7 +354,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns metadata for all columns in a result set.
* @return array
@@ -399,7 +374,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns the result set resource.
* @return mixed
@@ -411,11 +385,9 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/********************* IDibiReflector ****************d*g**/
/**
* Returns list of tables.
* @return array
@@ -436,7 +408,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns metadata for all columns in a table.
* @param string
@@ -448,7 +419,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns metadata for all indexes in a table.
* @param string
@@ -460,7 +430,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
}
/**
* Returns metadata for all foreign keys in a table.
* @param string