View Issue Details

IDProjectCategoryView StatusLast Update
0007190mantisbtdb oraclepublic2014-12-08 00:34
ReportermechantflouAssigned Todregad 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0007190: error in filter_api with date filter
Description

this query doesn't work in oracle

SELECT DISTINCT m_bug_tbl.id as id, FROM m_project_tbl, m_bug_tbl
WHERE m_project_tbl.enabled = 1 AND m_project_tbl.id = m_bug_tbl.project_id AND m_bug_tbl.date_submitted BETWEEN '2006-2-1 00:00:00' AND '2006-4-12 23:59:59'

first, I've added a new function in database_api.php

function db_prepare_date( $p_date)
{
$t_db_type = config_get( 'db_type' );

    switch( $t_db_type ) {
        case 'mssql':
        case 'odbc_mssql':
        case 'mysql':
        case 'mysqli':
        case 'postgres':
        case 'postgres64':
        case 'postgres7':
        case 'pgsql':
        return '$p_date';
        case 'oci8':
        return "TO_TIMESTAMP('$p_date','YYYY-MM-DD HH24:MI:SS')";
}
}

then I've modified at the line 520 in filter_api.php
array_push( $t_where_clauses, "($t_bug_table.date_submitted BETWEEN ".db_prepare_date($t_start_string)." AND ".db_prepare_date($t_end_string)." )" );

With all change, date filter can work with oracle

TagsNo tags attached.

Relationships

has duplicate 0007191 closedryandesign error in filter_api with date filter 
related to 0013227 closeddregad Oracle DB support multiple issues 

Activities

chillax

chillax

2006-06-12 18:42

developer   ~0012958

The function above won't work for non-oci8 due to the quotes around $p_date in the return line. It would send back a string of '$p_date' instead of the value.

This function would be better expressed as:

function db_prepare_date( $p_date) {
$t_db_type = config_get( 'db_type' );

if ( $t_db_type == 'oci8' ) {
return "TO_TIMESTAMP('$p_date','YYYY-MM-DD HH24:MI:SS')";
} else {
return $p_date;
}
}

dregad

dregad

2011-09-09 12:38

developer   ~0029673

Would you have a chance to test if problem still exists using oracle branch in 0013227 (https://github.com/dregad/mantisbt/commits/oracle), and submit a revised patch/pull request against that if it's the case ?

Issue History

Date Modified Username Field Change
2006-06-12 04:54 mechantflou New Issue
2006-06-12 18:42 chillax Note Added: 0012958
2006-06-18 07:49 ryandesign Relationship added has duplicate 0007191
2011-09-09 12:38 dregad Note Added: 0029673
2011-09-09 12:38 dregad Relationship added related to 0013227
2013-10-17 12:52 dregad Target Version => 1.3.0-beta.1
2013-10-17 12:52 dregad Status new => resolved
2013-10-17 12:52 dregad Fixed in Version => 1.3.0-beta.1
2013-10-17 12:52 dregad Resolution open => fixed
2013-10-17 12:52 dregad Assigned To => dregad
2014-04-12 19:39 grangeway Issue cloned: 0017197
2014-12-08 00:34 vboctor Status resolved => closed