Fork me on GitHub

Watch

GitHub Core

Show your support for Zikula! Sign up at Github account and watch the Core project!




GitHub Modules

Forum Activity

Forum feed

» Visit forum | » View latest posts

Colum "SET" is not possible  Bottom

  • Hi everybody.

    Zikula 1.2.8.
    I was modifying a custom module for new requeriments. I needed a field with the name "SET", so, in pntables.php, I added a new field with this name, but when i used in pninit.php the sentence:

    Code

    if (!DBUtil::changeTable('my_table')) {
          return false;
    }

    In the update module, the process return the message error:

    Code

    Error! ActualizaciĆ³n de tabla fallida. (my_table, 1, 0 - )
    Error! Update of table

    Using the file "DBUtil.class.php" and a lines with print and die, i can see that the ChangeTable use the sentence

    Code

    ALTER TABLE my_table MODIFY COLUMN set INTEGER

    I can see that mysql "use" "set" how an own sentence and this is the reason for the error.
    If the line was:

    Code

    ALTER TABLE my_table MODIFY COLUMN `set` INTEGER

    the problem will be fixed.

    I hope that this problem can help to others developers and this "error" can be fixed in a future (ZK 1.2.9?)

    Thanks for all.
  • 'SET" is a MySQL reserved word. I would suggest a different name.
  • Yes, I know, but you can use the name "set" in tables. The problem is that the sentence that Zikula create with DBUtil do not use ` ` when use the fields. So, this sentence:

    Code

    ALTER TABLE my_table MODIFY COLUMN `set` INTEGER

    Can be used (and others examples).

    Thanks.
  • adoDB and Doctrine assumes that you don't use reserved words,
    that why they doesn't sanitize that stuff icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • if you use doctrine you can fix the problem yourself.

This list is based on users active over the last 60 minutes.