bone007 Posted August 24, 2016 Share Posted August 24, 2016 (edited) Hello, I work on modul for import data (products) to Prestashop. In that modul I try to use something like this: Db::getInstance()->insert('specific_price', $insertData) But it didn't work. Then I realised that my database is without prefix, so I tried to use: Db::getInstance()->insert('specific_price', $insertData, $null_values = false, $use_cache = true, $type = Db::INSERT, $add_prefix = false) But with no luck. Is there some bug in Prestashop or something wrong in my code? Because when I use this script with another Prestashop with database prefix it works perfectly. Version of Prestashop is 1.5.4.1 (please don't tell me to update it's impossible right now) Thanks for any help Edited August 24, 2016 by bone007 (see edit history) Link to comment Share on other sites More sharing options...
Gabriel Perez Posted August 24, 2016 Share Posted August 24, 2016 Hi. i will recomend you to write the call without the parameters names on the optional values. Just : Db::getInstance()->insert('specific_price', $insertData, false, true, Db::INSERT, false) Are you getting an exception from the function call, or just a "false" as return? Link to comment Share on other sites More sharing options...
bone007 Posted August 24, 2016 Author Share Posted August 24, 2016 Hi. i will recomend you to write the call without the parameters names on the optional values. Just : Db::getInstance()->insert('specific_price', $insertData, false, true, Db::INSERT, false) Are you getting an exception from the function call, or just a "false" as return? Thanks for some point but no luck I got only false return and I have no idea how to debug what is wrong :-/ Link to comment Share on other sites More sharing options...
Gabriel Perez Posted August 24, 2016 Share Posted August 24, 2016 Ok, this points that the sql sentence that Prestashop is trying to query is having a bad result (duplicate entry, or similar). Do you have the debug mode active? If not, change define('_PS_MODE_DEV_', false); to define('_PS_MODE_DEV_', true); on config/defines.inc.php, and perhaps it shows new information about the problem. Link to comment Share on other sites More sharing options...
bone007 Posted August 24, 2016 Author Share Posted August 24, 2016 OK, No I got this: Fatal error: Uncaught MySQL server has gone away<br /><br /><pre>DELETE FROM `product_group_reduction_cache` WHERE `id_product` = 1</pre> thrown in /public_html/classes/db/Db.php on line 607 Do you know what that error means? I don't have anything like "DELETE group_reduction" in my script. Many thanks Link to comment Share on other sites More sharing options...
Gabriel Perez Posted August 24, 2016 Share Posted August 24, 2016 The delete sentence for product_group_reduction_cache is on the GroupReduction class, may you can check if previus to your code there is a call that can trigger this. Other than that, it seems that the mysql connection goes out, maybe a timeout or a big query. Link to comment Share on other sites More sharing options...
bone007 Posted August 24, 2016 Author Share Posted August 24, 2016 Many thanks I already fix the problem with wait_timeout in MySQL. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now