![]() |
Session database errors and query builder chaining - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Session database errors and query builder chaining (/showthread.php?tid=61501) |
Session database errors and query builder chaining - djroshi - 04-20-2015 I am having an issue on production server after upgrading to CI3. Additional conditions are being added to a session database query by the query builder. The two where clauses in bold are from a simple select query in an normal CI model, and I am not sure why they are being applied to an update query within the CI_Session_database_driver class. My suspicion is that because these session handler functions are registered using PHPs session_set_save_handler that they have access to the CI->db object that is concurrent with other running processes. Any thoughts on resolving this? A Database Error Occurred Error Number: 1054 Unknown column 'ur.user_id' in 'where clause' UPDATE `ci_sessions` SET `timestamp` = 1429568240, `data` = '__ci_last_regenerate|i:1429564536;' WHERE `ur`.`user_id` = '1' AND `r`.`active` = 1 AND `id` = 'efe35de70aeeab890cb68562d8058cad6e48d52b' Filename: libraries/Session/drivers/Session_database_driver.php Line Number: 243 RE: Session database errors and query builder chaining - mwhitney - 04-21-2015 My suspicion would be that you are using query caching and the session is being updated while the cache is enabled, but there's not much I can do to help without seeing the code for the model. RE: Session database errors and query builder chaining - djroshi - 04-21-2015 Thanks for your help. Query caching is definitely not enabled anywhere (either in config or manually using the cache_on() function) also, the session database driver would be throwing an error: PHP Code: elseif ($this->_db->cache_on) The model itself is utterly boring, the function in question (which is the only function in the codebase to have these specific where clauses): PHP Code: public function get_user_roles($user_id) { If you can see any issue here please let me know... RE: Session database errors and query builder chaining - mwhitney - 04-23-2015 Where is the session being used? RE: Session database errors and query builder chaining - Adrianfan - 04-24-2015 Hi all, Experiencing the same issue. Brand new installation of CI 3 from download. Enabled autoload session. Setup database for session. Error as above any thoughts on this would be appreciated. |