[OpenSER-Devel] SF.net SVN: openser: [3972] trunk
Daniel-Constantin Mierla
miconda at gmail.com
Thu Apr 3 22:04:00 CEST 2008
On 04/03/08 22:32, Dan Pascu wrote:
> On Thursday 03 April 2008, Daniel-Constantin Mierla wrote:
>
>> On 04/03/08 21:25, Dan Pascu wrote:
>>
>>> On Thursday 03 April 2008, Daniel-Constantin Mierla wrote:
>>>
>>>> there is the option to set the column name via module parameters in
>>>> siptrace module. Therefore the existing table structure and
>>>> additional external tools can be kept untouched, just set the
>>>> parameter in the configuration file.
>>>>
>>> Of course, but the table will be created with the new column name,
>>> unless the db schema is also patched. And the applications using the
>>> sip_trace table need to be modified as well. That's why I said it is
>>> disruptive.
>>>
>> You are right, but we are improving ourselves with the time ... that
>> column name was prone to this case, it was a bad choice of myself.
>>
>
> It is prone to nothing if quoted properly. I do not know about oracle, but
> in mysql and postgress you can quote the column name, table name, etc to
> make sure it won't cause a problem if it is a reserved word. I would be
> surprised if oracle doesn't have a quoting mechanism.
>
>
>> Renaming was the solution applied in the past for similar cases.
>> Finding the least disruptive solution should be a priority, but also
>> clean and straight environment is important.
>>
>> One more rule for module developers, if they add new tables, should
>> check the names of the columns against reserved keywords of the common
>> database systems -- hope google can give the list :-)
>>
>
> That is a very poor solution. Considering how many databases are supported
> and that each of them has its own set of reserved words, we will find it
> very difficult to chose simple straightforward column names that satisfy
> all database backends. This is why quoting was invented so one is not in
> a position to check 3 database implementation trying to avoid keywords.
> Even more what guarantee do you have that a word you use won't become a
> keyword in the future. This actually happened to me. In mysql 4.x using
> `condition` posed no problem, but in 5.x it became a keyword and it had
> to be quoted. Now if we have a quoting mechanism (and we have one for
> mysql and postgress, not sure about oracle) I propose we use whatever
> column names we like and make the db schema generate quoted column and
> table names with the appropriate quoting for that database. As I said for
> mysql one has to use backticks, while for postgres it's single quotes.
> This is the most safe and clean solution that imposes no restrictions on
> developers. Why would I, as a developer have to learn about databases I
> do not use just trying to avoid names they don't like?
>
True as well, but is quite big impact, at least the openserctl will
require major rewriting. The db api in openser tries to use the common
framework for all databases, not to have db-type dependent code. DB
modules have to be updated, too, afaik none is doing column name
quoting. Don't know how has to be done for unixodbc, where the db system
behind is dynamic.
At the end is a trade-off between trying to be as much as possible db
type independent, simplicity and flexibility. By your way, would not be
necessary to have parameters to set the column names, most modules have
it just because of similar situations. I will be happy to see quoting
column names support in the db modules ;)
Cheers,
Daniel
--
http://www.asipto.com
More information about the Devel
mailing list