[Libreoffice-commits] core.git: 2 commits - connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Wed Jun 17 05:19:58 PDT 2015


 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx |    2 
 connectivity/source/drivers/postgresql/pq_tools.cxx             |   34 +++++++---
 2 files changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 5652313e8a1aee00fd973cdcdd0d04071a8abd31
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jun 17 14:00:46 2015 +0200

    postgresql-sdbc: fixup string2intarray
    
    this allows getGeneratedValues to work
    
    Change-Id: Ia87e87afa8cdb01f1d39c84bc7d7143c101d8891

diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 8cd156f..4d75e8c3 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -862,33 +862,46 @@ com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const OUString & str
     if( str.getLength() > 1 )
     {
         sal_Int32 start = 0;
-        while ( iswspace( str.iterateCodePoints(&start) ) )
+        sal_uInt32 c;
+        while ( iswspace( (c=str.iterateCodePoints(&start)) ) )
             if ( start == strlen)
                 return ret;
-        if ( str.iterateCodePoints(&start) != L'{' )
+        if ( c != L'{' )
             return ret;
-        while ( iswspace( str.iterateCodePoints(&start) ) )
+        while ( iswspace( c=str.iterateCodePoints(&start) ) )
             if ( start == strlen)
                 return ret;
-        if ( str.iterateCodePoints(&start, 0) == L'}' )
+        if ( c == L'}' )
             return ret;
 
         std::vector< sal_Int32 > vec;
         do
         {
             OUString digits;
-            sal_Int32 c;
-            while ( isdigit( c = str.iterateCodePoints(&start) ) )
+            do
             {
+                if(!iswspace(c))
+                    break;
                 if ( start == strlen)
                     return ret;
-                digits += OUString(c);
-            }
+            } while ( (c=str.iterateCodePoints(&start)) );
+            do
+            {
+                if (!iswdigit(c))
+                    break;
+                if ( start == strlen)
+                    return ret;
+                digits += OUString(&c, 1);
+            } while ( (c = str.iterateCodePoints(&start)) );
             vec.push_back( digits.toInt32() );
-            while ( iswspace( str.iterateCodePoints(&start) ) )
+            do
+            {
+                if(!iswspace(c))
+                    break;
                 if ( start == strlen)
                     return ret;
-            if ( str.iterateCodePoints(&start, 0) == L'}' )
+            } while ( (c=str.iterateCodePoints(&start)) );
+            if ( c == L'}' )
                 break;
             if ( str.iterateCodePoints(&start) != L',' )
                 return ret;
@@ -896,6 +909,7 @@ com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const OUString & str
                 return ret;
         } while( true );
         // vec is guaranteed non-empty
+        assert(vec.size() > 0);
         ret = com::sun::star::uno::Sequence< sal_Int32 > ( &vec[0] , vec.size() );
     }
     return ret;
commit eb0c95c56efedf60e59a56bd6d64b04f4697e66b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jun 17 12:36:37 2015 +0200

    postgresql-sdbc: include error message in SQLException
    
    Change-Id: I9d91503e6beb08f11368fc6b80fefb61f60d4486

diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 73f74bb..57804c0 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -329,7 +329,7 @@ void PreparedStatement::raiseSQLException(
     buf.appendAscii( "')" );
     OUString error = buf.makeStringAndClear();
     log( m_pSettings, LogLevel::ERROR, error );
-    throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() );
+    throw SQLException( error, *this, OUString(), 1, Any() );
 }
 
 Reference< XResultSet > PreparedStatement::executeQuery( )


More information about the Libreoffice-commits mailing list