staudenmeir / laravel-cte

Laravel queries with common table expressions
MIT License
535 stars 40 forks source link

Oracle Driver (revived from #31) #49

Closed wakjoko closed 1 year ago

wakjoko commented 1 year ago

hi @staudenmeir

i'm looking into oracle since few days ago and after reading issue #31, i tried on my local with hints you provided in oracle-laravel-6 branch and i can confirm it is working fine.

just wondering, would you like to get oracle driver included in this package?

staudenmeir commented 1 year ago

Hi @wakjoko, Absolutely, thanks for testing it. I closed the other ticket after not getting feedback for a year.

What Laravel version are you using?

wakjoko commented 1 year ago

I'm using the latest released version 10 for both laravel and yajra's oci8 package.

Additionally, i added conditional return based on db driver at L16.

Would be nicer if we can resolve the appropriate Builder class without the conditional return at all.

staudenmeir commented 1 year ago

Additionally, i added conditional return based on db driver at L16.

Can you share this snippet?

wakjoko commented 1 year ago

mine look like this..

protected function newBaseQueryBuilder()
{
    $connection = $this->getConnection();

    if($connection->getDriverName() === 'oracle') {
        return new \Staudenmeir\LaravelCte\Query\OracleBuilder($connection);
    }

    return new Builder($connection);
}
staudenmeir commented 1 year ago

I created a new branch for Laravel 10. Please test it by updating the package version in your composer.json:

"staudenmeir/laravel-cte": "dev-oracle-support",
wakjoko commented 1 year ago

looks good, will test it out tmr 😉

wakjoko commented 1 year ago

thanks! cte queries works great with yajra oracle driver, smooth like you. this is good to go but if you require unit testing, will have to spend another time on that part.

staudenmeir commented 1 year ago

I started with integration tests, but that's quite the adventure... I'll probably release it without tests for now.

For the README: Do you know the minimum Oracle version that supports CTEs? I didn't find that in their documentation.

wakjoko commented 1 year ago

WITH clause was introduced since Oracle 9.2 but I'm testing on Oracle 11g (2009), vs now it's 21c.

btw, yajra's oci8 package is updated well so I'm totally confident to release this feature without testing for now.

staudenmeir commented 1 year ago

Thanks. I released a new version with Oracle support.