File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,25 @@ public function getVersion(): string
487487 return $ version ;
488488 }
489489
490+ /**
491+ * Method checks if a table exists in the current database.
492+ * @param string $tableName
493+ * @return bool
494+ * @throws Exception
495+ */
496+ public function tableExists (string $ tableName ): bool
497+ {
498+ $ tableExists = false ;
499+
500+ $ sql = 'SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ? ' ;
501+ $ statement = $ this ->queryPrepared ($ sql , array (DB_NAME , $ tableName ));
502+ if ($ statement ->fetchColumn () > 0 ) {
503+ $ tableExists = true ;
504+ }
505+
506+ return $ tableExists ;
507+ }
508+
490509 /**
491510 * Method gets all columns and their properties from the database table.
492511 *
Original file line number Diff line number Diff line change 232232
233233// update session recordset (i.a. refresh timestamp)
234234$ gCurrentSession ->setValue ('ses_reload ' , 0 );
235- $ gCurrentSession ->save ();
235+ if ($ gCurrentSession ->isNewRecord () && !$ gDb ->tableExists (TBL_LOG )) {
236+ //temporary disable logging cause log table doesn't exist yet
237+ $ gCurrentSession ->setLoggingEnabled (false );
238+ $ gCurrentSession ->save ();
239+ $ gCurrentSession ->setLoggingEnabled (true );
240+ } else {
241+ $ gCurrentSession ->save ();
242+ }
236243
237244// create the necessary objects and parameters
238245
You can’t perform that action at this time.
0 commit comments