We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Setting the isolation level

What is the best way in Phalcon to set the transaction isolation level (for a certain query)? For example to 'read uncommitted'. Would it be possible to give an example?

What do you mean by 'read uncommitted'? Getting the list of pending commits for a transaction?

I've never used isolated tx so far, but the docs might help: https://docs.phalcon.io/en/latest/reference/model-transactions.html#isolated-transactions

Hey, thanks for your reply.

What I'm looking for is a good way in Phalcon to set these kind of settings for a transaction/query: https://itecsoftware.com/with-nolock-table-hint-equivalent-for-mysql

What I mean is something like this (I do not know whether this will work / this is probably not corrrect or not the best way to do it, but maybe it better illustrates what I want to achieve)

        $sql1         = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
        $sql2         = "SELECT * FROM sometable";
        $sql3         = "COMMIT";

        $connection = $this->db;
        $connection->query($sql1);
        $data       = $connection->query($sql2);
        $connection->query($sql3);

        $data->setFetchMode(\Phalcon\Db::FETCH_ASSOC);
        $results    = $data->fetchAll();