User tests: Successful: Unsuccessful:
Array of tables names passed to JDatabaseQueryElement constructor on delete method
$query=new JDatabaseQueryMysqli;
$query->delete('table');
echo $query;
DELETE table
FROM table
DELETE
FROM table
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Category | Libraries | ⇒ | Libraries Unit Tests |
Sure
So if nothing has changed between the actual and expected result what is the purpose of this PR?
The description fixed. With my changes you can able build a multy-tables delete sql query.
Based on the MySQL docs this doesn't look correct, see https://dev.mysql.com/doc/refman/5.7/en/delete.html
It also seems that other database drivers do not support this syntax. PostgreSQL doesn't (or if it does the doc page and examples do a terrible job communicating it).
@mbabker see https://dev.mysql.com/doc/refman/5.7/en/delete.html#idm139816361856752
For MySQL it's correct.
For PostgreSQL seems doesn't.
For some reason I was expecting table_references
to be a multi-table FROM, scrolling the page now I see it uses JOIN statements. I really shouldn't read PRs and SQL docs before
If this is MySQL only syntax then it needs to be put in the MySQL subclasses, otherwise we need to come up with a way to emulate this for drivers that don't natively support it.
maybe too tired but what means ?
DELETE table
FROM table
please post an example use case
The example in the MySQL docs is better than what's here, see https://dev.mysql.com/doc/refman/5.7/en/delete.html#idm139816361732224
But basically you can construct a DELETE query to delete rows from multiple tables if you use the appropriate JOIN and WHERE conditions.
maybe i'm wrong but this doesn't seems to me an "SQL" standard DELETE statement
Labels |
Added:
?
|
The changes moved to MySQLi subclass
Category | Libraries Unit Tests | ⇒ | Libraries |
@HLeithner Should this be closed as it appears to be a new feature for MySQL only and not a bug?
Thanks Quy, yes this would not go into j3 anyway and is something for the framework. But it seams to be a special case which shouldn't be done with the query builder.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-01-02 07:25:28 |
Closed_By | ⇒ | HLeithner |
Is the description correct? the expected and actual results are identical