[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-09-03 Thread Lionel Elie Mamane
 connectivity/source/drivers/odbcbase/OResultSet.cxx |   60 +---
 1 file changed, 39 insertions(+), 21 deletions(-)

New commits:
commit eb0aef67c76e23e77be12deda0acfb2475368fa2
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Aug 27 17:59:42 2013 +0200

fdo#68315 odbc update *reads* a bookmark, not *writes* a bookmark

This code was completely inverted. The row update operation
*reads* a bookmark (that is, what row to update), not *writes*
a bookmark.

So we were passing an empty bookmark, and thus the update was failing
because we were refering to a non-existent row.

Change-Id: I676b1a7727a88e13a3e465bd96cbbaf18dad2fa6
Reviewed-on: https://gerrit.libreoffice.org/5649
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx 
b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index 29c834e..eb6c328 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -937,29 +937,47 @@ void SAL_CALL OResultSet::updateRow(  ) 
throw(SQLException, RuntimeException)
 
 SQLRETURN nRet;
 
-sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( 
ODBC3SQLBulkOperations ) );
-Sequencesal_Int8 aBookmark(nMaxBookmarkLen);
-if ( bPositionByBookmark )
+try
 {
-SQLLEN nRealLen = 0;
-nRet = N3SQLBindCol(m_aStatementHandle,
-0,
-SQL_C_VARBOOKMARK,
-aBookmark.getArray(),
-aBookmark.getLength(),
-nRealLen
-);
-fillNeededData(nRet = N3SQLBulkOperations(m_aStatementHandle, 
SQL_UPDATE_BY_BOOKMARK));
-aBookmark.realloc(nRealLen);
-m_aRow[0]=aBookmark;
-m_aRow[0].setBound(true);
+sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( 
ODBC3SQLBulkOperations ) );
+if ( bPositionByBookmark )
+{
+getBookmark();
+assert(m_aRow[0].isBound());
+Sequencesal_Int8 aBookmark(m_aRow[0].getSequence());
+SQLLEN nRealLen = aBookmark.getLength();
+nRet = N3SQLBindCol(m_aStatementHandle,
+0,
+SQL_C_VARBOOKMARK,
+aBookmark.getArray(),
+aBookmark.getLength(),
+nRealLen
+);
+
OTools::ThrowException(m_pStatement-getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+fillNeededData(nRet = N3SQLBulkOperations(m_aStatementHandle, 
SQL_UPDATE_BY_BOOKMARK));
+// the driver should not have touched this
+// (neither the contents of aBookmark FWIW)
+assert(nRealLen == aBookmark.getLength());
+}
+else
+{
+fillNeededData(nRet = 
N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE));
+}
+
OTools::ThrowException(m_pStatement-getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
+// unbind all columns so we can fetch all columns again with SQLGetData
+// (and also so that our buffers don't clobber anything, and
+//  so that a subsequent fetch does not overwrite m_aRow[0])
+invalidateCache();
+nRet = unbind();
+OSL_ENSURE(nRet == SQL_SUCCESS,ODBC insert could not unbind the 
columns after success);
+}
+catch(...)
+{
+// unbind all columns so that a subsequent fetch does not overwrite 
m_aRow[0]
+nRet = unbind();
+OSL_ENSURE(nRet == SQL_SUCCESS,ODBC insert could not unbind the 
columns after failure);
+throw;
 }
-else
-fillNeededData(nRet = 
N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE));
-
OTools::ThrowException(m_pStatement-getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
-// now unbind all columns so we can fetch all columns again with SQLGetData
-nRet = unbind();
-OSL_ENSURE(nRet == SQL_SUCCESS,Could not unbind the columns!);
 }
 // -
 void SAL_CALL OResultSet::deleteRow(  ) throw(SQLException, RuntimeException)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-09-03 Thread Lionel Elie Mamane
 connectivity/source/drivers/odbcbase/OResultSet.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit eed831380d3fdadc7defdbe66e7a8275507ca748
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Aug 27 18:03:21 2013 +0200

odbc insert: adjust buffer size *after* it is written to

the buffer (aBookmark) is written to by SQLBulkOperations or
SQLSetPos, not by SQLBindCol, which merely sets up the instruction
that the next call should write there. So its finak size is known
only *after* the call that makes the write, obviously.

Change-Id: I4faaaeffc060433645188f0eda3d9958b087cf6c
Reviewed-on: https://gerrit.libreoffice.org/5651
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx 
b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index eb6c328..f540f8b 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -871,7 +871,6 @@ void SAL_CALL OResultSet::insertRow(  ) throw(SQLException, 
RuntimeException)
 nRealLen
 );
 
-aBookmark.realloc(nRealLen);
 sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( 
ODBC3SQLBulkOperations ) );
 if ( bPositionByBookmark )
 {
@@ -885,6 +884,7 @@ void SAL_CALL OResultSet::insertRow(  ) throw(SQLException, 
RuntimeException)
 nRet = N3SQLSetPos( m_aStatementHandle, 1, SQL_ADD, SQL_LOCK_NO_CHANGE 
);
 fillNeededData( nRet );
 }
+aBookmark.realloc(nRealLen);
 try
 {
 
OTools::ThrowException(m_pStatement-getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-08-30 Thread Stephan Bergmann
 connectivity/source/commontools/ConnectionWrapper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e127266b1c54586f2df14ee0a1578f823e9c3ca2
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 29 16:05:01 2013 +0200

TPropertyValueLessFunctor must actually compare for 

Change-Id: I584a410d90531a0f7b784e62f94c39e715713cf1
(cherry picked from commit 2410b3c3ddc6fea02dadd56b39bb1181312c383a)
Reviewed-on: https://gerrit.libreoffice.org/5686
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx 
b/connectivity/source/commontools/ConnectionWrapper.cxx
index fbf4082..cd6d774 100644
--- a/connectivity/source/commontools/ConnectionWrapper.cxx
+++ b/connectivity/source/commontools/ConnectionWrapper.cxx
@@ -187,7 +187,7 @@ namespace
 {}
 bool operator() (const ::com::sun::star::beans::PropertyValue lhs, 
const ::com::sun::star::beans::PropertyValue rhs) const
 {
-return !!(lhs.Name.equalsIgnoreAsciiCase( rhs.Name ));
+return lhs.Name.compareToIgnoreAsciiCase(rhs.Name)  0;
 }
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-07-30 Thread Stephan Bergmann
 connectivity/source/drivers/mysql/YDriver.cxx |   36 ++
 1 file changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 9957058b1cf9460df23d03d90e2276c33ea33cdc
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Jul 30 09:01:01 2013 +0200

rhbz#989246: Honor user's JavaDriverClass override in mysql driver

(cherry picked from commit 63897351fc4fd31305bef43b649be74e2b6006c4)
Conflicts:
connectivity/source/drivers/mysql/YDriver.cxx

Change-Id: Ic7dbddb5b17af0bd23864fd19ab2bd815969d008
Reviewed-on: https://gerrit.libreoffice.org/5197
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/mysql/YDriver.cxx 
b/connectivity/source/drivers/mysql/YDriver.cxx
index 941f47c..6ff63cb 100644
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ b/connectivity/source/drivers/mysql/YDriver.cxx
@@ -47,6 +47,15 @@ namespace connectivity
 }
 }
 
+namespace
+{
+OUString getJavaDriverClass(
+css::uno::Sequencecss::beans::PropertyValue const  info)
+{
+return comphelper::NamedValueCollection(info).getOrDefault(
+JavaDriverClass, OUString(com.mysql.jdbc.Driver));
+}
+}
 
 //
 //= ODriverDelegator
@@ -157,9 +166,14 @@ namespace connectivity
 const PropertyValue* pEnd = pSupported + info.getLength();
 
 aProps.reserve(info.getLength() + 5);
+bool jdc = false;
 for (;pSupported != pEnd; ++pSupported)
 {
 aProps.push_back( *pSupported );
+if (pSupported-Name == JavaDriverClass)
+{
+jdc = true;
+}
 }
 
 if ( _eType == D_ODBC )
@@ -177,11 +191,14 @@ namespace connectivity
 }
 else if ( _eType == D_JDBC )
 {
-aProps.push_back( PropertyValue(
-::rtl::OUString(JavaDriverClass)
-,0
-
,makeAny(::rtl::OUString(com.mysql.jdbc.Driver))
-,PropertyState_DIRECT_VALUE) );
+if (!jdc)
+{
+aProps.push_back( PropertyValue(
+  ::rtl::OUString(JavaDriverClass)
+  ,0
+  
,makeAny(::rtl::OUString(com.mysql.jdbc.Driver))
+  ,PropertyState_DIRECT_VALUE) );
+}
 }
 else
 {
@@ -230,10 +247,7 @@ namespace connectivity
 }
 else
 {
-::comphelper::NamedValueCollection aSettings( info );
-::rtl::OUString sDriverClass(com.mysql.jdbc.Driver);
-sDriverClass = aSettings.getOrDefault( JavaDriverClass, 
sDriverClass );
-
+OUString sDriverClass(getJavaDriverClass(info));
 TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass);
 if ( aFind == m_aJdbcDrivers.end() )
 aFind = 
m_aJdbcDrivers.insert(TJDBCDrivers::value_type(sDriverClass,lcl_loadDriver(m_xFactory,sCuttedUrl))).first;
@@ -319,7 +333,7 @@ namespace connectivity
 }
 
 //
-Sequence DriverPropertyInfo  SAL_CALL ODriverDelegator::getPropertyInfo( 
const ::rtl::OUString url, const Sequence PropertyValue  /*info*/ ) throw 
(SQLException, RuntimeException)
+Sequence DriverPropertyInfo  SAL_CALL ODriverDelegator::getPropertyInfo( 
const ::rtl::OUString url, const Sequence PropertyValue  info ) throw 
(SQLException, RuntimeException)
 {
 ::std::vector DriverPropertyInfo  aDriverInfo;
 if ( !acceptsURL(url) )
@@ -351,7 +365,7 @@ namespace connectivity
 ::rtl::OUString(JavaDriverClass)
 ,::rtl::OUString(The JDBC driver class name.)
 ,sal_True
-,::rtl::OUString(com.mysql.jdbc.Driver)
+,getJavaDriverClass(info)
 ,Sequence ::rtl::OUString ())
 );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-07-25 Thread Lionel Elie Mamane
 connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit c39c9c8ca312e569066e9d717c00bc99613b3189
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Thu Jul 25 15:32:09 2013 +0200

fdo#67269 adapt checkTable to getTableName change

getTableName used to return schema.table;
now it returns just table
But tables are indexed by schema.table in getTables(), so reconstruct that 
for the lookup.

Change-Id: I53da1e43762b3a470e34b5dfdb0e1bb3dc914780
Reviewed-on: https://gerrit.libreoffice.org/5101
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx 
b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index 6d9abf9..a6b4904 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -239,9 +239,10 @@ void ResultSetMetaData::checkTable()
 }
 if( tables.is() )
 {
-OUString name = getTableName( 1 );
-// if( tables-hasByName( name ) )
-tables-getByName( name ) = m_table;
+const OUString name   (getTableName ( 1 ));
+const OUString schema (getSchemaName( 1 ));
+const OUString composedName( schema.isEmpty() ? name : (schema 
+ . + name) );
+tables-getByName( composedName ) = m_table;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-07-12 Thread Lionel Elie Mamane
 connectivity/source/parse/sqliterator.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1572082c1e7300fc20c33d9f87c1a7460a180d7a
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Thu Jul 11 17:42:31 2013 +0200

sort is ascending by default

Change-Id: I38354405acbbdb27b9e7ce1d19e862b7b352c850
Reviewed-on: https://gerrit.libreoffice.org/4844
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/connectivity/source/parse/sqliterator.cxx 
b/connectivity/source/parse/sqliterator.cxx
index cb17652..7967683 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -1112,7 +1112,7 @@ void OSQLParseTreeIterator::traverseByColumnNames(const 
OSQLParseNode* pSelectNo
 OSQLParseNode * pOptAscDesc = pColumnRef-getParent()-getChild(1);
 OSL_ENSURE(pOptAscDesc != NULL,OSQLParseTreeIterator: error in 
parse tree!);
 
-sal_Bool bAscending = pOptAscDesc  SQL_ISTOKEN(pOptAscDesc,ASC);
+sal_Bool bAscending = ! (pOptAscDesc  
SQL_ISTOKEN(pOptAscDesc,DESC));
 setOrderByColumnName(sColumnName, aTableRange,bAscending);
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-07-10 Thread Lionel Elie Mamane
 connectivity/source/parse/sqliterator.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 75f59b8f79f31af1ffe1fee42d093ae9269485c3
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Wed Jul 10 00:50:11 2013 +0200

fdo#58644 fix handling of subqueries

don't remove parentheses around subqueries
(without the parentheses, it is not valid SQL)

Change-Id: I4e9c55cea0276f10b0f97e31bc329949aba5b989
Reviewed-on: https://gerrit.libreoffice.org/4795
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/connectivity/source/parse/sqliterator.cxx 
b/connectivity/source/parse/sqliterator.cxx
index d2a63e2..cb17652 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -967,6 +967,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const 
OSQLParseNode* pSele
 sal_Bool bFkt(sal_False);
 pColumnRef = pColumnRef-getChild(0);
 if (
+pColumnRef-getKnownRuleID() != 
OSQLParseNode::subquery 
 pColumnRef-count() == 3 
 SQL_ISPUNCTUATION(pColumnRef-getChild(0),() 
 SQL_ISPUNCTUATION(pColumnRef-getChild(2),))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source sal/inc

2013-06-24 Thread Lionel Elie Mamane
 connectivity/source/commontools/TTableHelper.cxx |   11 +--
 sal/inc/sal/log-areas.dox|1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 8a6df1a62ded3b6da47022a5b7eec2ba6e81112c
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Fri Jun 21 15:24:15 2013 +0200

fdo#49708 when there is no Primary Key, there is no Primay Key

As opposed to a primary key with empty name and no columns (!)

Change-Id: I78ca185947a0e8d37bac64bd50add155afaeed47
Reviewed-on: https://gerrit.libreoffice.org/4432
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/connectivity/source/commontools/TTableHelper.cxx 
b/connectivity/source/commontools/TTableHelper.cxx
index 6a5ad87..863938e 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -339,12 +339,19 @@ void OTableHelper::refreshPrimaryKeys(TStringVector 
_rNames)
 if ( !bAlreadyFetched )
 {
 aPkName = xRow-getString(6);
+SAL_WARN_IF(xRow-wasNull(),connectivity.commontools, NULL 
Primary Key name);
+SAL_WARN_IF(aPkName.isEmpty(),connectivity.commontools, 
empty Primary Key name);
 bAlreadyFetched = true;
 }
 }
 
-m_pImpl-m_aKeys.insert(TKeyMap::value_type(aPkName,pKeyProps));
-_rNames.push_back(aPkName);
+if(bAlreadyFetched)
+{
+SAL_WARN_IF(aPkName.isEmpty(),connectivity.commontools, empty 
Primary Key name);
+SAL_WARN_IF(pKeyProps-m_aKeyColumnNames.size() == 
0,connectivity.commontools, Primary Key has no columns);
+m_pImpl-m_aKeys.insert(TKeyMap::value_type(aPkName,pKeyProps));
+_rNames.push_back(aPkName);
+}
 } // if ( xResult.is()  xResult-next() )
 ::comphelper::disposeComponent(xResult);
 }
diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index d943703..12cc4c7 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -36,6 +36,7 @@ certain functionality.
 
 @section connectivity
 
+@li @c connectivity.commontools
 @li @c connectivity.mork
 @li @c connectivity.parse
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-05-21 Thread Lionel Elie Mamane
 connectivity/source/drivers/flat/ETable.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit fd3e9a136da6f119e6f722ac409ff32bd52c8ea0
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Fri May 17 10:54:40 2013 +0200

fdo#47951 flat text table: update m_nRowPos when moving by bookmark

Change-Id: Iac154020b4b6309f92b1f68fa5bf79611dfcc91b
Reviewed-on: https://gerrit.libreoffice.org/3961
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/flat/ETable.cxx 
b/connectivity/source/drivers/flat/ETable.cxx
index 9fe48f0..8ae7935 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -869,15 +869,29 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement 
eCursorPosition, sal_Int
 break;
 case IResultSetHelper::BOOKMARK:
 {
+m_nRowPos = 0;
 TRowPositionsInFile::const_iterator aFind = 
m_aFilePosToEndLinePos.find(nOffset);
 m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
 if ( m_bNeedToReadLine )
 {
 m_nFilePos  = aFind-first;
 nCurPos = aFind-second;
+for(::std::mapsal_Int32, 
TRowPositionsInFile::iterator::const_iterator p = m_aRowPosToFilePos.begin();
+p != m_aRowPosToFilePos.end();
+++p)
+{
+assert(p-second-first = nOffset);
+if(p-second-first == nOffset)
+{
+m_nRowPos = p-first;
+break;
+}
+}
+assert(m_nRowPos  0);
 }
 else
 {
+assert(false);
 m_nFilePos = nOffset;
 m_pFileStream-Seek(nOffset);
 if (m_pFileStream-IsEof() || !readLine(nCurPos) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-04-23 Thread Olivier Ploton
 connectivity/source/parse/sqlnode.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit ade0bd686190aa7016c2d0e1dab231cb15365fde
Author: Olivier Ploton olivier.plo...@univ-tours.fr
Date:   Wed Dec 12 22:04:38 2012 +0100

Base: fix incorrect field removal in criterion inside query design view

Includes following master commits:

commit 6536d0eb4f56e64c9b74b358642e3ee1e39353e5
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Apr 23 06:44:57 2013 +0200

reword comment

commit 5143e162f81ec64db4ed2b11a3a79183c4901c79
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Apr 23 06:44:42 2013 +0200

isEmpty() instead of getLength()==0

commit f0c38b6355333c0bbb02e52a732f04ab0d519ecf
Author: Olivier Ploton olivier.plo...@univ-tours.fr
Date:   Wed Dec 12 22:04:38 2012 +0100

Base: fix incorrect field removal in criterion inside query design view

Change-Id: I2fedae672c24a269fca3dfc1bacc66fd53fc61af
Signed-off-by: Miklos Vajna vmik...@suse.cz

diff --git a/connectivity/source/parse/sqlnode.cxx 
b/connectivity/source/parse/sqlnode.cxx
index 73fd510..4704b74 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -463,8 +463,13 @@ void 
OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer rString,
 if (rParam.xField.is()  SQL_ISRULE(pSubTree,subquery))
 aNewParam.xField = NULL;
 
-// if there is a field given we don't display the fieldname, if 
there is any
-if (rParam.xField.is()  SQL_ISRULE(pSubTree,column_ref))
+// When we are building a criterion inside a query view,
+// simplify criterion display by removing:
+//   currentFieldName
+//   currentFieldName =
+// but only at the very beginning of the criterion
+// (not embedded deep in the expression).
+if (rString.getLength() == 0  rParam.xField.is()  
SQL_ISRULE(pSubTree,column_ref))
 {
 sal_Bool bFilter = sal_False;
 // retrieve the fields name
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-04-15 Thread Lionel Elie Mamane
 connectivity/source/drivers/odbcbase/OTools.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit b475a63edea91daccfc179506b53a5f2ae7fc12b
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Mon Apr 15 01:27:39 2013 +0200

fdo#61142 mixup between size and length

Change-Id: Ia2903d5139378e97bb2e8d00ccb2c213d3e1dee6
Reviewed-on: https://gerrit.libreoffice.org/3385
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx 
b/connectivity/source/drivers/odbcbase/OTools.cxx
index d568b7f..7165c4d 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -424,11 +424,15 @@ Sequencesal_Int8 OTools::getBytesValue(const 
OConnection* _pConnection,
 // we assume everyone (LibO  ODBC) uses UTF-16; see 
OPreparedStatement::setParameter
 BOOST_STATIC_ASSERT(sizeof(sal_Unicode) == 2);
 BOOST_STATIC_ASSERT(sizeof(SQLWCHAR)== 2);
+BOOST_STATIC_ASSERT(sizeof(waCharArray) % 2 == 0);
+// Size == number of bytes, Len == number of UTF-16 code units
+const SQLLEN nMaxSize = sizeof(waCharArray);
+const SQLLEN nMaxLen  = sizeof(waCharArray) / sizeof(sal_Unicode);
+BOOST_STATIC_ASSERT(nMaxLen * sizeof(sal_Unicode) == nMaxSize);
+
 // read the unicode data
-const SQLLEN nMaxLen = sizeof(waCharArray) / sizeof(sal_Unicode);
 SQLLEN pcbValue = SQL_NO_TOTAL;
-
-while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue = nMaxLen) )
+while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue = nMaxSize) )
 {
 OTools::ThrowException(_pConnection,

(*(T3SQLGetData)_pConnection-getOdbcFunction(ODBC3SQLGetData))(
@@ -446,7 +450,7 @@ Sequencesal_Int8 OTools::getBytesValue(const OConnection* 
_pConnection,
 SQLLEN nReadChars;
 OSL_ENSURE( (pcbValue  0) || (pcbValue % 2 == 0),
 ODBC: SQLGetData of SQL_C_WCHAR returned odd number 
of bytes);
-if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue = nMaxLen) )
+if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue = nMaxSize) )
 {
 // we filled the buffer; remove the terminating null character
 nReadChars = nMaxLen-1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-04-15 Thread Lionel Elie Mamane
 connectivity/source/drivers/postgresql/pq_statement.cxx |2 +-
 connectivity/source/drivers/postgresql/pq_tools.cxx |   14 --
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 3695b86bc35fc8c1011ca6d629cdd28bcd7c15aa
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Wed Apr 10 17:16:27 2013 +0200

pgsql-sdbc: set tablename even if we do not know the schema

Change-Id: I74c04e1262cc413696a12aca9af603beded7b07f
Reviewed-on: https://gerrit.libreoffice.org/3342
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx 
b/connectivity/source/drivers/postgresql/pq_statement.cxx
index 7304b15..edf7dc3 100644
--- a/connectivity/source/drivers/postgresql/pq_statement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_statement.cxx
@@ -654,7 +654,7 @@ bool executePostgresCommand( const rtl::OString  cmd, 
struct CommandData *data
 }
 
 }
-else if( sourceTable.getLength()  -1 != sourceTable.indexOf( '.' ) )
+else if( sourceTable.getLength()  0)
 {
 splitConcatenatedIdentifier( sourceTable, schema, table );
 }
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx 
b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 84d9741..86872a7 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -673,10 +673,20 @@ void splitConcatenatedIdentifier( const rtl::OUString  
source, rtl::OUString *f
 {
 OStringVector vec;
 tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec 
);
-if( vec.size() == 3 )
+switch (vec.size())
 {
-*first = rtl::OStringToOUString( vec[0] , RTL_TEXTENCODING_UTF8 );
+case 1:
+*first  = OUString();
+*second = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
+break;
+case 3:
+*first  = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 );
 *second = rtl::OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 );
+break;
+default:
+ SAL_WARN(connectivity.drivers.postgresql,
+  pq_tools::splitConcatenatedIdentifier unexpected number of 
tokens in identifier: 
+   vec.size());
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-04-15 Thread Lionel Elie Mamane
 connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx |   11 
--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit c15217f477f0a9810811746796d778a5d20b89d5
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Wed Apr 10 17:15:23 2013 +0200

pgsql-sdbc: ResultSetMetaData::getTableName return tablename (without 
schema)

Change-Id: I319ba91045fa43922d7b694a4f13322295590c81
Reviewed-on: https://gerrit.libreoffice.org/3343
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx 
b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index f6089cc..6d9abf9 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -407,16 +407,7 @@ sal_Int32 ResultSetMetaData::getScale( sal_Int32 column )
 {
 (void) column;
 // LEM TODO This is very fishy.. Should probably return the table to which 
that column belongs!
-rtl::OUString ret;
-if( m_tableName.getLength() )
-{
-OUStringBuffer buf( 128 );
-buf.append( m_schemaName );
-buf.appendAscii( . );
-buf.append( m_tableName );
-ret = buf.makeStringAndClear();
-}
-return ret;
+return m_tableName;
 }
 
 ::rtl::OUString ResultSetMetaData::getCatalogName( sal_Int32 column )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - connectivity/source

2013-04-02 Thread Fridrich Štrba
 connectivity/source/drivers/mozab/MDriver.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit c976cd58b7bee71ea43dd1f4aad3b1c1fcb32516
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Tue Apr 2 12:38:45 2013 +0200

Fix debug build

Change-Id: I1a4db30f4cc33ee99b48a25db6e6fcd600d00ffd
Reviewed-on: https://gerrit.libreoffice.org/3168
Reviewed-by: Andras Timar ati...@suse.com
Tested-by: Andras Timar ati...@suse.com

diff --git a/connectivity/source/drivers/mozab/MDriver.cxx 
b/connectivity/source/drivers/mozab/MDriver.cxx
index 2830528..e1a4401 100644
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -272,7 +272,10 @@ namespace
 
 if ( !_rFunction )
 {   // did not find the symbol
-OSL_FAIL( ( ::rtl::OString( 
lcl_getFunctionFromModuleOrUnload: could not find the symbol  ) + 
::rtl::OString( _pAsciiSymbolName ) ).getStr() );
+rtl::OUStringBuffer aBuf;
+aBuf.append( lcl_getFunctionFromModuleOrUnload: could not 
find the symbol  );
+aBuf.append( sSymbolName );
+OSL_FAIL( aBuf.makeStringAndClear().getStr() );
 osl_unloadModule( _rModule );
 _rModule = NULL;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits