[Date Prev][Date Next]
Re: Back-sql and reserved words (ITS#3221)
>Full_Name: Paul Koetsier
>Submission from: (NULL) (188.8.131.52)
After further investigation, I found out that some of the currently
don't like the double quotes around aliases. In HEAD/RE22 there is some
you may want to play with to see if it fixes your problem. In
back-sql.h there is a
BACKSQL_ALIASING macro that allows to define if aliasing uses the
or not. By deafult it is set to "AS ", but it can be set to "" to avoid
using it. This
has little to do with your problem, I'm writing it here only to leave
trace of it. The second
macro, BACKSQL_ALIASING_QUOTE, allows to define what char is used to quote
aliases. By default it is undefined. Define it to the desired char
('"' in your case").
With PostgreSQL/MySQL/IBM db2 the default works fine; let me know if any
proposed changes works with MaxDB.
>I'm running into a problem with reserved words when trying to use back-sql
>together with MaxDB.
>When trying to store inetOrgPerson entries in a table, I discovered that "uid"
>is a reserved word in MaxDB. I therefore tried storing this attribute in a
>column called uitattr. However, when trying to retrieve entries, I noticed that
>back-sql was trying to perform a query that uses the attribute name as an alias
>and were failing as a result:
>backsql_get_attr_values(): error preparing query: SELECT certificateuser.uidattr
>AS uid FROM certificateuser WHERE certificateuser.id=?
>Return code: -1
>Native error code: -7006
>SQL engine state: 3006
>As MaxDB accepts the use of reserved words as an alias when enclosed in double
>quotes, I decided to make the following change to
>< backsql_strfcat( &tmps, &tmpslen, "lblblblbcbl",
>> backsql_strfcat( &tmps, &tmpslen, "lblcbclblbcbl",
>< (ber_len_t)sizeof( " AS " ) - 1, " AS ",
>> (ber_len_t)sizeof( " AS " ) - 1, " AS ",
>This patch is working fine for me.
>Would this be the correct way to resolve the issue?
SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497