gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUe-dev] explicitfields


From: Dmitry Sorokin
Subject: [GNUe-dev] explicitfields
Date: Fri, 23 May 2003 09:58:08 +0400 (MSD)

Hello all,

Question to someone with knowledge of the gnue common.


I am  using explicidfields in datasource definition in this way:

   <datasource name="dtsHotList" connection="icsinfo" table="user_hotcontact, 
company"
         explicitfields="(name || ' ' || phone) as contact_info" 
order_by="last_update desc">

It does not work with current code as "contact_info" field would be
referenced twice:

DB005: [Driver:566] SELECT phone,name,contact_info,(name || ' ' || phone) as 
contact_info,contact_id ...


------------------------------------------------------------
Error: Error while communicating with datasource.

       ERROR:  Attribute "contact_info" not found

------------------------------------------------------------


I got it working adding some code to remove duplication:

common/datasources/drivers/DBSIG2/Driver.py


class DBSIG_DataObject_Object:
  def __init__(self):

  ...

  def _buildQuery(self, conditions={}, forDetail=None, additionalSQL=""):
    dupfields = []
    for field_def in self._fieldReferences:
      field_name = string.split(field_def, " as ")
      if len(field_name)>1:
        if self._fieldReferences.has_key(field_name[1]):
                dupfields.append(field_name[1])
    for dup in dupfields:
      del self._fieldReferences[dup]

    ...


The question is: is it the right place to fix the problem or it may be
done earlier to prevent duplication in self._fieldReferences from the
beginning?

Thanks in advance,
dimas










reply via email to

[Prev in Thread] Current Thread [Next in Thread]