diff options
Diffstat (limited to 'connectivity/source/drivers/jdbc/JDriver.cxx')
-rw-r--r-- | connectivity/source/drivers/jdbc/JDriver.cxx | 170 |
1 files changed, 83 insertions, 87 deletions
diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 1d5424389ce7..efbe25272bea 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -47,7 +47,7 @@ java_sql_Driver::~java_sql_Driver() OUString SAL_CALL java_sql_Driver::getImplementationName( ) { - return "com.sun.star.comp.sdbc.JDBCDriver"; + return u"com.sun.star.comp.sdbc.JDBCDriver"_ustr; // this name is referenced in the configuration and in the jdbc.xml // Please take care when changing it. } @@ -60,7 +60,7 @@ sal_Bool SAL_CALL java_sql_Driver::supportsService( const OUString& _rServiceNam Sequence< OUString > SAL_CALL java_sql_Driver::getSupportedServiceNames( ) { - return { "com.sun.star.sdbc.Driver" }; + return { u"com.sun.star.sdbc.Driver"_ustr }; } Reference< XConnection > SAL_CALL java_sql_Driver::connect( const OUString& url, const @@ -68,12 +68,11 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const OUString& url, { m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_CONNECTING_URL, url ); - Reference< XConnection > xOut; + rtl::Reference< java_sql_Connection > xOut; if ( acceptsURL(url ) ) { - java_sql_Connection* pConnection = new java_sql_Connection( *this ); - xOut = pConnection; - if ( !pConnection->construct(url,info) ) + xOut = new java_sql_Connection( *this ); + if ( !xOut->construct(url,info) ) xOut.clear(); // an error occurred and the java driver didn't throw an exception else m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS ); @@ -108,109 +107,106 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const { if ( acceptsURL(url) ) { - std::vector< DriverPropertyInfo > aDriverInfo; + Sequence< OUString > aBooleanValues{ u"false"_ustr, u"true"_ustr }; - Sequence< OUString > aBooleanValues(2); - aBooleanValues[0] = "false"; - aBooleanValues[1] = "true"; - - aDriverInfo.push_back(DriverPropertyInfo( - "JavaDriverClass" - ,"The JDBC driver class name." + return + { + { + u"JavaDriverClass"_ustr + ,u"The JDBC driver class name."_ustr ,true ,OUString() - ,Sequence< OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "JavaDriverClassPath" - ,"The class path where to look for the JDBC driver." + ,Sequence< OUString >() + }, + { + u"JavaDriverClassPath"_ustr + ,u"The class path where to look for the JDBC driver."_ustr ,true - , "" - ,Sequence< OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "SystemProperties" - ,"Additional properties to set at java.lang.System before loading the driver." + , u""_ustr + ,Sequence< OUString >() + }, + { + u"SystemProperties"_ustr + ,u"Additional properties to set at java.lang.System before loading the driver."_ustr ,true - , "" - ,Sequence< OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "ParameterNameSubstitution" - ,"Change named parameters with '?'." + , u""_ustr + ,Sequence< OUString >() + }, + { + u"ParameterNameSubstitution"_ustr + ,u"Change named parameters with '?'."_ustr ,false - ,"false" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "IgnoreDriverPrivileges" - ,"Ignore the privileges from the database driver." + ,u"false"_ustr + ,aBooleanValues + }, + { + u"IgnoreDriverPrivileges"_ustr + ,u"Ignore the privileges from the database driver."_ustr ,false - , "false" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "IsAutoRetrievingEnabled" - ,"Retrieve generated values." + , u"false"_ustr + ,aBooleanValues + }, + { + u"IsAutoRetrievingEnabled"_ustr + ,u"Retrieve generated values."_ustr ,false - ,"false" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "AutoRetrievingStatement" - ,"Auto-increment statement." + ,u"false"_ustr + ,aBooleanValues + }, + { + u"AutoRetrievingStatement"_ustr + ,u"Auto-increment statement."_ustr ,false ,OUString() - ,Sequence< OUString >()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "GenerateASBeforeCorrelationName" - ,"Generate AS before table correlation names." + ,Sequence< OUString >() + }, + { + u"GenerateASBeforeCorrelationName"_ustr + ,u"Generate AS before table correlation names."_ustr ,false - ,"false" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "IgnoreCurrency" - ,"Ignore the currency field from the ResultsetMetaData." + ,u"false"_ustr + ,aBooleanValues + }, + { + u"IgnoreCurrency"_ustr + ,u"Ignore the currency field from the ResultsetMetaData."_ustr ,false - ,"false" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "EscapeDateTime" - ,"Escape date time format." + ,u"false"_ustr + ,aBooleanValues + }, + { + u"EscapeDateTime"_ustr + ,u"Escape date time format."_ustr ,false - ,"true" - ,aBooleanValues) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "TypeInfoSettings" - ,"Defines how the type info of the database metadata should be manipulated." + ,u"true"_ustr + ,aBooleanValues + }, + { + u"TypeInfoSettings"_ustr + ,u"Defines how the type info of the database metadata should be manipulated."_ustr ,false - ,OUString( ) - ,Sequence< OUString > ()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "ImplicitCatalogRestriction" - ,"The catalog which should be used in getTables calls, when the caller passed NULL." + ,OUString() + ,Sequence< OUString > () + }, + { + u"ImplicitCatalogRestriction"_ustr + ,u"The catalog which should be used in getTables calls, when the caller passed NULL."_ustr ,false ,OUString( ) - ,Sequence< OUString > ()) - ); - aDriverInfo.push_back(DriverPropertyInfo( - "ImplicitSchemaRestriction" - ,"The schema which should be used in getTables calls, when the caller passed NULL." + ,Sequence< OUString > () + }, + { + u"ImplicitSchemaRestriction"_ustr + ,u"The schema which should be used in getTables calls, when the caller passed NULL."_ustr ,false ,OUString( ) - ,Sequence< OUString > ()) - ); - return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); + ,Sequence< OUString > () + } + }; } ::connectivity::SharedResources aResources; const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); ::dbtools::throwGenericSQLException(sMessage ,*this); - return Sequence< DriverPropertyInfo >(); } sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) |