O
O
oleg2016-05-12 15:16:57
PHP
oleg, 2016-05-12 15:16:57

How to solve Syntax error or access violation PDOException problem?

Good afternoon! Previously, the request worked fine, but with the change of hosting (vps), something seems to have become with the versions or php\mySQL settings.
It pops out like this:

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION admin_primary.dist does not exist
The SQL being executed was: SELECT COUNT(*) FROM `offer` `of` WHERE (((`of`.`publish`=1) AND (`online`=1)) AND (dist('53.25604370410152'g_longitude, '53.25604370410152'g_latitude, :'56.84781419393038', :'53.25604370410152') < :'7827.136630738911')) AND (kind_id<>0)
Error Info: Array
(
    [0] => 42000
    [1] => 1305
    [2] => FUNCTION admin_primary.dist does not exist
)
↵
Caused by: PDOException

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION admin_primary.dist does not exist

in /var/www/admin/data/www/site.ru/app/vendor/yiisoft/yii2/db/Command.php at line 437

Here is the validation function:
public function handleException(\Exception $e, $rawSql)
    {
        if ($e instanceof Exception) {
            throw $e;
        } else {
            $exceptionClass = '\yii\db\Exception';
            foreach ($this->exceptionMap as $error => $class) {
                if (strpos($e->getMessage(), $error) !== false) {
                    $exceptionClass = $class;
                }
            }

            $message = $e->getMessage()  . "\nThe SQL being executed was: $rawSql";
            $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
            throw new $exceptionClass($message,  $errorInfo, (int) $e->getCode(), $e);
        }
    }

Thank you very much for your attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Mokeev, 2016-05-12
@donotar

You have used a custom dist function in your database. It's not on the new server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question