User: vg      
Date: 05/03/23 02:51:42

Modified:
 /dba/dbaccess/source/core/api/
  SingleSelectQueryComposer.cxx

Log:
 INTEGRATION: CWS dba27 (1.8.20); FILE MERGED
 2005/03/15 11:37:54 fs 1.8.20.2: RESYNC: (1.8-1.9); FILE MERGED
 2005/03/11 13:44:23 oj 1.8.20.1: #i44644# make the column names unique

File Changes:

Directory: /dba/dbaccess/source/core/api/
=========================================

File [changed]: SingleSelectQueryComposer.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/SingleSelectQueryComposer.cxx?r1=1.9&r2=1.10
Delta lines:  +24 -9
--------------------
--- SingleSelectQueryComposer.cxx       10 Mar 2005 16:31:39 -0000      1.9
+++ SingleSelectQueryComposer.cxx       23 Mar 2005 10:51:38 -0000      1.10
@@ -782,6 +782,7 @@
                                for(sal_Int32 i=1;i<=nCount;++i)
                                {
                                        ::rtl::OUString sName = 
xMeta->getColumnName(i);
+                    sal_Bool bFound = sal_False;
                                        OSQLColumns::const_iterator aFind = 
::connectivity::find(aCols->begin(),aCols->end(),sName,bCase);
                                        if(aFind != aCols->end())
                                                //aNames.end() == 
::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(bCase2,sName)))
@@ -794,17 +795,16 @@
                                                                aFind = 
::connectivity::findRealName(++aFind,aCols->end(),sName,bCase);
                                                        }
                                                        
while(aColumnMap.find(aFind) != aColumnMap.end() && aFind != aCols->end());
-
-                                                       OSL_ENSURE(aFind != 
aCols->end(),"Invalid column!");
                                                }
                                                if(aFind != aCols->end())
                                                {
                                                        
(*aFind)->getPropertyValue(PROPERTY_NAME) >>= sName;
                                                        
aColumnMap.insert(::std::map<OSQLColumns::const_iterator,int>::value_type(aFind,0));
                                                        aNames.push_back(sName);
+                            bFound = sal_True;
                                                }
                                        }
-                                       else
+                                       if ( !bFound )
                                        { // we can now only look if we found 
it under the realname propertery
                                                OSQLColumns::const_iterator 
aRealFind = 
::connectivity::findRealName(aCols->begin(),aCols->end(),sName,bCase);
 
@@ -817,15 +817,30 @@
                                                                if(xProp.is() 
&& xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_REALNAME))
                                                                {
                                                                        
::connectivity::parse::OParseColumn* pColumn = new 
::connectivity::parse::OParseColumn(xProp,m_xMetaData->storesMixedCaseQuotedIdentifiers());
-                                                                       
if(sName.getLength())
-                                                                               
pColumn->setName(sName);
-                                                                       else
-                                                                               
xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
-                                                                       
pColumn->setRealName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_REALNAME)));
-                                                                       
pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME)));
                                                                        
pColumn->setFunction(::comphelper::getBOOL(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Function")))));
                                                                        
pColumn->setAggregateFunction(::comphelper::getBOOL(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AggregateFunction")))));
+
+                                    ::rtl::OUString sRealName;
+                                    xProp->getPropertyValue(PROPERTY_REALNAME) 
>>= sRealName;
+                                    ::std::vector< ::rtl::OUString>::iterator 
aFindName;
+                                                                       if ( 
!sName.getLength() )
+                                                                               
xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
+
+                                    
+                                    aFindName = 
::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(bCase2,sName));
+                                    sal_Int32 j = 0;
+                                    while ( aFindName != aNames.end() )
+                                    {                                        
+                                        sName += ::rtl::OUString::valueOf(++j);
+                                        aFindName = 
::std::find_if(aNames.begin(),aNames.end(),::std::bind2nd(bCase2,sName));
+                                    }
+
+                                    pColumn->setName(sName);
+                                                                       
pColumn->setRealName(sRealName);
+                                                                       
pColumn->setTableName(::comphelper::getString(xProp->getPropertyValue(PROPERTY_TABLENAME)));
+                                                                       
                                                                        
(*aCols)[i-1] = pColumn;
+                                    
aColumnMap.insert(::std::map<OSQLColumns::const_iterator,int>::value_type((*aCols).begin()
 + i-1,0));
                                                                }
                                                        }
                                                        aNames.push_back(sName);




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to