mirror of
https://github.com/dg/dibi.git
synced 2025-08-11 08:34:59 +02:00
typos & whitespace
This commit is contained in:
@@ -44,7 +44,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
private $affectedRows = FALSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @throws DibiNotSupportedException
|
||||
*/
|
||||
@@ -56,13 +55,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');
|
||||
@@ -74,7 +72,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
|
||||
} else {
|
||||
// Default values
|
||||
if (!isset($config['options']['CharacterSet'])) $config['options']['CharacterSet'] = 'UTF-8';
|
||||
if (!isset($config['options']['CharacterSet'])) {
|
||||
$config['options']['CharacterSet'] = 'UTF-8';
|
||||
}
|
||||
|
||||
$this->connection = sqlsrv_connect($config['host'], (array) $config['options']);
|
||||
}
|
||||
@@ -86,7 +86,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
* @return void
|
||||
@@ -97,7 +96,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Executes the SQL query.
|
||||
* @param string SQL statement.
|
||||
@@ -120,7 +118,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
|
||||
@@ -131,7 +128,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
|
||||
@@ -147,7 +143,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
* @param string optional savepoint name
|
||||
@@ -160,7 +155,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Commits statements in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -173,7 +167,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rollback changes in a transaction.
|
||||
* @param string optional savepoint name
|
||||
@@ -186,7 +179,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
@@ -197,7 +189,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection reflector.
|
||||
* @return IDibiReflector
|
||||
@@ -208,7 +199,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Result set driver factory.
|
||||
* @param resource
|
||||
@@ -222,11 +212,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in a SQL statement.
|
||||
* @param mixed value
|
||||
@@ -237,30 +225,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(']', ']]', $value) . ']';
|
||||
case dibi::IDENTIFIER:
|
||||
// @see http://msdn.microsoft.com/en-us/library/ms176027.aspx
|
||||
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("'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
|
||||
@@ -274,7 +261,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decodes data from result set.
|
||||
* @param string value
|
||||
@@ -291,15 +277,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) {
|
||||
@@ -312,11 +294,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Automatically frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -327,7 +307,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
* @return int
|
||||
@@ -338,7 +317,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
|
||||
@@ -350,7 +328,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Moves cursor position without fetching row.
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
@@ -362,7 +339,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set.
|
||||
* @return void
|
||||
@@ -374,7 +350,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a result set.
|
||||
* @return array
|
||||
@@ -393,7 +368,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
* @return mixed
|
||||
|
Reference in New Issue
Block a user