Doctrine 1
  1. Doctrine 1
  2. DC-939

Patch for Doctrine ..... to identify in some cases autoincremented fields in oracle

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP Version 5.2.4-2ubuntu5.10
      Copyright (c) 1997-2007 The PHP Group
      Oracle database 10gR2
      Symfony 1.4.4

      Description

      Patch for Doctrine ..... to identify in some cases autoincremented
      fields.
      [Solution found thanks to Vladimir Tamara - vtamara AT pasosdejesus DOT org]

      Doctrine/Import/Oracle.php

      // Heuristic to check autoincremented fields.
      // We check if there is a trigger on the field.
      // We could also check if there is a sequence on the field.
      // Side effect: slower generation of scheme
      $q = "SELECT * FROM all_trigger_cols WHERE
      table_name='$table' AND column_name='" . $val['column_name'];

      $res2 = $this->conn->fetchColumn($q);
      if (count($res2) > 0)

      { $descr[$val['column_name']]['autoincrement'] = true; }

      }

      return $descr;

        Activity

        Hide
        Edwin Alexander Herrera Saavedra added a comment -

        when new tables are created, the auto-increment is shown in all fields of the table in the schema, to avoid this problem has generated the following improvements to a validation of the auto-increment column is only when the primary key

        Solution found thanks to
        Vladimir Tamara - vtamara AT pasosdejesus DOT org
        and Alexander Herrera

        if($descr[$val['column_name']]['primary']==1){
        // Heuristic to check autoincremented fields.
        // We check if there is a trigger on the field.
        // We could also check if there is a sequence on the field.
        // Side effect: slower generation of scheme
        //SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%TS_DIS_REG_PK%' AND COLUMN_NAME='FECHA_PROC';
        $q="SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%".$table."_PK%' AND COLUMN_NAME='".$val['column_name']."'

        ";
        // echo $descr[$val['column_name']]['primary']."\n";
        $s = "SELECT * FROM all_trigger_cols WHERE table_name='$table' AND column_name='" . $val['column_name'] . "'";
        //echo $q."\n";
        $res2 = $this->conn->fetchColumn($q);
        $res3 = $this->conn->fetchColumn($s);
        if (count($res2) > 0 && count($res3)>0)

        { $descr[$val['column_name']]['autoincrement'] = true; }

        }

        Show
        Edwin Alexander Herrera Saavedra added a comment - when new tables are created, the auto-increment is shown in all fields of the table in the schema, to avoid this problem has generated the following improvements to a validation of the auto-increment column is only when the primary key Solution found thanks to Vladimir Tamara - vtamara AT pasosdejesus DOT org and Alexander Herrera if($descr[$val ['column_name'] ] ['primary'] ==1){ // Heuristic to check autoincremented fields. // We check if there is a trigger on the field. // We could also check if there is a sequence on the field. // Side effect: slower generation of scheme //SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%TS_DIS_REG_PK%' AND COLUMN_NAME='FECHA_PROC'; $q="SELECT * FROM ALL_CONS_COLUMNS WHERE CONSTRAINT_NAME LIKE '%".$table."_PK%' AND COLUMN_NAME='".$val ['column_name'] ."' "; // echo $descr[$val ['column_name'] ] ['primary'] ."\n"; $s = "SELECT * FROM all_trigger_cols WHERE table_name='$table' AND column_name='" . $val ['column_name'] . "'"; //echo $q."\n"; $res2 = $this->conn->fetchColumn($q); $res3 = $this->conn->fetchColumn($s); if (count($res2) > 0 && count($res3)>0) { $descr[$val['column_name']]['autoincrement'] = true; } }

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Edwin Alexander Herrera Saavedra
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: