-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error number is detected wrongly in tracker mode #14571
Conversation
Eg when the error is `Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry`, it would detect 2300 instead of 1062. fix DEV-1683
same behaviour as for regular DB
Now PDO and MySQLi uses same code in tracker and regular mode. Ideally would refactor it to use the same method in the background. Not sure if I find time. |
Now reusing same code and added a basic test |
return $match[1] == $errno; | ||
} | ||
return false; | ||
return \Piwik\Db\Adapter\Pdo\Mysql::isPdoErrorNumber($e, $errno); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean the \Piwik\Db\Adapter\Pdo\...
classes need to be required in /piwik.php
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will merge now but @tsteur if this needs an update please go ahead and merge it in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diosmosis not sure what you mean? The files will be auto loaded if that's what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought autoloading wasn't used in the tracker side for performance (hence the require_once
s in PIWIK_INCLUDE_PATH/piwik.php
). I guess it is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is definitely used as it's needed for all the plugins etc. those requires could likely be removed.
Eg when the error is
Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
, it would detect 2300 instead of 1062.fix DEV-1683