Bug delete with table alias

Bug delete with table alias

belubelu Posts: 38Questions: 14Answers: 0

Hi,

I think I found a bug:
If you use a table on instancing editor alias like this:
$editor = Editor::inst( $db, 'guestlist_disabled_dates as guestlist', 'id' );
deleting a row with buttons is not possible due to an sql-statement error:
"DELETE FROM guestlist_disabled_dates as guestlist WHERE (guestlist_disabled_dates.id = :where_1 )"
This throws an SQL error.

thanks,
Bernhard

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    This throws an SQL error.

    Telling us what the error actually says would have been sensible.

    You have aliased your table so use the alias in your WHERE clause.

  • belubelu Posts: 38Questions: 14Answers: 0

    The SQL query is generated by editor and not by myself...

    here the error:
    An SQL error occurred: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as guestlist WHERE (guestlist.id = '29' )' at line 1

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Can you post the Editor code please? I'm not clear why a row with Buttons is different to any other row.

    Colin

This discussion has been closed.