Skip to content

Commit

Permalink
Update ADOdb to 5.19
Browse files Browse the repository at this point in the history
- update the submodule
- back to ADODB_FETCH_ASSOC for oci8
- fix db_query_bound() $p_arr_parms null default issue

Fixes pull request #181
  • Loading branch information
dregad committed Jul 9, 2014
2 parents 64af35e + c726ff7 commit a2b23b3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion core/constant_inc.php
Expand Up @@ -39,7 +39,7 @@

# installation
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_MYSQL', '5.0.8' ); # See #16584
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
$g_db_log_queries = ( 0 != ( config_get_global( 'log_level' ) & LOG_DATABASE ) );


# set adodb fetch mode
# @global bool $ADODB_FETCH_MODE
if( db_is_oracle() ) {
# 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;
}
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;

/**
* 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;
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 );

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 );
for( $i = 0;$i < $t_params;$i++ ) {
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 ) {
$t_lastoffset = 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 ) ) {
$t_matches = $t_matches[0];
# 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();
return $t_array;
} else {
$t_row = $p_result->GetRowAssoc( false );
$t_row = $p_result->GetRowAssoc( ADODB_ASSOC_CASE_LOWER );
static $s_array_result;
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
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_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
GROUP BY reporter_id
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();
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
ph.parent_id IS NOT NULL
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 {
$t_query = "SELECT DISTINCT p.id, p.name, ph.parent_id
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
-------------------------------------------------------------------
adodb | adodb | v5.18a-49 | unpatched [1]
adodb | adodb | v5.19 | unpatched [1]
disposable | disposable | 1.1.0 | unpatched
ezc | ez Components | 2009.2.1 | unpatched
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 '</div>';

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

0 comments on commit a2b23b3

Please sign in to comment.