Hi All
For a Supertype/Subtype modelled entity, the common name (in literature and praxis) for the subtype discriminator attribute (column) name is type. Servoy gives a warning for a column name type.
I never have worked with a database having a problem with a column name type, but don’t know for example about DB2 (and of course others .-)
As I really would like to use the name type as subtype discriminator I am asking for the experience of other developers when naming a column attribute type. Does anyone having a problem with that on his database?
Thanks for help and best regards, Robert
It is probably a reserved word in SQL like ‘password’ and such.
So it has more to do with SQL then with the database itself.
I always use table prefixes in my colomn definitions to counter any problems (and still be able to use non-cryptic columnnames)
Hope this helps.
Hi Robert
Thanks for your tip. As you might know (from previous discussions
I don’t like pre-, post- and other fixes too much and try to keep it as simple and logical as possible (in my view only .-) and use a minimal conventions as possible.
So I would like to find out if there IS really a problem when naming a table column type (I never found one on Oracle, Sybase, …) but I do not know DB2 and SQL Server for example.
Best regards, Robert
PS: By the way, didn’t you some time ago ask for conventions? What was the result? Or was that someone else? (I can’t remember)
ROCLASI:
It is probably a reserved word in SQL like ‘password’ and such.
So it has more to do with SQL then with the database itself.
I always use table prefixes in my colomn definitions to counter any problems (and still be able to use non-cryptic columnnames)
Hope this helps.
Recently I was forced to name some columns “value” and “attribute” due to the fact that I’m sharing a DB with a Radius server, the only thing needed is to force servoy with the option “Allow reserved SQL keywords as table or column names (will fail unless supported by the backend database)” when importing the solution. I’ve not seen other problem so far.
My Backend is MySQL 5.0. Anyway check your backend documentation and as Robert said always prefix colums names when firing queries to you DB.
Robert Huber:
PS: By the way, didn’t you some time ago ask for conventions? What was the result? Or was that someone else? (I can’t remember)
That was indeed me. The total number of participants was not high enough to get a good analyzes of what the Servoy developer uses for naming conventions.
The survey did only really show that most participants of the survey didn’t use any convention that would counter any name collisions when using modules.
I am working on a whitepaper on what to consider when creating a naming convention (and it will propose one as well).
ngervasi:
My Backend is MySQL 5.0. Anyway check your backend documentation and as Robert said always prefix colums names when firing queries to you DB.
I was actually refering to table prefixes as the following example:
+--------------+
| user |
+--------------+
| usr_id |
| usr_type |
| usr_password |
| usr_name |
+--------------+
But your method also works:
SELECT user.password, user.type FROM user WHERE user.name=?;
Hi Robert
I understood you as you describe in your table as usr_id, usr_password,…
I don’t use prefixes for attributes in tables.
We use just user u and then then u.id, u.password, …
Thanks a lot for discussion, always very interesting and one can learn new ideas!
Best regards, Robert
ROCLASI:
Robert Huber:
PS: By the way, didn’t you some time ago ask for conventions? What was the result? Or was that someone else? (I can’t remember)
That was indeed me. The total number of participants was not high enough to get a good analyzes of what the Servoy developer uses for naming conventions.
The survey did only really show that most participants of the survey didn’t use any convention that would counter any name collisions when using modules.
I am working on a whitepaper on what to consider when creating a naming convention (and it will propose one as well).
ngervasi:
My Backend is MySQL 5.0. Anyway check your backend documentation and as Robert said always prefix colums names when firing queries to you DB.
I was actually refering to table prefixes as the following example:
+--------------+
| user |
±-------------+
| usr_id |
| usr_type |
| usr_password |
| usr_name |
±-------------+
But your method also works:
SELECT user.password, user.type FROM user WHERE user.name=?;