db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Reserved names in column names
Date Wed, 21 Mar 2007 08:47:15 GMT
As far as I recall, the column definitions are not generated by a template
but by the Column.getSQLString() method in the generator. You would have to
patch the Column object to get the behaviour you want (The `'s will not
hurt for the other columns if you always use mysql, but I'm not sure about
non-mysql databases).

    Thomas

Federico Fissore <federico.fissore@concept.it> schrieb am 14.03.2007
10:27:51:

> Hope this is not as trivial
>
> When generating my sql script out of the schema for the mysql database I
> get something like
>
> CREATE TABLE question_option
> (
>     id_question_option MEDIUMINT NOT NULL AUTO_INCREMENT,
>     id_question MEDIUMINT NOT NULL,
>     option VARCHAR(255) NOT NULL,
>     PRIMARY KEY(id_question_option),
>     FOREIGN KEY (id_question) REFERENCES question (id_question)
>     ) ENGINE InnoDB;
>
>
> A part the InnoDB clause that I've added to table.vm file, the problem
> here is the "option" column. "option" seems to be a reserved keyword in
> mysql so running the script fails. I'm having such an issue because
> we've developed against postgresql, which works fine, and I currently
> need to install my app onto an existing mysql
>
> The solution is really simple, prepending and appending two "`" so that
> it comes something like
>
> CREATE TABLE question_option
> (
>     id_question_option MEDIUMINT NOT NULL AUTO_INCREMENT,
>     id_question MEDIUMINT NOT NULL,
>     `option` VARCHAR(255) NOT NULL,
>     PRIMARY KEY(id_question_option),
>     FOREIGN KEY (id_question) REFERENCES question (id_question)
>     ) ENGINE InnoDB;
>
>
> Is there an option to enable such "`" for column names or something like
> that?
>
> Thank you in advance
>
> Federico
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message