2011-03-01 Miguel de Dios <miguel.dedios@artica.es>

* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
	separate the function "process_sql_rollback" into the two version for
	MySQL and PostgreSQL engine.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4042 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-01 17:43:15 +00:00
parent 7291f6f491
commit 310ee18ac1
4 changed files with 33 additions and 22 deletions

View File

@ -1,3 +1,9 @@
2011-03-01 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
separate the function "process_sql_rollback" into the two version for
MySQL and PostgreSQL engine.
2011-03-01 Miguel de Dios <miguel.dedios@artica.es>
* index.php: cleaned source code.

View File

@ -928,4 +928,12 @@ function mysql_process_sql_commit() {
mysql_query ('COMMIT');
mysql_query ('SET AUTOCOMMIT = 0');
}
/**
* Rollbacks a database transaction.
*/
function mysql_process_sql_rollback() {
mysql_query ('ROLLBACK ');
mysql_query ('SET AUTOCOMMIT = 0');
}
?>

View File

@ -943,6 +943,13 @@ function postgresql_process_sql_begin() {
* Commits a database transaction.
*/
function postgresql_process_sql_commit() {
pg_query('COMMIT');
pg_query('COMMIT TRANSACTION');
}
/**
* Rollbacks a database transaction.
*/
function postgresql_process_sql_rollback() {
pg_query('ROLLBACK TRANSACTION');
}
?>

View File

@ -437,24 +437,6 @@ function get_profiles () {
return $return;
}
/**
* Selects profiles filtered
*
* @return array List of profiles filtered
*/
function get_profiles_filter ($filter) {
$sql = sprintf('SELECT * FROM tperfil WHERE %s', $filter);
$profiles = get_db_all_rows_sql ($sql);
$return = array ();
if ($profiles === false) {
return $return;
}
foreach ($profiles as $profile) {
$return[$profile["id_perfil"]] = $profile["name"];
}
return $return;
}
/**
* Create Profile for User
@ -3362,8 +3344,16 @@ function process_sql_commit() {
* Rollbacks a database transaction.
*/
function process_sql_rollback() {
mysql_query ('ROLLBACK');
mysql_query ('SET AUTOCOMMIT = 0');
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_process_sql_rollback();
break;
case "postgresql":
return postgresql_process_sql_rollback();
break;
}
}
/**