Skip to content

Commit

Permalink
Merge pull request #70 from efcor/master
Browse files Browse the repository at this point in the history
run pint, cleanup getSchemaState args
  • Loading branch information
efcor authored Aug 6, 2024
2 parents 144e9e9 + 06cd5a2 commit 6cb9a7b
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 130 deletions.
40 changes: 20 additions & 20 deletions src/Jfelder/OracleDB/OCI_PDO/OCI.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ class OCI extends PDO
/**
* Constructor.
*
* @param string $dsn DSN string to connect to database
* @param string $username Username of creditial to login to database
* @param string $password Password of creditial to login to database
* @param array $driver_options Options for the connection handle
* @param string $charset Character set to specify to the database when connecting
* @param string $dsn DSN string to connect to database
* @param string $username Username of creditial to login to database
* @param string $password Password of creditial to login to database
* @param array $driver_options Options for the connection handle
* @param string $charset Character set to specify to the database when connecting
*
* @throws OCIException if connection fails
*/
Expand Down Expand Up @@ -178,7 +178,7 @@ public function errorInfo(): array
/**
* Execute an SQL statement and return the number of affected rows.
*
* @param string $statement The SQL statement to prepare and execute.
* @param string $statement The SQL statement to prepare and execute.
* @return int Returns the number of rows that were modified or deleted by the statement
*/
public function exec(string $statement): int|false
Expand All @@ -193,7 +193,7 @@ public function exec(string $statement): int|false
/**
* Retrieve a database connection attribute.
*
* @param int $attribute One of the PDO::ATTR_* constants.
* @param int $attribute One of the PDO::ATTR_* constants.
* @return mixed The value of the requested PDO attribute or null if it does not exist.
*/
public function getAttribute(int $attribute): mixed
Expand Down Expand Up @@ -224,8 +224,8 @@ public function lastInsertId(?string $name = null): string|false
/**
* Prepares a statement for execution and returns a Jfelder\OracleDB\OCI_PDO\OCIStatement object.
*
* @param string $query Valid SQL statement for the target database server.
* @param array $options Attribute values for the OCIStatement object
* @param string $query Valid SQL statement for the target database server.
* @param array $options Attribute values for the OCIStatement object
* @return mixed Returns a OCIStatement on success, false otherwise
*/
public function prepare(string $query, array $options = []): OCIStatement|false
Expand All @@ -252,9 +252,9 @@ public function prepare(string $query, array $options = []): OCIStatement|false
* Executes an SQL statement, returning a result set as a Jfelder\OracleDB\OCI_PDO\OCIStatement object
* on success or false on failure.
*
* @param string $query Valid SQL statement for the target database server.
* @param int $fetchMode The fetch mode must be one of the PDO::FETCH_* constants.
* @param mixed ...$fetchModeArgs Has no effect; was only included to extend parent.
* @param string $query Valid SQL statement for the target database server.
* @param int $fetchMode The fetch mode must be one of the PDO::FETCH_* constants.
* @param mixed ...$fetchModeArgs Has no effect; was only included to extend parent.
* @return mixed Returns a OCIStatement on success, false otherwise
*/
public function query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): OCIStatement|false
Expand All @@ -273,8 +273,8 @@ public function query(string $query, ?int $fetchMode = null, mixed ...$fetchMode
/**
* Quotes a string for use in a query.
*
* @param string $string The string to be quoted.
* @param int $type Provides a data type hint for drivers that have alternate quoting styles.
* @param string $string The string to be quoted.
* @param int $type Provides a data type hint for drivers that have alternate quoting styles.
* @return string Returns false
*/
public function quote(string $string, int $type = PDO::PARAM_STR): string|false
Expand Down Expand Up @@ -307,8 +307,8 @@ public function rollBack(): bool
/**
* Set an attribute.
*
* @param int $attribute PDO::ATTR_* attribute identifier
* @param mixed $value Value of PDO::ATTR_* attribute
* @param int $attribute PDO::ATTR_* attribute identifier
* @param mixed $value Value of PDO::ATTR_* attribute
* @return true
*/
public function setAttribute(int $attribute, mixed $value): bool
Expand Down Expand Up @@ -360,9 +360,9 @@ public function getOCIResource()
/**
* Set the PDO errorInfo array values.
*
* @param string $code SQLSTATE identifier
* @param string $error Driver error code
* @param string $message Driver error message
* @param string $code SQLSTATE identifier
* @param string $error Driver error code
* @param string $message Driver error message
* @return array Returns the PDO errorInfo array
*/
private function setErrorInfo($code = null, $error = null, $message = null)
Expand All @@ -387,7 +387,7 @@ private function setErrorInfo($code = null, $error = null, $message = null)
/**
* Set the execute mode for the connection.
*
* @param int $mode Either \OCI_COMMIT_ON_SUCCESS or \OCI_NO_AUTO_COMMIT
* @param int $mode Either \OCI_COMMIT_ON_SUCCESS or \OCI_NO_AUTO_COMMIT
* @return bool
*
* @throws OCIException If any value other than the above are passed in
Expand Down
78 changes: 39 additions & 39 deletions src/Jfelder/OracleDB/OCI_PDO/OCIStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class OCIStatement extends PDOStatement
/**
* Constructor.
*
* @param resource $stmt Statement handle created with oci_parse()
* @param OCI $oci The OCI object for this statement
* @param array $options Options for the statement handle
* @param resource $stmt Statement handle created with oci_parse()
* @param OCI $oci The OCI object for this statement
* @param array $options Options for the statement handle
*
* @throws OCIException if $stmt is not a vaild oci8 statement resource
*/
Expand Down Expand Up @@ -102,11 +102,11 @@ public function __destruct()
/**
* Bind a column to a PHP variable.
*
* @param mixed $column Number of the column (1-indexed) in the result set
* @param mixed $var Name of the PHP variable to which the column will be bound.
* @param int $type Data type of the parameter, specified by the PDO::PARAM_* constants.
* @param int $maxLength A hint for pre-allocation.
* @param mixed $driverOptions Optional parameter(s) for the driver.
* @param mixed $column Number of the column (1-indexed) in the result set
* @param mixed $var Name of the PHP variable to which the column will be bound.
* @param int $type Data type of the parameter, specified by the PDO::PARAM_* constants.
* @param int $maxLength A hint for pre-allocation.
* @param mixed $driverOptions Optional parameter(s) for the driver.
* @return bool Returns TRUE on success or FALSE on failure.
*
* @throws \InvalidArgumentException If an unknown data type is passed in
Expand Down Expand Up @@ -134,10 +134,10 @@ public function bindColumn(string|int $column, mixed &$var, ?int $type = null, i
/**
* Binds a parameter to the specified variable name.
*
* @param mixed $param Parameter identifier
* @param mixed $var Name of the PHP variable to bind to the SQL statement parameter
* @param int $type Explicit data type for the parameter using the PDO::PARAM_* constants
* @param int $maxLength Length of the data type
* @param mixed $param Parameter identifier
* @param mixed $var Name of the PHP variable to bind to the SQL statement parameter
* @param int $type Explicit data type for the parameter using the PDO::PARAM_* constants
* @param int $maxLength Length of the data type
* @return bool Returns TRUE on success or FALSE on failure
*
* @throws \InvalidArgumentException If an unknown data type is passed in
Expand Down Expand Up @@ -167,9 +167,9 @@ public function bindParam(string|int $param, mixed &$var, int $type = PDO::PARAM
/**
* Binds a value to a parameter.
*
* @param mixed $param Parameter identifier.
* @param mixed $value The value to bind to the parameter
* @param int $type Explicit data type for the parameter using the PDO::PARAM_* constants
* @param mixed $param Parameter identifier.
* @param mixed $value The value to bind to the parameter
* @param int $type Explicit data type for the parameter using the PDO::PARAM_* constants
* @return bool Returns TRUE on success or FALSE on failure.
*
* @throws \InvalidArgumentException If an unknown data type is passed in
Expand Down Expand Up @@ -247,8 +247,8 @@ public function errorInfo(): array
/**
* Executes a prepared statement.
*
* @param array $params An array of values with as many elements as there are bound parameters in the
* SQL statement being executed
* @param array $params An array of values with as many elements as there are bound parameters in the
* SQL statement being executed
* @return bool Returns TRUE on success or FALSE on failure.
*/
public function execute(?array $params = null): bool
Expand All @@ -273,10 +273,10 @@ public function execute(?array $params = null): bool
/**
* Fetches the next row from a result set.
*
* @param int $mode Controls how the next row will be returned to the caller. This value must be one of
* the PDO::FETCH_* constants
* @param int $cursorOrientation Has no effect; was only included to extend parent.
* @param int $cursorOffset Has no effect; was only included to extend parent.
* @param int $mode Controls how the next row will be returned to the caller. This value must be one of
* the PDO::FETCH_* constants
* @param int $cursorOrientation Has no effect; was only included to extend parent.
* @param int $cursorOffset Has no effect; was only included to extend parent.
* @return mixed The return value of this function on success depends on the fetch type.
* In all cases, FALSE is returned on failure.
*/
Expand Down Expand Up @@ -314,9 +314,9 @@ public function fetch(int $mode = PDO::FETCH_CLASS, int $cursorOrientation = PDO
/**
* Returns an array containing all of the result set rows.
*
* @param int|null $mode Controls how the next row will be returned to the caller. This value must be one
* of the PDO::FETCH_* constants
* @param mixed ...$args Has no effect; was only included to extend parent.
* @param int|null $mode Controls how the next row will be returned to the caller. This value must be one
* of the PDO::FETCH_* constants
* @param mixed ...$args Has no effect; was only included to extend parent.
*/
public function fetchAll(int $mode = PDO::FETCH_CLASS, mixed ...$args): array
{
Expand All @@ -340,8 +340,8 @@ public function fetchAll(int $mode = PDO::FETCH_CLASS, mixed ...$args): array
/**
* Returns a single column from the next row of a result set.
*
* @param int $column 0-indexed number of the column you wish to retrieve from the row.
* If no value is supplied, fetchColumn fetches the first column.
* @param int $column 0-indexed number of the column you wish to retrieve from the row.
* If no value is supplied, fetchColumn fetches the first column.
* @return mixed single column in the next row of a result set
*/
public function fetchColumn(int $column = 0): mixed
Expand All @@ -354,8 +354,8 @@ public function fetchColumn(int $column = 0): mixed
/**
* Fetches the next row and returns it as an object.
*
* @param string $class Name of the created class
* @param array $constructorArgs Elements of this array are passed to the constructor
* @param string $class Name of the created class
* @param array $constructorArgs Elements of this array are passed to the constructor
* @return bool Returns an instance of the required class with property names that correspond to the column names
* or FALSE on failure.
*/
Expand All @@ -369,7 +369,7 @@ public function fetchObject(?string $class = 'stdClass', array $constructorArgs
/**
* Retrieve a statement attribute.
*
* @param int $name The attribute number
* @param int $name The attribute number
* @return mixed Returns the value of the attribute on success or null on failure
*/
public function getAttribute(int $name): mixed
Expand All @@ -380,7 +380,7 @@ public function getAttribute(int $name): mixed
/**
* Returns metadata for a column in a result set.
*
* @param int $column The 0-indexed column in the result set.
* @param int $column The 0-indexed column in the result set.
* @return array Returns an associative array representing the metadata for a single column
*/
public function getColumnMeta(int $column): array|false
Expand Down Expand Up @@ -419,8 +419,8 @@ public function rowCount(): int
/**
* Set a statement attribute.
*
* @param int $attribute The attribute number
* @param mixed $value Value of named attribute
* @param int $attribute The attribute number
* @param mixed $value Value of named attribute
* @return bool Returns TRUE
*/
public function setAttribute(int $attribute, mixed $value): bool
Expand All @@ -433,8 +433,8 @@ public function setAttribute(int $attribute, mixed $value): bool
/**
* Set the default fetch mode for this statement.
*
* @param int $mode The fetch mode must be one of the PDO::FETCH_* constants.
* @param mixed ...$args Has no effect; was only included to extend parent.
* @param int $mode The fetch mode must be one of the PDO::FETCH_* constants.
* @param mixed ...$args Has no effect; was only included to extend parent.
* @return bool Returns TRUE on success or FALSE on failure
*/
public function setFetchMode(int $mode, mixed ...$args)
Expand Down Expand Up @@ -478,7 +478,7 @@ public function getOCIResource()
/**
* Single location to process all the bindings on a resultset.
*
* @param array $rs The fetched array to be modified
* @param array $rs The fetched array to be modified
*/
private function processBindings($rs)
{
Expand All @@ -496,7 +496,7 @@ private function processBindings($rs)
/**
* Single location to process all the fetch options on a resultset.
*
* @param array $rec The fetched array to be modified
* @param array $rec The fetched array to be modified
* @return mixed The modified resultset
*/
private function processFetchOptions($rec)
Expand All @@ -515,9 +515,9 @@ private function processFetchOptions($rec)
/**
* Single location to process all errors and set necessary fields.
*
* @param string $code The SQLSTATE error code. defualts to custom 'JF000'
* @param string $error The driver based error code. If null, oci_error is called
* @param string $message The error message
* @param string $code The SQLSTATE error code. defualts to custom 'JF000'
* @param string $error The driver based error code. If null, oci_error is called
* @param string $message The error message
* @return array The local error array
*/
private function setErrorInfo($code = null, $error = null, $message = null)
Expand Down
4 changes: 1 addition & 3 deletions src/Jfelder/OracleDB/OracleConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public function getDriverTitle()

/**
* Get the server version for the connection.
*
* @return string
*/
public function getServerVersion(): string
{
Expand Down Expand Up @@ -157,7 +155,7 @@ protected function isUniqueConstraintError(Exception $exception)
*
* @throws \RuntimeException
*/
public function getSchemaState(string $dummyArg1 = null, string $dummyArg2 = null)
public function getSchemaState()
{
throw new RuntimeException('Schema dumping is not supported when using Oracle.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jfelder/OracleDB/OracleDBServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function register()
if (is_array($connection_keys)) {
foreach ($connection_keys as $key) {
$this->app['db']->extend($key, function ($config) {
$oConnector = new Connectors\OracleConnector();
$oConnector = new Connectors\OracleConnector;

$connection = $oConnector->connect($config);

Expand Down
2 changes: 0 additions & 2 deletions src/Jfelder/OracleDB/Query/Grammars/OracleGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public function compileSelect(Builder $query)
/**
* Compile a "where like" clause.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $where
* @return string
*/
Expand Down Expand Up @@ -305,7 +304,6 @@ protected function compileLimit(Builder $query, $limit)
/**
* Compile a group limit clause.
*
* @param \Illuminate\Database\Query\Builder $query
* @return string
*/
protected function compileGroupLimit(Builder $query)
Expand Down
2 changes: 1 addition & 1 deletion src/Jfelder/OracleDB/Query/Processors/OracleProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class OracleProcessor extends Processor
*
* @param string $sql
* @param array $values
* @param string $sequence no effect; only for method signature compatibility
* @param string $sequence no effect; only for method signature compatibility
* @return int
*/
public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
Expand Down
1 change: 0 additions & 1 deletion src/Jfelder/OracleDB/Schema/Grammars/OracleGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Database\Connection;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Fluent;
use RuntimeException;

class OracleGrammar extends \Illuminate\Database\Schema\Grammars\Grammar
{
Expand Down
Loading

0 comments on commit 6cb9a7b

Please sign in to comment.