News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Alter table bug

Started by Arbalot, December 26, 2007, 11:45:38 AM

Previous topic - Next topic

Arbalot

ManageSmileys.php line between 651 and 654

// Sort all smiley codes for more accurate parsing (longest code first).
      db_query("
          ALTER TABLE {$db_prefix}smileys
          ORDER BY LENGTH(code) DESC", __FILE__, __LINE__);


Alter table command is not use with order by...

Thanks
Arbalot

codenaught

Take a look at this: http://docs.simplemachines.org/index.php?topic=1079.0.

It is actually allowed, just certain versions of MySQL do not support it. The part that can have trouble is the LENGTH part.
Dev Consultant
Former SMF Doc Coordinator

Thantos

Quote from: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
ORDER BY enables you to create the new table with the rows in a specific order. Note that the table does not remain in this order after inserts and deletes. This option is useful primarily when you know that you are mostly to query the rows in a certain order most of the time. By using this option after major changes to the table, you might be able to get higher performance. In some cases, it might make sorting easier for MySQL if the table is in order by the column that you want to order it by later.

ORDER BY syntax allows for one or more column names to be specified for sorting, each of which optionally can be followed by ASC or DESC to indicate ascending or descending sort order, respectively. The default is ascending order. Only column names are allowed as sort criteria; arbitrary expressions are not allowed.

Alter table and order by can be used together.  However, if you change the table to InnoDB then the order by will break.  But you shouldn't change the storage engine for that table to begin with.

Arbalot

ohh ok thanks...

"alter table" is not use with "order by" to oracle :)
and my mysql versiyon is old sorry :)

SleePy

Quote from: Arbalot on December 26, 2007, 12:13:03 PM
ohh ok thanks...

"alter table" is not use with "order by" to oracle :)
and my mysql versiyon is old sorry :)

I would suggest upgrading as mysql has dropped support for mysql 4. They only will be fixing major security issues for a few more years
http://www.mysql.com/company/legal/lifecycle/#calendar
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: