# #########################
# deleteAllRoleValues
# - doesn't work with mysql 3.23
# alternative uses the next two statements
#
PermissionControl.deleteAllRoleValues = DELETE jforum_role_values \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?
# 3.23 - get ids to delete
PermissionControl.getRoleIdsByGroup = SELECT DISTINCT rv.role_id \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?
# 3.23 - delete role values with ids in a csv list
# note - the ? is not a real PreparedStatement param, just a marker used to
# parse and insert the list _before_ passing to prepareStatement(sql)
# (see GenericGroupSecurityDAO.deleteAllRoles)
PermissionControl.deleteRoleValuesByRoleID = DELETE FROM jforum_role_values \
WHERE role_id IN ( ? )
2wav wrote: believe that I have identified the problem and created a not-pretty workaround for my project.
PermissionControl.deleteAllRoleValues = DELETE jforum_role_values \
FROM jforum_role_values rv, jforum_roles r \
WHERE r.role_id = rv.role_id \
AND r.group_id = ?
From MySQL 4.0, you can specify multiple tables in the DELETE statement to delete rows from one or more tables depending on a particular condition in multiple tables. However, you cannot use ORDER BY or LIMIT in a multiple-table DELETE.
The first multiple-table DELETE syntax is supported starting from MySQL 4.0.0. The second is supported starting from MySQL 4.0.2. The table_references part lists the tables involved in the join. Its syntax is described in Section 13.1.7.1, ���JOIN Syntax��?.
For the first syntax, only matching rows from the tables listed before the FROM clause are deleted. For the second syntax, only matching rows from the tables listed in the FROM clause (before the USING clause) are deleted. The effect is that you can delete rows from many tables at the same time and also have additional tables that are used for searching:
DELETE t1, t2 FROM t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;
Or:
DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.id=t2.id AND t2.id=t3.id;
yetanothersteve wrote:
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |