From d526c3f5ea404ef0923b16ce0aad662b03ba15ac Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Wed, 16 Nov 2011 22:54:56 +0100 Subject: [PATCH] postgresql-sdbc: adapt to removal of implicit (O)ustring->sal_Char* conversion --- .../postgresql/pq_databasemetadata.cxx | 2 +- .../postgresql/pq_preparedstatement.cxx | 2 +- .../source/drivers/postgresql/pq_tools.cxx | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index 0141454f885b..2c552e9dd3f9 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1819,7 +1819,7 @@ static void columnMetaData2DatabaseTypeDescription( i++; int start = i; while( array[i] && array[i] != '}' && array[i] != ',' ) i++; - row[3] <<= OUString( &array[start], i - start ); + row[3] <<= OUString( &array.getStr()[start], i - start ); vec.push_back( row ); } } diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx index d6b1fc08107d..acbe4325fd5e 100644 --- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx +++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx @@ -325,7 +325,7 @@ void PreparedStatement::raiseSQLException( buf.append( rtl::OUString( errorMsg, strlen(errorMsg) , m_pSettings->encoding ) ); buf.appendAscii( " (caused by statement '" ); - buf.appendAscii( m_executedStatement ); + buf.appendAscii( m_executedStatement.getStr() ); buf.appendAscii( "')" ); OUString error = buf.makeStringAndClear(); log( m_pSettings, LogLevel::ERROR, error ); diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 2232d1364e16..bc25df089280 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -137,7 +137,7 @@ com::sun::star::util::Time string2Time( const rtl::OUString & time ) if( time.getLength() >9 ) { - ret.HundredthSeconds = (sal_Int32)rtl_ustr_toInt32( &time[9] , 10 ); + ret.HundredthSeconds = (sal_Int32)rtl_ustr_toInt32( &time.getStr()[9] , 10 ); } return ret; @@ -429,12 +429,12 @@ bool isWhitespace( sal_Unicode c ) for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); if( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( - &sql[i], sql.getLength() - i, "insert" , 6 ) ) + &sql.getStr()[i], sql.getLength() - i, "insert" , 6 ) ) { i += 6; for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); if( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( - &sql[i], sql.getLength() - i, "into" , 4 ) ) + &sql.getStr()[i], sql.getLength() - i, "into" , 4 ) ) { i +=4; for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); @@ -470,7 +470,7 @@ bool isWhitespace( sal_Unicode c ) } } } - ret = rtl::OUString( &sql[start], i - start ).trim(); + ret = rtl::OUString( &sql.getStr()[start], i - start ).trim(); // printf( "pq_statement: parsed table name %s from insert\n" , // OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US).getStr() ); } @@ -524,7 +524,7 @@ void splitSQL( const rtl::OString & sql, OStringVector &vec ) { if( '"' == c ) { - vec.push_back( rtl::OString( &sql[start], i-start+1 ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i-start+1 ) ); start = i + 1; doubleQuote = false; } @@ -539,7 +539,7 @@ void splitSQL( const rtl::OString & sql, OStringVector &vec ) } else if( '\'' == c ) { - vec.push_back( rtl::OString( &sql[start], i - start +1 ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start +1 ) ); start = i + 1; // leave single quotes ! singleQuote = false; } @@ -548,20 +548,20 @@ void splitSQL( const rtl::OString & sql, OStringVector &vec ) { if( '"' == c ) { - vec.push_back( rtl::OString( &sql[start], i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start ) ); doubleQuote = true; start = i; } else if( '\'' == c ) { - vec.push_back( rtl::OString( &sql[start], i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start ) ); singleQuote = true; start = i; } } } if( start < i ) - vec.push_back( rtl::OString( &sql[start] , i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start] , i - start ) ); // for( i = 0 ; i < vec.size() ; i ++ ) // printf( "%s!" , vec[i].getStr() ); @@ -584,7 +584,7 @@ void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) { if( '"' == c ) { - vec.push_back( rtl::OString( &sql[start], i-start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i-start ) ); start = i + 1; doubleQuote = false; } @@ -593,7 +593,7 @@ void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) { if( '\'' == c ) { - vec.push_back( rtl::OString( &sql[start], i - start +1 ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start +1 ) ); start = i + 1; // leave single quotes ! singleQuote = false; } @@ -616,15 +616,15 @@ void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) start ++; // skip additional whitespace else { - vec.push_back( rtl::OString( &sql[start], i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start ) ); start = i +1; } } else if( ',' == c || isOperator( c ) || '(' == c || ')' == c ) { if( i - start ) - vec.push_back( rtl::OString( &sql[start], i - start ) ); - vec.push_back( rtl::OString( &sql[i], 1 ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[i], 1 ) ); start = i + 1; } else if( '.' == c ) @@ -637,7 +637,7 @@ void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) else { if( i - start ) - vec.push_back( rtl::OString( &sql[start], i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start], i - start ) ); vec.push_back( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "." ) ) ); start = i + 1; } @@ -645,7 +645,7 @@ void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) } } if( start < i ) - vec.push_back( rtl::OString( &sql[start] , i - start ) ); + vec.push_back( rtl::OString( &sql.getStr()[start] , i - start ) ); // for( i = 0 ; i < vec.size() ; i ++ ) // printf( "%s!" , vec[i].getStr() ); @@ -877,7 +877,7 @@ void fillAttnum2attnameMap( // it is a table or a function name rtl::OStringBuffer buf(128); if( '"' == vec[token][0] ) - buf.append( &(vec[token][1]) , vec[token].getLength() -2 ); + buf.append( &(vec[token].getStr()[1]) , vec[token].getLength() -2 ); else buf.append( vec[token] ); token ++; @@ -893,7 +893,7 @@ void fillAttnum2attnameMap( if( token < vec.size() ) { if( '"' == vec[token][0] ) - buf.append( &(vec[token][1]) , vec[token].getLength() -2 ); + buf.append( &(vec[token].getStr()[1]) , vec[token].getLength() -2 ); else buf.append( vec[token] ); token ++; @@ -965,7 +965,7 @@ com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const ::rtl::OUStrin do { start ++; - vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str[start], 10 ) ); + vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.getStr()[start], 10 ) ); start = str.indexOf( ',' , start ); } while( start != -1 ); ret = com::sun::star::uno::Sequence< sal_Int32 > ( &vec[0] , vec.size() );