mirror of
https://github.com/dg/dibi.git
synced 2025-08-13 09:34:30 +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.
|
||||
*/
|
||||
|
||||
|
||||
@@ -41,7 +37,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
private $affectedRows = FALSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @throws DibiNotSupportedException
|
||||
*/
|
||||
@@ -53,13 +48,12 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connects to a database.
|
||||
* @return void
|
||||
* @throws DibiException
|
||||
*/
|
||||
public function connect(array &$config)
|
||||
public function connect(array & $config)
|
||||
{
|
||||
DibiConnection::alias($config, 'options|UID', 'username');
|
||||
DibiConnection::alias($config, 'options|PWD', 'password');
|
||||
@@ -80,7 +74,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
* @return void
|
||||
@@ -91,7 +84,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes the SQL query.
|
||||
* @param string SQL statement.
|
||||
@@ -114,7 +106,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||
* @return int|FALSE number of rows or FALSE on error
|
||||
@@ -125,7 +116,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
* @return int|FALSE int on success or FALSE on failure
|
||||
@@ -141,7 +131,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
* @param string optional savepoint name
|
||||
@@ -154,7 +143,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Commits statements in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -167,7 +155,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rollback changes in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -180,7 +167,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
@@ -191,7 +177,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection reflector.
|
||||
* @return IDibiReflector
|
||||
@@ -202,7 +187,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Result set driver factory.
|
||||
* @param resource
|
||||
@@ -216,11 +200,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in a SQL statement.
|
||||
* @param mixed value
|
||||
@@ -231,30 +213,29 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
public function escape($value, $type)
|
||||
{
|
||||
switch ($type) {
|
||||
case dibi::TEXT:
|
||||
case dibi::BINARY:
|
||||
return "'" . str_replace("'", "''", $value) . "'";
|
||||
case dibi::TEXT:
|
||||
case dibi::BINARY:
|
||||
return "'" . str_replace("'", "''", $value) . "'";
|
||||
|
||||
case dibi::IDENTIFIER:
|
||||
// @see http://msdn.microsoft.com/en-us/library/ms176027.aspx
|
||||
return '[' . str_replace(array('[', ']'), array('[[', ']]'), $value) . ']';
|
||||
case dibi::IDENTIFIER:
|
||||
// @see http://msdn.microsoft.com/en-us/library/ms176027.aspx
|
||||
return '[' . str_replace(array('[', ']'), array('[[', ']]'), $value) . ']';
|
||||
|
||||
case dibi::BOOL:
|
||||
return $value ? 1 : 0;
|
||||
case dibi::BOOL:
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d'") : date("'Y-m-d'", $value);
|
||||
case dibi::DATE:
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d'") : date("'Y-m-d'", $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d H:i:s'") : date("'Y-m-d H:i:s'", $value);
|
||||
case dibi::DATETIME:
|
||||
return $value instanceof DateTime ? $value->format("'Y-m-d H:i:s'") : date("'Y-m-d H:i:s'", $value);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes string for use in a LIKE statement.
|
||||
* @param string
|
||||
@@ -268,7 +249,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decodes data from result set.
|
||||
* @param string value
|
||||
@@ -285,15 +265,11 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// offset support is missing
|
||||
if ($limit >= 0) {
|
||||
@@ -306,11 +282,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Automatically frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -321,7 +295,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
* @return int
|
||||
@@ -332,7 +305,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the row at current position and moves the internal cursor to the next position.
|
||||
* @param bool TRUE for associative array, FALSE for numeric
|
||||
@@ -344,7 +316,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Moves cursor position without fetching row.
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
@@ -356,7 +327,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -368,7 +338,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a result set.
|
||||
* @return array
|
||||
@@ -387,7 +356,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
* @return mixed
|
||||
|
Reference in New Issue
Block a user