Skip to content

Commit

Permalink
Fix Lack of detailed error message during schema creation
Browse files Browse the repository at this point in the history
During MantisBT installation, when a schema upgrade step includes
several SQL statements (as generated by ADOdb), a detailed error message
was only reported the problem occurs while executing the last statement.

Calling ExecuteSQLArray() with the 2nd param = false forces the function
to return the error message on first failure instead of continuing with
the next statement.

Fixes #14399
  • Loading branch information
dregad committed Jun 20, 2012
1 parent 7d2ad4f commit e94e0a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions admin/install.php
Expand Up @@ -586,7 +586,7 @@ function InsertData( $p_table, $p_data ) {
}
} else {
$sqlarray = $dict->CreateDatabase( $f_database_name, Array( 'mysql' => 'DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci' ) );
$ret = $dict->ExecuteSQLArray( $sqlarray );
$ret = $dict->ExecuteSQLArray( $sqlarray, false );
if( $ret == 2 ) {
print_test_result( GOOD );
$t_db_open = true;
Expand Down Expand Up @@ -713,7 +713,7 @@ function InsertData( $p_table, $p_data ) {
} else {
echo 'Schema ' . $upgrade[$i][0] . ' ( ' . $t_target . ' )</td>';
if( $t_sql ) {
$ret = $dict->ExecuteSQLArray( $sqlarray );
$ret = $dict->ExecuteSQLArray( $sqlarray, false );
} else {
if( isset( $sqlarray[1] ) ) {
$ret = call_user_func( 'install_' . $sqlarray[0], $sqlarray[1] );
Expand Down

0 comments on commit e94e0a8

Please sign in to comment.