src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/implementations/utilities_oracle.php
public function createTemporaryTable( $tableNamePattern, $tableDefinition )
    {
    	$tableNamePattern = $this->getPrefixedTableNames($tableNamePattern);
        if ( strpos( $tableNamePattern, '%' ) === false )
        {
            $tableName = $tableNamePattern;
        }
        else // generate unique table name with the given pattern
        {
            $maxTries = 10;
            do
            {
                $num = rand( 10000000, 99999999 );
                $tableName = strtoupper( str_replace( '%', $num, $tableNamePattern ) );
                $query = "SELECT count(*) AS cnt FROM user_tables WHERE table_name='$tableName'";
                $cnt = (int) $this->db->query( $query )->fetchColumn( 0 );
                $maxTries--;
            } while ( $cnt > 0 && $maxTries > 0 );

            if ( $maxTries == 0 )
            {
                throw ezcDbException(
                    ezcDbException::GENERIC_ERROR,
                    "Tried to generate an uninque temp table name for {$maxTries} time with no luck."
                );
            }
        }

        $this->db->exec( "CREATE GLOBAL TEMPORARY TABLE $tableName ($tableDefinition)" );
        return $tableName;
    }
public function createTemporaryTable( $tableNamePattern, $tableDefinition )
    {
    	$tableNamePattern = $this->getPrefixedTableNames($tableNamePattern);
        if ( strpos( $tableNamePattern, '%' ) === false )
        {
            $tableName = $tableNamePattern;
        }
        else // generate unique table name with the given pattern
        {
            $maxTries = 10;
            do
            {
                $num = rand( 10000000, 99999999 );
                $tableName = strtoupper( str_replace( '%', $num, $tableNamePattern ) );
                $query = "SELECT count(*) AS cnt FROM user_tables WHERE table_name='$tableName'";
                $cnt = (int) $this->db->query( $query )->fetchColumn( 0 );
                $maxTries--;
            } while ( $cnt > 0 && $maxTries > 0 );

            if ( $maxTries == 0 )
            {
                throw ezcDbException(
                    ezcDbException::GENERIC_ERROR,
                    "Tried to generate an uninque temp table name for {$maxTries} time with no luck."
                );
            }
        }

        $this->db->exec( "CREATE GLOBAL TEMPORARY TABLE $tableName ($tableDefinition)" );
        return $tableName;
    }
public function createTemporaryTable ( $ tableNamePattern , $ tableDefinition ) { $ tableNamePattern = $ this -> getPrefixedTableNames ( $ tableNamePattern ) ; if ( strpos ( $ tableNamePattern , '%' ) === false ) { $ tableName = $ tableNamePattern ; } else // generate unique table name with the given pattern { $ maxTries = 10 ; do { $ num = rand ( 10000000 , 99999999 ) ; $ tableName = strtoupper ( str_replace ( '%' , $ num , $ tableNamePattern ) ) ; $ query = "SELECT count(*) AS cnt FROM user_tables WHERE table_name='$tableName'" ; $ cnt = ( int ) $ this -> db -> query ( $ query ) -> fetchColumn ( 0 ) ; $ maxTries -- ; } while ( $ cnt > 0 && $ maxTries > 0 ) ; if ( $ maxTries == 0 ) { throw ezcDbException ( ezcDbException :: GENERIC_ERROR , "Tried to generate an uninque temp table name for {$maxTries} time with no luck." ) ; } } $ this -> db -> exec ( "CREATE GLOBAL TEMPORARY TABLE $tableName ($tableDefinition)" ) ; return $ tableName ; }
Creates a new temporary table and returns the name.

@throws ezcDbException::GENERIC_ERROR in case of inability to generate
a unique temporary table name.
@see ezcDbHandler::createTemporaryTable()


@param   string $tableNamePattern  Name of temporary table user wants
to create.
@param   string $tableDefinition Definition for the table, i.e.
everything that goes between braces after
CREATE TEMPORARY TABLE clause.
@return string                  Table name, that might have been changed
by the handler to guarantee its uniqueness.
@todo move out
Creates a new temporary table and returns the name .