Doctrine error - Prepared statement needs to be re-prepared

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Dadinos2
User
Posts: 52

Doctrine error - Prepared statement needs to be re-prepared

Post by Dadinos2 »

I am migrating a project from V2020 to the new V2021 version.

I have a strange error:

vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractMySQLDriver.php(110): An exception occurred while executing 'SELECT COUNT(*) FROM `employeelist`': Prepared statement needs to be re-prepared

The table that I open is the orders table, where is the employeelist select comming from and why?

The employeeslist is a view and connected as a child table that is connected by its ID in the orders table.

Seems that all views gives problems and give the error: Prepared statement needs to be re-prepared error?

Is there a way to solve this Prepared statement needs to be re-prepared error?

Regards,
Aren

arbei
User
Posts: 9388

Post by arbei »

You may try: Click Tools -> Advanced Setting, change "MySQL driver" from "mysqli" to "pdo_mysqli".


Dadinos2
User
Posts: 52

Post by Dadinos2 »

Thanks, that did the trick. Works now!


edcave
User
Posts: 5

Post by edcave »

arbei wrote:

You may try: Click Tools -> Advanced Setting, change "MySQL driver" from "mysqli" to "pdo_mysqli".

Yes!! this works! Thanks!


lucasgirod
User
Posts: 19

Post by lucasgirod »

I created a new mysql database with just one table (persons) with just an id, firstname and lastname. Then I created a view (select * from persons).

Everything works fine on my local XAMPP (Apache 2.4.46 with PHP 7.4.13 and MariaDB 10.4.17)

When I use it on the productive server (nginx/1.18.0 with PHP 7.4.13 and MariaDB 10.3.27) using mysqli as database driver I get the error.
The error seems to happen in the following query:
SELECT COUNT(*) FROM `personsquery`;

/var/www/vhosts/meine.church/httpdocs/mc_phpmaker/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php Line: 128 Trace: #0 /var/www/vhosts/meine.church/httpdocs/mc_phpmaker/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(182): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\Mysqli\Exception\StatementError)) #

When I switch to pdo_mysql it works for that simple setup. But more complex projects do not work, as soon as e.g. queries are used in filters I get PHP fatal errors.


lucasgirod
User
Posts: 19

Post by lucasgirod »

Got it up and running now - it works now with pdo_sql.

The filter errors were due to a code change needed in Page_DataRendering.

The "prepared statement needs to be re-prepared" seems to come from a bug in MariaDB 10.3


wunganayi
User
Posts: 19

Post by wunganayi »

Which files should we generate again, Changed:
Tools -> Advanced Setting, change "MySQL driver" from "mysqli" to "pdo_mysqli".

But still error persists

Works if I add:
$info["driver"] = "pdo_mysql";

In Database_Connecting Function. The error occurs when you use Views


arbei
User
Posts: 9388

Post by arbei »

You need to generate phpfn.php again.


Post Reply