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

DbTable package log fix #433

Merged
merged 2 commits into from May 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions sources/database/Db-sqlite.class.php
Expand Up @@ -430,17 +430,6 @@ function insert_id($table, $field = null, $connection = null)
return sqlite_last_insert_rowid($connection === null ? $db_connection : $connection);
}

/**
* Last error on SQLite.
*/
function last_error()
{
global $db_connection, $sqlite_error;

$query_errno = sqlite_last_error($db_connection);
return $query_errno || empty($sqlite_error) ? sqlite_error_string($query_errno) : $sqlite_error;
}

/**
* Do a transaction.
*
Expand Down Expand Up @@ -480,7 +469,10 @@ function db_transaction($type = 'commit', $connection = null)
*/
function last_error($database = null)
{
return sqlite_last_error($database);
global $db_connection, $sqlite_error;

$query_errno = sqlite_last_error(empty($database) ? $db_connection : $database);
return $query_errno || empty($sqlite_error) ? sqlite_error_string($query_errno) : $sqlite_error;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion sources/database/DbTable-mysql.php
Expand Up @@ -392,7 +392,7 @@ function db_add_index($table_name, $index_info, $parameters = array(), $if_exist
$index_info['name'] = $index_info['name'];

// Log that we are going to want to remove this!
$this->$_db_package_log[] = array('remove_index', $table_name, $index_info['name']);
$this->_package_log[] = array('remove_index', $table_name, $index_info['name']);

// Let's get all our indexes.
$indexes = $this->db_list_indexes($table_name, true);
Expand Down