Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various minor bugs detected by static analyzer #579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/CallBack.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function get_callbacks($name)
* model object. For (after|before)_(create|update) callbacks, it will merge with
* a generic 'save' callback which is called first for the lease amount of precision.
*
* @param string $model Model to invoke the callback on.
* @param object $model Model to invoke the callback on.
* @param string $name Name of the callback to invoke
* @param boolean $must_exist Set to true to raise an exception if the callback does not exist.
* @return mixed null if $name was not a valid callback type or false if a method was invoked
Expand Down
4 changes: 2 additions & 2 deletions lib/Validations.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function validates_inclusion_or_exclusion_of($type, $attrs)
$enum = $options['within'];

if (!is_array($enum))
array($enum);
$enum = array($enum);

$message = str_replace('%s', $var, $options['message']);

Expand Down Expand Up @@ -517,7 +517,7 @@ public function validates_length_of($attrs)
$message = $options['message'];
else
$message = $options[$messageOptions[$range_option]];


$message = str_replace('%d', $option, $message);
$attribute_value = $this->model->$attribute;
Expand Down
11 changes: 6 additions & 5 deletions lib/adapters/OciAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
namespace ActiveRecord;

use PDO;
use PDOException;

/**
* Adapter for OCI (not completed yet).
*
*
* @package ActiveRecord
*/
class OciAdapter extends Connection
Expand All @@ -29,7 +30,7 @@ protected function __construct($info)
}

public function supports_sequences() { return true; }

public function get_next_sequence_value($sequence_name)
{
return $this->query_and_fetch_one('SELECT ' . $this->next_sequence_value($sequence_name) . ' FROM dual');
Expand Down Expand Up @@ -60,14 +61,14 @@ public function limit($sql, $offset, $limit)
{
$offset = intval($offset);
$stop = $offset + intval($limit);
return
return
"SELECT * FROM (SELECT a.*, rownum ar_rnum__ FROM ($sql) a " .
"WHERE rownum <= $stop) WHERE ar_rnum__ > $offset";
}

public function query_column_info($table)
{
$sql =
$sql =
"SELECT c.column_name, c.data_type, c.data_length, c.data_scale, c.data_default, c.nullable, " .
"(SELECT a.constraint_type " .
"FROM all_constraints a, all_cons_columns b " .
Expand Down Expand Up @@ -109,7 +110,7 @@ public function create_column(&$column)
$c->nullable = $column['nullable'] == 'Y' ? true : false;
$c->pk = $column['pk'] == 'P' ? true : false;
$c->length = $column['data_length'];

if ($column['data_type'] == 'timestamp')
$c->raw_type = 'datetime';
else
Expand Down