I've now got the patch done.
Could someone with a postgresql implementation please test and push?
Cheers,
Wol
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx
b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 4bc15e4..f0d9e03 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -482,44 +482,32 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
// I.e. they are prefiltered to have only relevant ones?
// Else, at least support all keywords from
// http://www.postgresql.org/docs/9.0/interactive/libpq-connect.html
+
+ static const char* keyword_list[] = {
+ "password",
+ "user",
+ "port",
+ "dbname",
+ "connect_timeout",
+ "options",
+ "requiressl"
+ };
+
for( int i = 0; i < args.getLength() ; ++i )
{
- bool append = true;
- // TODO: rewrite this as a static table of keywords, and a loop over these keywords.
- if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "password" ) ) )
- {
- keywords.push_back( "password", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "user" ) ) )
- {
- keywords.push_back( "user", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "port" ) ) )
- {
- keywords.push_back( "port", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "dbname" ) )
)
- {
- keywords.push_back( "dbname", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(
"connect_timeout" ) ) )
- {
- keywords.push_back( "connect_timeout", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "options" )
) )
- {
- keywords.push_back( "options", SAL_NO_ACQUIRE );
- }
- else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "requiressl"
) ) )
- {
- keywords.push_back( "requiressl", SAL_NO_ACQUIRE );
- }
- else
+ bool append = false;
+// for( int j = 0; j < (int) ( sizeof( keyword_list ) / sizeof( char * )); j++)
+ for( int j = 0; j < (int) SAL_N_ELEMENTS( keyword_list ); j++)
{
+ if( args[i].Name.equalsIgnoreAsciiCaseAscii( keyword_list[j] ))
+ {
+ keywords.push_back( keyword_list[j], SAL_NO_ACQUIRE );
+ append = true;
+ break;
+ }
- append = false;
- // ignore for now
- OSL_TRACE("sdbc-postgresql: unknown argument '%s'", OUStringToOString( args[i].Name,
RTL_TEXTENCODING_UTF8 ).getStr() );
}
+
if( append )
{
OUString value;
@@ -527,6 +515,11 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
char *v = strdup(OUStringToOString(value, enc).getStr());
values.push_back ( v );
}
+ else
+ {
+ // ignore for now
+ OSL_TRACE("sdbc-postgresql: unknown argument '%s'", OUStringToOString( args[i].Name,
RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
}
}
Context
- Patch for postgresql driver · Wols Lists
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.