User: hr Date: 06/04/19 06:23:17 Modified: /dba/dbaccess/source/ui/misc/ TableCopyHelper.cxx
Log: INTEGRATION: CWS oj17 (1.5.42); FILE MERGED 2006/03/09 07:47:16 oj 1.5.42.1: #i62561# use a prepared statement when the rowset can not be used for insertion File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: TableCopyHelper.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/TableCopyHelper.cxx?r1=1.5&r2=1.6 Delta lines: +2 -40 -------------------- --- TableCopyHelper.cxx 16 Jan 2006 15:29:20 -0000 1.5 +++ TableCopyHelper.cxx 19 Apr 2006 13:23:14 -0000 1.6 @@ -211,49 +211,10 @@ for(sal_Int32 k=1;k <= nCount;++k) aColumnTypes.push_back(xMeta->getColumnType(k)); - // create sql string and set column types - Reference<XNameAccess> xNameAccess = xColsSup->getColumns(); - Sequence< ::rtl::OUString> aSeq = xNameAccess->getElementNames(); - if ( aSeq.getLength() == 0 ) - { - return; - } - const ::rtl::OUString* pBegin = aSeq.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aSeq.getLength(); - ::std::vector< ::rtl::OUString> aInsertList; - aInsertList.resize(aSeq.getLength()+1); - sal_Int32 i = 0; - for(sal_uInt32 j=0; j < aInsertList.size() ;++i,++j) - { - ODatabaseExport::TPositions::const_iterator aFind = ::std::find_if(_rvColumns.begin(),_rvColumns.end(), - ::std::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),i+1),::std::select2nd<ODatabaseExport::TPositions::value_type>())); - if ( _rvColumns.end() != aFind && aFind->second != CONTAINER_ENTRY_NOTFOUND && aFind->first != CONTAINER_ENTRY_NOTFOUND ) - { - aInsertList[aFind->first] = ::dbtools::quoteName( aQuote,*(pBegin+i)); - } - } - - i = 1; - // create the sql string - for (::std::vector< ::rtl::OUString>::iterator aInsertIter = aInsertList.begin(); aInsertIter != aInsertList.end(); ++aInsertIter) - { - if ( aInsertIter->getLength() ) - { - aSql += *aInsertIter; - aSql += aComma; - aValues += aPara; - } - } - - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - aValues = aValues.replaceAt(aValues.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); - - aSql += aValues; // now create,fill and execute the prepared statement - Reference< XPreparedStatement > xPrep(_xMetaData->getConnection()->prepareStatement(aSql)); + Reference< XPreparedStatement > xPrep(ODatabaseExport::createPreparedStatment(_xMetaData,_xDestTable,_rvColumns)); Reference< XParameters > xParameter(xPrep,UNO_QUERY); - sal_Int32 nRowCount = 0; const Any* pSelBegin = _aSelection.getConstArray(); const Any* pSelEnd = pSelBegin + _aSelection.getLength(); @@ -853,6 +814,7 @@ else m_pController->showError(SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*m_pController,::rtl::OUString::createFromAscii("S1000") ,0,Any())); } +// ----------------------------------------------------------------------------- //........................................................................ } // namespace dbaui //........................................................................ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
