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

Update ADOdb to 5.19 release + oci8 / pgsql bug fixes #181

Merged
merged 6 commits into from Jul 10, 2014
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
2 changes: 1 addition & 1 deletion core/constant_inc.php
Expand Up @@ -39,7 +39,7 @@


# installation # installation
define( 'CONFIGURED_PASSWORD', "______" ); define( 'CONFIGURED_PASSWORD', "______" );
define( 'DB_MIN_VERSION_ADODB', '5.19dev' ); # For mssql, oracle and pgsql define( 'DB_MIN_VERSION_ADODB', '5.19' ); # For mssql, oracle and pgsql
define( 'DB_MIN_VERSION_MSSQL', '9.0.0' ); define( 'DB_MIN_VERSION_MSSQL', '9.0.0' );
define( 'DB_MIN_VERSION_MYSQL', '5.0.8' ); # See #16584 define( 'DB_MIN_VERSION_MYSQL', '5.0.8' ); # See #16584
define( 'DB_MIN_VERSION_PGSQL', '8.4' ); # Earliest supported version as of Jan 2014 define( 'DB_MIN_VERSION_PGSQL', '8.4' ); # Earliest supported version as of Jan 2014
Expand Down
26 changes: 12 additions & 14 deletions core/database_api.php
Expand Up @@ -53,18 +53,9 @@
# @global bool $g_db_log_queries # @global bool $g_db_log_queries
$g_db_log_queries = ( 0 != ( config_get_global( 'log_level' ) & LOG_DATABASE ) ); $g_db_log_queries = ( 0 != ( config_get_global( 'log_level' ) & LOG_DATABASE ) );



# set adodb fetch mode # set adodb fetch mode
# @global bool $ADODB_FETCH_MODE # @global bool $ADODB_FETCH_MODE
if( db_is_oracle() ) { $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
# Due to oci8 returning column names in uppercase, the MantisBT
# default fetch mode (ADODB_FETCH_ASSOC) does not work properly
# in the current version of ADOdb (5.18) so we override it.
# See #15426
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
} else {
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
}


/** /**
* Mantis Database Parameters Count class * Mantis Database Parameters Count class
Expand Down Expand Up @@ -337,12 +328,19 @@ function db_query_bound( $p_query, array $p_arr_parms = null, $p_limit = -1, $p_


static $s_check_params; static $s_check_params;
if( $s_check_params === null ) { if( $s_check_params === null ) {
$s_check_params = ( db_is_pgsql() || $t_db_type == 'odbc_mssql' || $t_db_type == 'mssqlnative'); $s_check_params = ( db_is_pgsql() || $t_db_type == 'odbc_mssql' || $t_db_type == 'mssqlnative' );
} }


$t_start = microtime( true ); $t_start = microtime( true );


if( $p_arr_parms != null && $s_check_params ) { # This ensures that we don't get an error from ADOdb if $p_arr_parms == null,
# as Execute() expects either an array or false if there are no parameters -
# null actually gets treated as array( 0 => null )
if( is_null( $p_arr_parms ) ) {
$p_arr_parms = array();
}

if( !empty( $p_arr_parms ) && $s_check_params ) {
$t_params = count( $p_arr_parms ); $t_params = count( $p_arr_parms );
for( $i = 0;$i < $t_params;$i++ ) { for( $i = 0;$i < $t_params;$i++ ) {
if( $p_arr_parms[$i] === false ) { if( $p_arr_parms[$i] === false ) {
Expand All @@ -369,7 +367,7 @@ function db_query_bound( $p_query, array $p_arr_parms = null, $p_limit = -1, $p_
if( ON == $g_db_log_queries ) { if( ON == $g_db_log_queries ) {
$t_lastoffset = 0; $t_lastoffset = 0;
$i = 0; $i = 0;
if( !( is_null( $p_arr_parms ) || empty( $p_arr_parms ) ) ) { if( !empty( $p_arr_parms ) ) {
while( preg_match( '/\?/', $p_query, $t_matches, PREG_OFFSET_CAPTURE, $t_lastoffset ) ) { while( preg_match( '/\?/', $p_query, $t_matches, PREG_OFFSET_CAPTURE, $t_lastoffset ) ) {
$t_matches = $t_matches[0]; $t_matches = $t_matches[0];
# Realign the offset returned by preg_match as it is byte-based, # Realign the offset returned by preg_match as it is byte-based,
Expand Down Expand Up @@ -481,7 +479,7 @@ function db_fetch_array( IteratorAggregate &$p_result ) {
$p_result->MoveNext(); $p_result->MoveNext();
return $t_array; return $t_array;
} else { } else {
$t_row = $p_result->GetRowAssoc( false ); $t_row = $p_result->GetRowAssoc( ADODB_ASSOC_CASE_LOWER );
static $s_array_result; static $s_array_result;
static $s_array_fields; static $s_array_fields;


Expand Down
2 changes: 1 addition & 1 deletion core/project_hierarchy_api.php
Expand Up @@ -172,7 +172,7 @@ function project_hierarchy_cache( $p_show_disabled = false ) {
WHERE $t_enabled_clause WHERE $t_enabled_clause
ORDER BY p.name"; ORDER BY p.name";


$t_result = db_query_bound( $t_query, ( $p_show_disabled ? null : array( true ) ) ); $t_result = db_query_bound( $t_query, ( $p_show_disabled ? array() : array( true ) ) );


$g_cache_project_hierarchy = array(); $g_cache_project_hierarchy = array();
$g_cache_project_inheritance = array(); $g_cache_project_inheritance = array();
Expand Down
2 changes: 1 addition & 1 deletion core/summary_api.php
Expand Up @@ -569,7 +569,7 @@ function summary_print_by_reporter() {
WHERE $t_specific_where WHERE $t_specific_where
GROUP BY reporter_id GROUP BY reporter_id
ORDER BY num DESC"; ORDER BY num DESC";
$t_result = db_query_bound( $t_query, null, $t_reporter_summary_limit ); $t_result = db_query_bound( $t_query, array(), $t_reporter_summary_limit );


$t_reporters = array(); $t_reporters = array();
while( $t_row = db_fetch_array( $t_result ) ) { while( $t_row = db_fetch_array( $t_result ) ) {
Expand Down
2 changes: 1 addition & 1 deletion core/user_api.php
Expand Up @@ -1074,7 +1074,7 @@ function user_get_accessible_subprojects( $p_user_id, $p_project_id, $p_show_dis
WHERE $t_enabled_clause WHERE $t_enabled_clause
ph.parent_id IS NOT NULL ph.parent_id IS NOT NULL
ORDER BY p.name"; ORDER BY p.name";
$t_result = db_query_bound( $t_query, ( $p_show_disabled ? null : array( true ) ) ); $t_result = db_query_bound( $t_query, ( $p_show_disabled ? array() : array( true ) ) );
} else { } else {
$t_query = "SELECT DISTINCT p.id, p.name, ph.parent_id $t_query = "SELECT DISTINCT p.id, p.name, ph.parent_id
FROM $t_project_table p FROM $t_project_table p
Expand Down
2 changes: 1 addition & 1 deletion library/README.libs
Expand Up @@ -5,7 +5,7 @@ The version and status of each is summarized below:
------------------------------------------------------------------- -------------------------------------------------------------------
directory | project | version | status directory | project | version | status
------------------------------------------------------------------- -------------------------------------------------------------------
adodb | adodb | v5.18a-49 | unpatched [1] adodb | adodb | v5.19 | unpatched [1]
disposable | disposable | 1.1.0 | unpatched disposable | disposable | 1.1.0 | unpatched
ezc | ez Components | 2009.2.1 | unpatched ezc | ez Components | 2009.2.1 | unpatched
phpmailer | PHPMailer | 5.2.6 | unpatched [1] phpmailer | PHPMailer | 5.2.6 | unpatched [1]
Expand Down
2 changes: 1 addition & 1 deletion library/adodb
Submodule adodb updated 114 files
2 changes: 1 addition & 1 deletion manage_user_page.php
Expand Up @@ -179,7 +179,7 @@
echo '</ul>'; echo '</ul>';
echo '</div>'; echo '</div>';


$t_where_params = null; $t_where_params = array();
if( $f_filter === 'ALL' ) { if( $f_filter === 'ALL' ) {
$t_where = '(1 = 1)'; $t_where = '(1 = 1)';
} else if( $f_filter === 'UNUSED' ) { } else if( $f_filter === 'UNUSED' ) {
Expand Down