View Issue Details

IDProjectCategoryView StatusLast Update
0007246mantisbtdb oraclepublic2014-12-08 00:34
Reporterrulaan Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.0.3 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0007246: Not possible to use singup functionality
Description

APPLICATION WARNING #user_get_field() for NO_USER:

APPLICATION WARNING #user_get_field() for NO_USER:

APPLICATION WARNING #user_get_field() for NO_USER:

APPLICATION WARNING #user_get_field() for NO_USER:

APPLICATION WARNING #user_get_field() for NO_USER:

PROBLEMS SENDING MAIL TO: @null@
Mailer Error: SMTP Error: The following recipients failed: @null@

Additional Information

using Mantis 1.0.3 / Apache 2.0.58 / PHP 5.1.4 / Oracle 9.2.0.7 DB

Problem seems to be that in user_api.php

    $t_user_id = db_insert_id( $t_user_table );

is not receiving an id. Apparently Insert_ID is not implemented/working within ADODB oci8 (Oracle) implementation.

Several other parts of Mantis may also be affected

TagsNo tags attached.

Relationships

child of 0013227 closeddregad Oracle DB support multiple issues 

Activities

rulaan

rulaan

2006-06-30 04:05

reporter   ~0013056

Added code to database_api.php which solved the problem for now:

function db_insert_id($p_table = null) {
    global $g_db;

if ( isset($p_table) && db_isoci8() ) {
$query = "SELECT seq
".$p_table.".currval FROM DUAL";
$result = db_query( $query );
return db_result($result);
}
if ( isset($p_table) && db_is_pgsql() ) {
$query = "SELECT currval('".$p_table."_id_seq')";
$result = db_query( $query );
return db_result($result);
}
return $g_db->Insert_ID( );
}

and added function:

--------------------

# Check is the database is OCI
function db_is_oci8() {
    $t_db_type = config_get( 'db_type' );

    switch( $t_db_type ) {
        case 'oci8':
            return true;
    }

    return false;
}

This solves the issue for now. SEQUENCE.CURRVAL is private to the DB session. Only when more users share a connection (is this the case in Mantis?) this can cause problems when 2 users make an insert in the same table at almost the same time.

msierszen

msierszen

2009-05-14 10:05

reporter   ~0021822

Last edited: 2009-05-14 10:06

The same solution for the problem just coded another way.
I created an _insertID() function within the OCI wrapper.

diff -rupN mantisbt-1.1.7/core/adodb/drivers/adodb-oci8.inc.php mantisbt-1.1.7_zce/core/adodb/drivers/adodb-oci8.inc.php
--- mantisbt-1.1.7/core/adodb/drivers/adodb-oci8.inc.php 2009-04-20 09:14:00.000000000 +0200
+++ mantisbt-1.1.7_zce/core/adodb/drivers/adodb-oci8.inc.php 2009-05-13 11:24:18.163250000 +0200
@@ -87,7 +87,8 @@ class ADODB_oci8 extends ADOConnection {
var $useDBDateFormatForTextInput=false;
var $datetime = false; // MetaType('DATE') returns 'D' (datetime==false) or 'T' (datetime == true)
var $_refLOBs = array();

  • var $hasInsertID = true;
  • // var $ansiOuter = true; // if oracle9

    function ADODB_oci8()
    @@ -95,6 +96,15 @@ class ADODB_oci8 extends ADOConnection {
    $this->_hasOCIFetchStatement = ADODB_PHPVER >= 0x4200;
    if (defined('ADODBEXTENSION')) $this->rsPrefix .= 'ext';
    }

  • function _insertid($table)
  • {
  • $seq = "SEQ_".$table;
  • $sql = "SELECT $seq.currval from dual";
  • $id = ADOConnection::GetOne($sql);
  • return $id;
  • }
  • / Function &MetaColumns($table) added by smondino@users.sourceforge.net/
    function &MetaColumns($table)
    diff -rupN mantisbt-1.1.7/core/database_api.php mantisbt-1.1.7_zce/core/database_api.php
    --- mantisbt-1.1.7/core/database_api.php 2009-04-20 09:14:00.000000000 +0200
    +++ mantisbt-1.1.7_zce/core/database_api.php 2009-05-13 11:12:42.069500000 +0200
    @@ -256,7 +256,7 @@
    $result = db_query( $query );
    return db_result($result);
    }

  • return $g_db->Insert_ID( );
  • return $g_db->Insert_ID($p_table);
    }

    --------------------

If I get the time I try to figure out if there is a problem with two simultaneous queries and CURRVAL.

dregad

dregad

2011-09-09 12:44

developer   ~0029676

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 ?