Messenger error
--- NEO UPLODAERS
DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_messenger_html5';
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '--- NEO UPLODAERS
DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_me...' at line 1
--- NEO UPLODAERS
net to be
-- NEO UPLODAERS
there is an additional minus here, so the module cannot be disabled, it generates an error in the database https://github.com/unacms/jot-client-una/blob/master/install/sql/disable.sql
-
-
·
LeonidS
- ·
Hello @Romulus !
Could you reupload the DB error screenshot? As we don't see the wrong points in the query like:
DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_messenger_html5';
-
·
LeonidS
-
- · Coozila! Lab
- ·
This is exactly the error in phpmyadmin that I posted here.
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '--- NEO UPLODAERS DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_me...' at line 1
Try to run a sql query and you will see the error in mariadb. all comments have 2 minuses, only this one has 3. and get the error i dont have any screenshot.
-
Another error generated by the notification module in this file line 20 https://github.com/unacms/una/blob/master/modules/boonex/notifications/install/sql/enable.sql a comment in sql
SET @iPBOrderDashboard = 4; --(SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'sys_dashboard' AND `cell_id` = @iPBCellDashboard LIMIT 1);
Another error is in these sql files from the notifications module due by the , comment added in sintax. Here the comment needs one more space after the two dashes.
SET @iPBOrderDashboard = 4; -- (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'sys_dashboard' AND `cell_id` = @iPBCellDashboard LIMIT 1);
I found a lot of sql files that are not compliant
-
if you have doubts about how to make a comment, check the documentation https://dev.mysql.com/doc/refman/8.4/en/comments.html
- From a
--
sequence to the end of the line. In MySQL, the--
(double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). This syntax differs slightly from standard SQL comment syntax, as discussed in Section 1.7.2.4, “'--' as the Start of a Comment”.
mysql> SELECT 1+1; # This comment continues to the end of line mysql> SELECT 1+1; -- This comment continues to the end of line mysql> SELECT 1 /* this is an in-line comment */ + 1; mysql> SELECT 1+ /* this is a multiple-line comment */ 1;
- From a
-
another example, uninstalling the notification mode gives me another error:
SET @sName = 'bx_notifications'; DROP TABLE IF EXISTS `bx_notifications_events`, `bx_notifications_events2users`, `bx_notifications_read`; DROP TABLE IF EXISTS `bx_notifications_handlers`, `bx_notifications_settings`, `bx_notifications_settings2users`; DROP TABLE IF EXISTS `bx_notifications_queue`; -- STUDIO PAGE & WIDGET DELETE FROM `tp`, `tw`, `twb`, `tpw` USING `sys_std_pages` AS `tp` LEFT JOIN `sys_std_widgets` AS `tw` ON `tp`.`id` = `tw`.`page_id` LEFT JOIN `sys_std_widgets_bookmarks` AS `twb` ON `tw`.`id` = `twb`.`widget_id` LEFT JOIN `sys_std_pages_widgets` AS `tpw` ON `tw`.`id` = `tpw`.`widget_id` WHERE `tp`.`name` = @sName;
Only after modifying the uninstall.sql file did I manage to uninstall the module.
In your SQL script, the issue arises with the `DELETE` command used to remove records from the `sys_std_pages`, `sys_std_widgets`, `sys_std_widgets_bookmarks`, and `sys_std_pages_widgets` tables. In MySQL, the `DELETE ... USING` syntax is not supported as it is in other SQL databases. Instead, MySQL requires a different approach to delete records that are related through JOINs.
Here's how you can correct the SQL command:
Correcting the `DELETE` Command
1. Delete Data from Dependent Tables:
- First, delete records from the dependent tables (i.e., tables that have `FOREIGN KEY` references to the primary tables).
2. Delete Data from Primary Tables:
- After deleting data from the dependent tables, you can then delete data from the primary tables.
Here’s how you can rephrase the SQL command to delete data from the respective tables:
SET @sName = 'bx_notifications'; -- Delete data from dependent tables DELETE `tpw` FROM `sys_std_pages_widgets` AS `tpw` JOIN `sys_std_widgets` AS `tw` ON `tpw`.`widget_id` = `tw`.`id` JOIN `sys_std_widgets_bookmarks` AS `twb` ON `tw`.`id` = `twb`.`widget_id` JOIN `sys_std_pages` AS `tp` ON `tp`.`id` = `tw`.`page_id` WHERE `tp`.`name` = @sName; DELETE `twb` FROM `sys_std_widgets_bookmarks` AS `twb` JOIN `sys_std_widgets` AS `tw` ON `twb`.`widget_id` = `tw`.`id` JOIN `sys_std_pages` AS `tp` ON `tp`.`id` = `tw`.`page_id` WHERE `tp`.`name` = @sName; DELETE `tw` FROM `sys_std_widgets` AS `tw` JOIN `sys_std_pages` AS `tp` ON `tp`.`id` = `tw`.`page_id` WHERE `tp`.`name` = @sName; DELETE `tp` FROM `sys_std_pages` AS `tp` WHERE `tp`.`name` = @sName;
Explanation
- First `DELETE`: Removes records from `sys_std_pages_widgets` (tpw) that are associated with widgets and pages where `name` equals `@sName`.
- Second `DELETE`: Removes records from `sys_std_widgets_bookmarks` (twb) that are associated with widgets with `page_id` in the specified page.
- Third `DELETE`: Removes records from `sys_std_widgets` (tw) that have `page_id` in the specified page.
- Fourth `DELETE`**: Removes records from `sys_std_pages` (tp) where `name` equals `@sName`.
This approach ensures that all records are deleted according to the relationships between the tables and prevents issues with references.
Make sure to take a complete backup of the database before running these commands, as data deletion is irreversible.
-
-
·
Alexey
- ·
Hello!
It seems you're trying to execute queries using the phpMyAdmin interface. In the UNA system, we have specific functions for handling SQL files (executeSQL), such as enable/disable, and preprocessing them. For example, in the case you're referring to, there should be at least two dashes (
--
) at the beginning of a comment line, or alternatively, you can use a space or a#
. You can start a line with any number of dashes to comment it, but the minimum requirement is two dashes (--
).When running queries from UNA's SQL files, be cautious. The interface you're using to execute queries may require specific settings, and you might need to adjust the query accordingly, especially for comments or empty values.
-
·
Alexey
-
yes I know, I just wanted to warn UNA Team that there is a mistake instead of two dashes in the source code, there are three in that comment, if someone could edit that's all