View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006290||OXID eShop (all versions)||4.01. Database handling||public||2015-12-17 11:41||2017-02-21 10:19|
|Product Version||4.9.2 / 5.2.2|
|Target Version||Fixed in Version||4.10.4 / 5.3.4|
|Summary||0006290: View cleanup during view generation chokes on certain table names (=> Oxid EE)|
|Description||During view generation the function "_cleanInvalidViews" is called on "oxShop". This is used to clean the database of views that are no longer needed.|
However, under certain circumstances, the existance of unusual *tablenames* (note: NOT *view* names!) can cause this function to throw database errors after creating views for subshop 1 resulting in incomplete view generation for all other subshops.
This is caused by two factors:
- The query used to select views includes an unescaped underscore (=> mysql wildcard), so not only *views* are selected but *all* tables starting with "oxv"
- The query used to drop views does not quote the view name
If a table name that is selected in the first step contains characters that are trouble in the second step we get the described DB error
|Steps To Reproduce||Setup:|
- create a database table named e.g. "oxvouchers_backup-2015-12-17"
- initiate view generation via backend
- EXCEPTION.log shows something like:
"oxConnectionException-oxException (time: 2015-12-17 09:25:26): : mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2015-12-17' at line 1] in EXECUTE (DROP VIEW IF EXISTS oxvouchers_backup-2015-12-17"
- views for other subshops are not generated
- Change view select query in function "_getAllViews" in "oxShopViewValidator" from
"SHOW TABLES LIKE 'oxv_%'"
"SHOW TABLES LIKE 'oxv\_%'"
- Change view drop query in function "_cleanInvalidViews" in "oxShop"
'DROP VIEW IF EXISTS ' . $sView
"DROP VIEW IF EXISTS `$sView`"
|Tags||No tags attached.|
|PHP Version||Not defined|
|Database Version||Not defined|
||Pull Request: https://github.com/OXID-eSales/oxideshop_ce/pull/522|
||Thanks for your pull request, Alfred. It was merged recently.|