silverstripe / silverstripe-sqlite3

SQLite3 DB Adapter for Silverstripe
BSD 3-Clause "New" or "Revised" License
8 stars 19 forks source link

sqlite Version compare #56

Closed sasky closed 5 years ago

sasky commented 5 years ago

Hello. Im having trouble with this function on the classSQLite3Database

    public function supportsTransactions()
    {
        return version_compare($this->getVersion(), '3.6', '>=');
    }

I'm running the latest stable version of sqlite which confusingly is 3.25.3 so that version compare fails. Seems like sqlite changed their versioning system back in 2015. So 3.25.3 should be much greater than 3.6.

https://www.sqlite.org/versionnumbers.html

https://sqlite.org/chronology.html

robbieaverill commented 5 years ago

It seems like it's working to me: https://eval.in/1062760 - am I missing something?

sasky commented 5 years ago

Ha, oh sorry. I guess I just amused that was the bit that wasn't working. My bad. I feel dumb. When I am using sqlite to test in the cli. I hit this error

    public function transactionDepth()
    {
        // Placeholder error for transactional DBs that don't expose depth
        if ($this->supportsTransactions()) {
            user_error(get_class($this) . " does not support transactionDepth", E_USER_WARNING);
        }
        return 0;
    }

from SilverStripe\ORM\Connect\Database

adding these two functions to SilverStripe\SQLite\SQLite3Database has sorted it out.

    public function supportsTransactions()
    {
        return true;
    }

    public function transactionDepth()
    {
        return true;
    }

Does that need to be a seperate issue ? Or am I still being dumb?

robbieaverill commented 5 years ago

I think it's pretty unlikely that you're being dumb. Which version of SilverStripe 4 are you using? For 4.2 (?) or above you need to use silverstripe/postgresql 2.1 rather than 2.0

sasky commented 5 years ago

Oh, I'm using 4.2 I'm mot using any version of silverstripe/postgresql. Sorry but what does postgresql have todo with sqlite? I don't see that as a dependancy?

robbieaverill commented 5 years ago

Sorry, I mixed up the DB adapters. Try 2.1 of sqlite

sasky commented 5 years ago

Ha, makes sense. Cheers

maxime-rainville commented 5 years ago

@sasky Did using version 2.1 solve your issue?

sasky commented 5 years ago

@maxime-rainville yes it did, Thanks