Commit dfae5296 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction de l'erreur lors de la génération du SQL : ORA-01789: query block...

Correction de l'erreur lors de la génération du SQL : ORA-01789: query block has incorrect number of result columns
parent 7d9d375d
Loading
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ EOS;

        $refConstraintsSql = NULL;
        if ($refConstraintsIncluded) {
            $refConstraintsSql = $this->generateSQLForRefConstraintsCreation($connection);
            $refConstraintsSql = $this->generateSQLForRefConstraintsCreation($connection, true);
            $refConstraintsSql = <<<EOS
    UNION ALL

@@ -448,16 +448,14 @@ EOS;

    /**
     * @param Connection $connection
     * @param bool       $innerSQLOnly
     * @return string
     */
    function generateSQLForRefConstraintsCreation(Connection $connection)
    function generateSQLForRefConstraintsCreation(Connection $connection, $innerSQLOnly = false)
    {
        $schemaName = $this->extractSchemaNameFromConnection($connection);

        return <<<EOS
        
SELECT sql from (
    
        $sql = <<<EOS
    --
    -- reference constraints
    --
@@ -472,9 +470,19 @@ SELECT sql from (
    where owner = '$schemaName'
          and constraint_type = 'R'

EOS;

        if (! $innerSQLOnly) {
            $sql = <<<EOS
SELECT sql from (
    
    $sql

)
ORDER BY ORD
EOS;
        }

        return $sql;
    }
}
 No newline at end of file