diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8fd75b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +name: CI + +on: + # Run on all pushes to master and on all pull requests. + push: + branches: + master + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +jobs: + test: + uses: "zetacomponents/.github/.github/workflows/ci.yml@master" diff --git a/.github/workflows/coding-standard.yml b/.github/workflows/coding-standard.yml new file mode 100644 index 0000000..aa72168 --- /dev/null +++ b/.github/workflows/coding-standard.yml @@ -0,0 +1,15 @@ +name: Coding Standard + +on: + # Run on all pushes and on all pull requests. + push: + branches: + master + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +jobs: + test: + uses: "zetacomponents/.github/.github/workflows/coding-standard.yml@master" + diff --git a/.gitignore b/.gitignore index e76bc98..f13cef9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor run-tests-tmp extract composer.lock +.phpcs-cache diff --git a/composer.json b/composer.json index f9a3b35..47aca25 100644 --- a/composer.json +++ b/composer.json @@ -56,6 +56,12 @@ "require-dev": { "phpunit/phpunit": "~8.0", "zetacomponents/database-schema": "~1.5", - "zetacomponents/unit-test": "*" + "zetacomponents/unit-test": "*", + "zetacomponents/coding-standard": "^1.0" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..0b50711 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,16 @@ + + + + + + + + + + + + + src + + + diff --git a/src/db_autoload.php b/src/db_autoload.php index 8d90ac4..179bbe9 100644 --- a/src/db_autoload.php +++ b/src/db_autoload.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/exception.php b/src/exceptions/exception.php index aeb6b11..4a7a05f 100644 --- a/src/exceptions/exception.php +++ b/src/exceptions/exception.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -43,7 +43,7 @@ class ezcDbException extends ezcBaseException */ public function __construct( $message ) { - parent::__construct( $message ); + parent::__construct( $message ); } } ?> diff --git a/src/exceptions/handler_not_found.php b/src/exceptions/handler_not_found.php index 0a96ad2..de88b3c 100644 --- a/src/exceptions/handler_not_found.php +++ b/src/exceptions/handler_not_found.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/missing_parameter.php b/src/exceptions/missing_parameter.php index 730beab..15cb888 100644 --- a/src/exceptions/missing_parameter.php +++ b/src/exceptions/missing_parameter.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/query/invalid.php b/src/exceptions/query/invalid.php index d62a50f..044d0ad 100644 --- a/src/exceptions/query/invalid.php +++ b/src/exceptions/query/invalid.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/query/invalid_parameter.php b/src/exceptions/query/invalid_parameter.php index aa3463b..ed2783b 100644 --- a/src/exceptions/query/invalid_parameter.php +++ b/src/exceptions/query/invalid_parameter.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/query/variable_parameter.php b/src/exceptions/query/variable_parameter.php index 3cc1a7f..389a62c 100644 --- a/src/exceptions/query/variable_parameter.php +++ b/src/exceptions/query/variable_parameter.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/exceptions/query_exception.php b/src/exceptions/query_exception.php index 08f7d47..6c8bb4c 100644 --- a/src/exceptions/query_exception.php +++ b/src/exceptions/query_exception.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -32,7 +32,6 @@ */ class ezcQueryException extends ezcBaseException { - /** * Constructs an ezcQueryException with the highlevel error * message $message and the errorcode $code. diff --git a/src/exceptions/transaction.php b/src/exceptions/transaction.php index 0a85d0f..e68316e 100644 --- a/src/exceptions/transaction.php +++ b/src/exceptions/transaction.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/factory.php b/src/factory.php index 4b8794f..e3b3711 100644 --- a/src/factory.php +++ b/src/factory.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -347,7 +347,7 @@ public static function parseDSN( $dsn ) // /database?param1=value1¶m2=value2 $parsed['database'] = rawurldecode( substr( $dsn, 0, $pos ) ); $dsn = substr( $dsn, $pos + 1 ); - if ( strpos( $dsn, '&') !== false ) + if ( strpos( $dsn, '&' ) !== false ) { $opts = explode( '&', $dsn ); } diff --git a/src/handler.php b/src/handler.php index a073281..48bfbf0 100644 --- a/src/handler.php +++ b/src/handler.php @@ -329,7 +329,7 @@ public function quoteIdentifier( $identifier ) $this->identifierQuoteChars["end"], $this->identifierQuoteChars["end"].$this->identifierQuoteChars["end"], $identifier - ) + ) . $this->identifierQuoteChars["end"]; } else diff --git a/src/handlers/mssql.php b/src/handlers/mssql.php index 1ee5b7c..4ef80fc 100644 --- a/src/handlers/mssql.php +++ b/src/handlers/mssql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/handlers/mysql.php b/src/handlers/mysql.php index f3a8477..f40c55e 100644 --- a/src/handlers/mysql.php +++ b/src/handlers/mysql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/handlers/oracle.php b/src/handlers/oracle.php index 80de924..e067986 100644 --- a/src/handlers/oracle.php +++ b/src/handlers/oracle.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/handlers/pgsql.php b/src/handlers/pgsql.php index 77a7c69..e5bc9ac 100644 --- a/src/handlers/pgsql.php +++ b/src/handlers/pgsql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/handlers/sqlite.php b/src/handlers/sqlite.php index 3a2e88e..1616d9b 100644 --- a/src/handlers/sqlite.php +++ b/src/handlers/sqlite.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/instance.php b/src/instance.php index 3a287f2..0bd23bd 100644 --- a/src/instance.php +++ b/src/instance.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/options/identifiers.php b/src/options/identifiers.php index ada5c53..5dd0632 100644 --- a/src/options/identifiers.php +++ b/src/options/identifiers.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -76,7 +76,6 @@ class ezcDbMssqlOptions extends ezcBaseOptions */ const QUOTES_UNTOUCHED = 3; - /** * Creates an ezcDbMssqlOptions object with default option values. * @@ -113,8 +112,10 @@ public function __set( $propertyName, $propertyValue ) ) ) { - throw new ezcBaseValueException( $propertyName, $propertyValue, - 'one of ezcDbMssqlOptions::QUOTES_COMPLIANT, QUOTES_LEGACY, QUOTES_GUESS, QUOTES_UNTOUCHED constants' ); + throw new ezcBaseValueException( + $propertyName, $propertyValue, + 'one of ezcDbMssqlOptions::QUOTES_COMPLIANT, QUOTES_LEGACY, QUOTES_GUESS, QUOTES_UNTOUCHED constants' + ); } $this->quoteIdentifier = (int) $propertyValue; diff --git a/src/query_autoload.php b/src/query_autoload.php index 9a8d95a..e408c58 100644 --- a/src/query_autoload.php +++ b/src/query_autoload.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/sqlabstraction/expression.php b/src/sqlabstraction/expression.php index 6caf680..5492b6f 100644 --- a/src/sqlabstraction/expression.php +++ b/src/sqlabstraction/expression.php @@ -216,7 +216,6 @@ public function setValuesQuoting( $doQuoting ) $this->quoteValues = $doQuoting; } - /** * Returns the SQL to bind logical expressions together using a logical or. * @@ -366,7 +365,7 @@ private function basicMath( $type ) public function add() { $args = func_get_args(); - return $this->basicMath( '+', $args ); + return $this->basicMath( '+', $args ); } /** @@ -714,7 +713,9 @@ public function like( $expression, $pattern ) $expression = $this->getIdentifier( $expression ); return "{$expression} LIKE {$pattern}"; } + // aggregate functions + /** * Returns the average value of a column * @@ -847,6 +848,7 @@ public function now() } // string functions + /** * Returns part of a string. * diff --git a/src/sqlabstraction/implementations/expression_mssql.php b/src/sqlabstraction/implementations/expression_mssql.php index ef9fb7c..8e65d33 100644 --- a/src/sqlabstraction/implementations/expression_mssql.php +++ b/src/sqlabstraction/implementations/expression_mssql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -193,7 +193,7 @@ public function ceil( $number ) public function unixTimestamp( $column ) { $column = $this->getIdentifier( $column ); - return " DATEDIFF(s, '19700101', {$column} ) - ".date('Z')." "; + return " DATEDIFF(s, '19700101', {$column} ) - ".date( 'Z' )." "; } /** diff --git a/src/sqlabstraction/implementations/expression_oracle.php b/src/sqlabstraction/implementations/expression_oracle.php index aae2091..52ae764 100644 --- a/src/sqlabstraction/implementations/expression_oracle.php +++ b/src/sqlabstraction/implementations/expression_oracle.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -108,7 +108,7 @@ public function now() /** * Returns the SQL to locate the position of the first occurrence of a substring - * + * * @param string $substr * @param string $value * @return string @@ -270,8 +270,8 @@ public function dateExtract( $column, $type ) * ->where( $q->expr->in( 'id', 1, 2, 3 ) ); * * - * Oracle limits the number of values in a single IN() to 1000. This - * implementation creates a list of combined IN() expressions to bypass + * Oracle limits the number of values in a single IN() to 1000. This + * implementation creates a list of combined IN() expressions to bypass * this limitation. * * @throws ezcQueryVariableParameterException if called with less than two @@ -302,7 +302,7 @@ public function in( $column ) { throw new ezcQueryVariableParameterException( 'in', count( $args ), 2 ); } - + if ( $this->quoteValues ) { foreach ( $values as $key => $value ) @@ -319,7 +319,7 @@ public function in( $column ) } } } - + if ( count( $values ) <= 1000 ) { return "{$column} IN ( " . join( ', ', $values ) . ' )'; @@ -328,7 +328,8 @@ public function in( $column ) { $expression = '( '; - do { + do + { $bunch = array_slice( $values, 0, 1000 ); $values = array_slice( $values, 1000 ); diff --git a/src/sqlabstraction/implementations/expression_pgsql.php b/src/sqlabstraction/implementations/expression_pgsql.php index b4c6893..eb730ca 100644 --- a/src/sqlabstraction/implementations/expression_pgsql.php +++ b/src/sqlabstraction/implementations/expression_pgsql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -147,7 +147,7 @@ public function now() /** * Returns the SQL to locate the position of the first occurrence of a substring - * + * * @param string $substr * @param string $value * @return string diff --git a/src/sqlabstraction/implementations/expression_sqlite.php b/src/sqlabstraction/implementations/expression_sqlite.php index cb27ea5..6499c67 100644 --- a/src/sqlabstraction/implementations/expression_sqlite.php +++ b/src/sqlabstraction/implementations/expression_sqlite.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/sqlabstraction/implementations/query_select_mssql.php b/src/sqlabstraction/implementations/query_select_mssql.php index 8b18684..d40d0ce 100644 --- a/src/sqlabstraction/implementations/query_select_mssql.php +++ b/src/sqlabstraction/implementations/query_select_mssql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -147,9 +147,9 @@ public function getQuery() $query = parent::getQuery(); if ( $this->hasLimit ) { - if ( $this->offset) + if ( $this->offset) { - if ( !$this->orderString ) + if ( !$this->orderString ) { // Uh ow. We need some columns to sort in the oposite order to make this work throw new ezcQueryInvalidException( "LIMIT workaround for MS SQL", "orderBy() was not called before getQuery()." ); diff --git a/src/sqlabstraction/implementations/query_select_oracle.php b/src/sqlabstraction/implementations/query_select_oracle.php index d75273f..5bdbd28 100644 --- a/src/sqlabstraction/implementations/query_select_oracle.php +++ b/src/sqlabstraction/implementations/query_select_oracle.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -140,7 +140,6 @@ public function limit( $limit, $offset = 0 ) return $this; } - /** * Returns dummy table name 'dual'. * @@ -160,27 +159,27 @@ public function getQuery() if ( $this->hasLimit ) { $max = $this->offset + $this->limit; - if ( $this->offset > 0 ) + if ( $this->offset > 0 ) { $min = $this->offset + 1; $query = "SELECT * FROM (SELECT a.*, ROWNUM rn FROM ( {$query} ) a WHERE rownum <= {$max} ) WHERE rn >= {$min}"; } - else + else { $query = "SELECT a.* FROM ( {$query} ) a WHERE ROWNUM <= {$max}"; - } + } } return $query; } /** * Handles preparing query. - * + * * Overrides ezcQuery->prepare() - * - * Adds "FROM dual" to the select if no FROM clause specified + * + * Adds "FROM dual" to the select if no FROM clause specified * i.e. fixes queries like "SELECT 1+1" to work in Oracle. - * + * * @return PDOStatement */ public function prepare() @@ -191,7 +190,6 @@ public function prepare() } return parent::prepare(); } - } ?> diff --git a/src/sqlabstraction/implementations/query_select_sqlite.php b/src/sqlabstraction/implementations/query_select_sqlite.php index 622c10d..9cdad45 100644 --- a/src/sqlabstraction/implementations/query_select_sqlite.php +++ b/src/sqlabstraction/implementations/query_select_sqlite.php @@ -64,7 +64,6 @@ public function __construct( PDO $db ) parent::__construct( $db ); } - /** * Resets the query object for reuse. * @@ -279,8 +278,10 @@ public function rightJoin() $table = ''; if ( !is_string( $args[0] ) ) { - throw new ezcQueryInvalidException( 'SELECT', - 'Inconsistent type of first argument passed to rightJoin(). Should be string with name of table.' ); + throw new ezcQueryInvalidException( + 'SELECT', + 'Inconsistent type of first argument passed to rightJoin(). Should be string with name of table.' + ); } $table = $this->getIdentifier( $args[0] ); @@ -305,7 +306,7 @@ public function rightJoin() if ( end( $this->rightJoins ) === null ) // fill last rightJoin info entry with table name. { - $lastTable = array_pop ( $this->fromTables ); + $lastTable = array_pop( $this->fromTables ); array_pop( $this->rightJoins ); $this->rightJoins[count( $this->rightJoins )]['tables'][] = $lastTable; } diff --git a/src/sqlabstraction/implementations/query_sqlite_function_implementations.php b/src/sqlabstraction/implementations/query_sqlite_function_implementations.php index d18bb02..1339cff 100644 --- a/src/sqlabstraction/implementations/query_sqlite_function_implementations.php +++ b/src/sqlabstraction/implementations/query_sqlite_function_implementations.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -72,7 +72,7 @@ static public function concatImpl() /** * Returns the SQL to locate the position of the first occurrence of a substring - * + * * @param string $substr * @param string $value * @return integer @@ -84,7 +84,7 @@ static public function positionImpl( $substr, $value ) /** * Returns the next lowest integer value from the number - * + * * @param numeric $number * @return integer */ @@ -95,7 +95,7 @@ static public function floorImpl( $number ) /** * Returns the next highest integer value from the number - * + * * @param numeric $number * @return integer */ diff --git a/src/sqlabstraction/implementations/utilities_mysql.php b/src/sqlabstraction/implementations/utilities_mysql.php index f4f33fd..6e69c94 100644 --- a/src/sqlabstraction/implementations/utilities_mysql.php +++ b/src/sqlabstraction/implementations/utilities_mysql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/sqlabstraction/implementations/utilities_oracle.php b/src/sqlabstraction/implementations/utilities_oracle.php index f56da77..7bc7940 100644 --- a/src/sqlabstraction/implementations/utilities_oracle.php +++ b/src/sqlabstraction/implementations/utilities_oracle.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -84,7 +84,6 @@ public function cleanup() $this->db->commit(); } - /** * Creates a new temporary table and returns the name. * diff --git a/src/sqlabstraction/implementations/utilities_pgsql.php b/src/sqlabstraction/implementations/utilities_pgsql.php index 9c0379b..67ce833 100644 --- a/src/sqlabstraction/implementations/utilities_pgsql.php +++ b/src/sqlabstraction/implementations/utilities_pgsql.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/sqlabstraction/implementations/utilities_sqlite.php b/src/sqlabstraction/implementations/utilities_sqlite.php index 0e37765..1908e19 100644 --- a/src/sqlabstraction/implementations/utilities_sqlite.php +++ b/src/sqlabstraction/implementations/utilities_sqlite.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/sqlabstraction/query.php b/src/sqlabstraction/query.php index de9553a..6f3dbf1 100644 --- a/src/sqlabstraction/query.php +++ b/src/sqlabstraction/query.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -78,7 +78,7 @@ abstract class ezcQuery /** * Stores the type of a value which will we used when the value is bound. - * + * * @var array(string=>int) */ private $boundParametersType = array(); @@ -93,7 +93,7 @@ abstract class ezcQuery /** * Stores the type of a value which will we used when the value is bound. - * + * * @var array(string=>int) */ private $boundValuesType = array(); @@ -371,7 +371,7 @@ public function bindParam( &$param, $placeHolder = null, $type = PDO::PARAM_STR $this->boundCounter++; $placeHolder = ":ezcValue{$this->boundCounter}"; } - + $this->boundParameters[$placeHolder] =& $param; $this->boundParametersType[$placeHolder] = $type; diff --git a/src/sqlabstraction/query_delete.php b/src/sqlabstraction/query_delete.php index 418a25d..1c27a42 100644 --- a/src/sqlabstraction/query_delete.php +++ b/src/sqlabstraction/query_delete.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -68,7 +68,6 @@ class ezcQueryDelete extends ezcQuery */ protected $whereString = null; - /** * Constructs a new ezcQueryDelete that works on the database $db and with the aliases $aliases. * @@ -100,7 +99,7 @@ public function deleteFrom( $table ) * * where() accepts an arbitrary number of parameters. Each parameter * must contain a logical expression or an array with logical expressions. - * where() could be invoked several times. All provided arguments + * where() could be invoked several times. All provided arguments * added to the end of $whereString and form final WHERE clause of the query. * If you specify multiple logical expression they are connected using * a logical and. @@ -130,7 +129,7 @@ public function where() } // glue string should be inserted each time but not before first entry - if ( $this->whereString != 'WHERE ' ) + if ( $this->whereString != 'WHERE ' ) { $this->whereString .= ' AND '; } @@ -139,7 +138,6 @@ public function where() return $this; } - /** * Returns the query string for this query object. * diff --git a/src/sqlabstraction/query_insert.php b/src/sqlabstraction/query_insert.php index ebf94ed..e93d5b6 100644 --- a/src/sqlabstraction/query_insert.php +++ b/src/sqlabstraction/query_insert.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -118,7 +118,7 @@ public function set( $column, $expression ) // Assume that set( 'columnName', "nextval('sequenceName')") was called. // Converting sequence SQL "nextval('sequenceName')" that valid for PostgreSQL // to "sequenceName.nextval" that valid for Oracle. - + if ( preg_match( "/nextval\('(.*)'\)/", $expression, $matches ) ) { $sequenceName = $matches[1]; diff --git a/src/sqlabstraction/query_select.php b/src/sqlabstraction/query_select.php index 2911802..38e8510 100644 --- a/src/sqlabstraction/query_select.php +++ b/src/sqlabstraction/query_select.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -247,13 +247,13 @@ public function alias( $name, $alias ) } /** - * Opens the query and uses a distinct select on the columns you want to + * Opens the query and uses a distinct select on the columns you want to * return with the query. * - * selectDistinct() accepts an arbitrary number of parameters. Each - * parameter must contain either the name of a column or an array + * selectDistinct() accepts an arbitrary number of parameters. Each + * parameter must contain either the name of a column or an array * containing the names of the columns. - * Each call to selectDistinct() appends columns to the list of columns + * Each call to selectDistinct() appends columns to the list of columns * that will be used in the query. * * Example: @@ -271,11 +271,11 @@ public function alias( $name, $alias ) * $q->selectDistinct( 'column1' )->select( 'column2' ); * * - * Each of above code produce SQL clause 'SELECT DISTINCT column1, column2' + * Each of above code produce SQL clause 'SELECT DISTINCT column1, column2' * for the query. * - * You may call select() after calling selectDistinct() which will result - * in the additional columns beein added. A call of selectDistinct() after + * You may call select() after calling selectDistinct() which will result + * in the additional columns beein added. A call of selectDistinct() after * select() will result in an ezcQueryInvalidException. * * @throws ezcQueryVariableParameterException if called with no parameters.. @@ -289,9 +289,9 @@ public function selectDistinct() { $this->selectString = 'SELECT DISTINCT '; } - elseif ( strpos ( $this->selectString, 'DISTINCT' ) === false ) + elseif ( strpos( $this->selectString, 'DISTINCT' ) === false ) { - throw new ezcQueryInvalidException( + throw new ezcQueryInvalidException( 'SELECT', 'You can\'t use selectDistinct() after using select() in the same query.' ); @@ -434,8 +434,10 @@ protected function doJoin( $type ) $table = ''; if ( !is_string( $args[0] ) ) { - throw new ezcQueryInvalidException( 'SELECT', - "Inconsistent type of first argument passed to {$type}Join(). Should be string with name of table." ); + throw new ezcQueryInvalidException( + 'SELECT', + "Inconsistent type of first argument passed to {$type}Join(). Should be string with name of table." + ); } $table = $this->getIdentifier( $args[0] ); @@ -458,11 +460,11 @@ protected function doJoin( $type ) /** * Returns the SQL for an inner join or prepares $fromString for an inner join. - * + * * This method could be used in two forms: * * innerJoin( 't2', $joinCondition ) - * + * * Takes 2 string arguments and returns ezcQuery. * * The first parameter is the name of the table to join with. The table to @@ -479,14 +481,14 @@ protected function doJoin( $type ) * * * innerJoin( 't2', 't1.id', 't2.id' ) - * + * * Takes 3 string arguments and returns ezcQuery. This is a simplified form * of the 2 parameter version. innerJoin( 't2', 't1.id', 't2.id' ) is * equal to innerJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); * * The first parameter is the name of the table to join with. The table to * which is joined should have been previously set with the from() method. - * + * * The second parameter is the name of the column on the table set * previously with the from() method and the third parameter the name of * the column to join with on the table that was specified in the first @@ -517,11 +519,11 @@ public function innerJoin() /** * Returns the SQL for a left join or prepares $fromString for a left join. - * + * * This method could be used in two forms: * * leftJoin( 't2', $joinCondition ) - * + * * Takes 2 string arguments and returns ezcQuery. * * The first parameter is the name of the table to join with. The table to @@ -538,14 +540,14 @@ public function innerJoin() * * * leftJoin( 't2', 't1.id', 't2.id' ) - * + * * Takes 3 string arguments and returns ezcQuery. This is a simplified form * of the 2 parameter version. leftJoin( 't2', 't1.id', 't2.id' ) is * equal to leftJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); * * The first parameter is the name of the table to join with. The table to * which is joined should have been previously set with the from() method. - * + * * The second parameter is the name of the column on the table set * previously with the from() method and the third parameter the name of * the column to join with on the table that was specified in the first @@ -576,11 +578,11 @@ public function leftJoin() /** * Returns the SQL for a right join or prepares $fromString for a right join. - * + * * This method could be used in two forms: * * rightJoin( 't2', $joinCondition ) - * + * * Takes 2 string arguments and returns ezcQuery. * * The first parameter is the name of the table to join with. The table to @@ -597,14 +599,14 @@ public function leftJoin() * * * rightJoin( 't2', 't1.id', 't2.id' ) - * + * * Takes 3 string arguments and returns ezcQuery. This is a simplified form * of the 2 parameter version. rightJoin( 't2', 't1.id', 't2.id' ) is * equal to rightJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) ); * * The first parameter is the name of the table to join with. The table to * which is joined should have been previously set with the from() method. - * + * * The second parameter is the name of the column on the table set * previously with the from() method and the third parameter the name of * the column to join with on the table that was specified in the first @@ -679,7 +681,6 @@ public function where() return $this; } - // limit, order and group /** @@ -910,7 +911,6 @@ public function getQuery() } return $query; } - } ?> diff --git a/src/sqlabstraction/query_subselect.php b/src/sqlabstraction/query_subselect.php index 1b7990e..168bcd4 100644 --- a/src/sqlabstraction/query_subselect.php +++ b/src/sqlabstraction/query_subselect.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -173,7 +173,6 @@ public function bindValue( $value, $placeHolder = null, $type = PDO::PARAM_STR ) return $this->outerQuery->bindValue( $value, $placeHolder, $type ); } - /** * Returns the SQL string for the subselect. * @@ -253,6 +252,5 @@ public function subSelect() { return new ezcQuerySubSelect( $this->outerQuery ); } - } ?> diff --git a/src/sqlabstraction/query_update.php b/src/sqlabstraction/query_update.php index 924ff84..3c09cde 100644 --- a/src/sqlabstraction/query_update.php +++ b/src/sqlabstraction/query_update.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -80,7 +80,6 @@ class ezcQueryUpdate extends ezcQuery */ protected $whereString = null; - /** * Constructs a new ezcQueryUpdate that works on the database $db and with the aliases $aliases. * @@ -130,9 +129,9 @@ public function set( $column, $expression ) * must contain a logical expression or an array with logical expressions. * If you specify multiple logical expression they are connected using * a logical and. - * where() could be invoked several times. All provided arguments + * where() could be invoked several times. All provided arguments * added to the end of $whereString and form final WHERE clause of the query. - * + * * * Example: * @@ -159,7 +158,7 @@ public function where() } // glue string should be inserted each time but not before first entry - if ( $this->whereString != 'WHERE ' ) + if ( $this->whereString != 'WHERE ' ) { $this->whereString .= ' AND '; } @@ -168,7 +167,6 @@ public function where() return $this; } - /** * Returns the query string for this query object. * diff --git a/src/sqlabstraction/utilities.php b/src/sqlabstraction/utilities.php index 30865a8..6c6ee5b 100644 --- a/src/sqlabstraction/utilities.php +++ b/src/sqlabstraction/utilities.php @@ -9,9 +9,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY