Welcome Guest, Not a member yet? Register   Sign In
OCI8 table alias
#1

Hi.
Can anyone with Oracle knowledge audit the BaseBuilder::buildSubquery() method? And possibly add tests for the case.

I'm having doubts about the use of the "AS" keyword to specify an alias.
For most DBMSs, using "AS" is fine, but according to the link, Oracle doesn't use "AS" for tables.

PHP Code:
    protected function buildSubquery($builderbool $wrapped falsestring $alias ''): string
    
{
        if ($builder instanceof Closure) {
            $builder($builder $this->db->newQuery());
        }

        if ($builder === $this) {
            throw new DatabaseException('The subquery cannot be the same object as the main query object.');
        }

        $subquery strtr($builder->getCompiledSelect(), "\n"' ');

        if ($wrapped) {
            $subquery '(' $subquery ')';
            $alias    trim($alias);

            if ($alias !== '') {
                $subquery .= ' AS ' . ($this->db->protectIdentifiers $this->db->escapeIdentifiers($alias) : $alias);
            }
        }

        return $subquery;
    
Reply


Messages In This Thread
OCI8 table alias - by iRedds - 05-15-2022, 06:14 AM
RE: OCI8 table alias - by JustJohnQ - 05-15-2022, 12:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB