Changeset 5102

Show
Ignore:
Timestamp:
10/16/08 11:03:01 (9 months ago)
Author:
adrive
Message:

[1.0, 1.1] Export: Primary key fields in CREATE TABLE was not quoted when ATTR_QUOTE_IDENTIFIER turned on.
Export/Oracle: CREATE TRIGGER and anonymous statement shouldn't be used with ATTR_QUOTE_IDENTIFIER turned on.

Location:
branches/1.0
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Export.php

    r5067 r5102  
    243243 
    244244        if (isset($options['primary']) && ! empty($options['primary'])) { 
    245             $queryFields .= ', PRIMARY KEY(' . implode(', ', array_values($options['primary'])) . ')'; 
     245            $primaryKeys = array_map(array($this->conn, 'quoteIdentifier'), array_values($options['primary'])); 
     246            $queryFields .= ', PRIMARY KEY(' . implode(', ', $primaryKeys) . ')'; 
    246247        } 
    247248 
  • branches/1.0/lib/Doctrine/Export/Oracle.php

    r5067 r5102  
    9797    { 
    9898        $sql   = array(); 
    99         $table = strtoupper($table); 
    10099        $indexName  = $table . '_AI_PK'; 
    101100        $definition = array( 
     
    134133   last_InsertID NUMBER; 
    135134BEGIN 
    136    SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL; 
     135   SELECT ' . $this->conn->quoteIdentifier($sequenceName) . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL; 
    137136   IF (:NEW.' . $name . ' IS NULL OR :NEW.'.$name.' = 0) THEN 
    138       SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL; 
     137      SELECT ' . $this->conn->quoteIdentifier($sequenceName) . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL; 
    139138   ELSE 
    140139      SELECT NVL(Last_Number, 0) INTO last_Sequence 
     
    143142      SELECT :NEW.' . $name . ' INTO last_InsertID FROM DUAL; 
    144143      WHILE (last_InsertID > last_Sequence) LOOP 
    145          SELECT ' . $sequenceName . '.NEXTVAL INTO last_Sequence FROM DUAL; 
     144         SELECT ' . $this->conn->quoteIdentifier($sequenceName) . '.NEXTVAL INTO last_Sequence FROM DUAL; 
    146145      END LOOP; 
    147146   END IF; 
  • branches/1.0/tests/Export/OracleTestCase.php

    r5067 r5102  
    107107        $this->assertEqual($this->adapter->pop(), 'COMMIT'); 
    108108        $this->assertEqual(substr($this->adapter->pop(), 0, 14), 'CREATE TRIGGER'); 
    109         $this->assertEqual($this->adapter->pop(), 'CREATE SEQUENCE MYTABLE_seq START WITH 1 INCREMENT BY 1 NOCACHE');   
     109        $this->assertEqual($this->adapter->pop(), 'CREATE SEQUENCE mytable_seq START WITH 1 INCREMENT BY 1 NOCACHE');   
    110110        $this->assertEqual(substr($this->adapter->pop(), 0, 7), "DECLARE"); 
    111111        $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INT)');