mirror of
https://github.com/dg/dibi.git
synced 2025-08-08 07:06:52 +02:00
typos & whitespace
This commit is contained in:
@@ -2,11 +2,7 @@
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -46,7 +42,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
private $dbcharset, $charset;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @throws DibiNotSupportedException
|
||||
*/
|
||||
@@ -58,13 +53,12 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connects to a database.
|
||||
* @return void
|
||||
* @throws DibiException
|
||||
*/
|
||||
public function connect(array &$config)
|
||||
public function connect(array & $config)
|
||||
{
|
||||
DibiConnection::alias($config, 'database', 'file');
|
||||
$this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
|
||||
@@ -93,7 +87,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
* @return void
|
||||
@@ -104,7 +97,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes the SQL query.
|
||||
* @param string SQL statement.
|
||||
@@ -127,7 +119,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||
* @return int|FALSE number of rows or FALSE on error
|
||||
@@ -138,7 +129,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
* @return int|FALSE int on success or FALSE on failure
|
||||
@@ -149,7 +139,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
* @param string optional savepoint name
|
||||
@@ -162,7 +151,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Commits statements in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -175,7 +163,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rollback changes in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -188,7 +175,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
@@ -199,7 +185,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection reflector.
|
||||
* @return IDibiReflector
|
||||
@@ -210,7 +195,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Result set driver factory.
|
||||
* @param SQLite3Result
|
||||
@@ -224,11 +208,9 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in a SQL statement.
|
||||
* @param mixed value
|
||||
@@ -239,31 +221,30 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
public function escape($value, $type)
|
||||
{
|
||||
switch ($type) {
|
||||
case dibi::TEXT:
|
||||
return "'" . $this->connection->escapeString($value) . "'";
|
||||
case dibi::TEXT:
|
||||
return "'" . $this->connection->escapeString($value) . "'";
|
||||
|
||||
case dibi::BINARY:
|
||||
return "X'" . bin2hex((string) $value) . "'";
|
||||
case dibi::BINARY:
|
||||
return "X'" . bin2hex((string) $value) . "'";
|
||||
|
||||
case dibi::IDENTIFIER:
|
||||
return '[' . strtr($value, '[]', ' ') . ']';
|
||||
case dibi::IDENTIFIER:
|
||||
return '[' . strtr($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
|
||||
@@ -277,7 +258,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decodes data from result set.
|
||||
* @param string value
|
||||
@@ -294,26 +274,21 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 ($limit < 0 && $offset < 1) return;
|
||||
$sql .= ' LIMIT ' . $limit . ($offset > 0 ? ' OFFSET ' . (int) $offset : '');
|
||||
if ($limit >= 0 || $offset > 0) {
|
||||
$sql .= ' LIMIT ' . $limit . ($offset > 0 ? ' OFFSET ' . (int) $offset : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Automatically frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -324,7 +299,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
* @return int
|
||||
@@ -336,7 +310,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the row at current position and moves the internal cursor to the next position.
|
||||
* @param bool TRUE for associative array, FALSE for numeric
|
||||
@@ -360,7 +333,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Moves cursor position without fetching row.
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
@@ -373,7 +345,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -385,7 +356,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a result set.
|
||||
* @return array
|
||||
@@ -407,7 +377,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
* @return mixed
|
||||
@@ -419,11 +388,9 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* user defined functions ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Registers an user defined function for use in SQL statements.
|
||||
* @param string function name
|
||||
@@ -437,7 +404,6 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Registers an aggregating user defined function for use in SQL statements.
|
||||
* @param string function name
|
||||
|
Reference in New Issue
Block a user