summaryrefslogtreecommitdiffstats
path: root/connectivity/source/drivers/ado/Awrapado.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/ado/Awrapado.cxx')
-rw-r--r--connectivity/source/drivers/ado/Awrapado.cxx262
1 files changed, 132 insertions, 130 deletions
diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx
index 2a9f66656956..eebdc5d8c5a7 100644
--- a/connectivity/source/drivers/ado/Awrapado.cxx
+++ b/connectivity/source/drivers/ado/Awrapado.cxx
@@ -21,14 +21,16 @@
#include <ado/Awrapado.hxx>
#include <ado/Awrapadox.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <systools/win32/oleauto.hxx>
using namespace connectivity::ado;
void WpADOCatalog::Create()
{
- pInterface.TryCoCreateInstance(ADOS::CLSID_ADOCATALOG_25, nullptr, CLSCTX_INPROC_SERVER);
+ pInterface.CoCreateInstance(ADOS::CLSID_ADOCATALOG_25, nullptr, CLSCTX_INPROC_SERVER);
}
@@ -42,16 +44,16 @@ WpADOProperties WpADOConnection::get_Properties() const
OUString WpADOConnection::GetConnectionString() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_ConnectionString(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_ConnectionString(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::PutConnectionString(std::u16string_view aCon) const
{
assert(pInterface);
- OLEString bstr(aCon);
- bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr.asBSTR()));
+ sal::systools::BStr bstr(aCon);
+ bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
return bErg;
}
@@ -93,8 +95,8 @@ bool WpADOConnection::Close()
bool WpADOConnection::Execute(std::u16string_view CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
{
assert(pInterface);
- OLEString sStr1(CommandText);
- bool bErg = SUCCEEDED(pInterface->Execute(sStr1.asBSTR(),&RecordsAffected,Options,reinterpret_cast<ADORecordset**>(ppiRset)));
+ sal::systools::BStr sStr1(CommandText);
+ bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,reinterpret_cast<ADORecordset**>(ppiRset)));
return bErg;
}
@@ -120,10 +122,10 @@ bool WpADOConnection::RollbackTrans( )
bool WpADOConnection::Open(std::u16string_view ConnectionString, std::u16string_view UserID,std::u16string_view Password,long Options)
{
assert(pInterface);
- OLEString sStr1(ConnectionString);
- OLEString sStr2(UserID);
- OLEString sStr3(Password);
- bool bErg = SUCCEEDED(pInterface->Open(sStr1.asBSTR(),sStr2.asBSTR(),sStr3.asBSTR(),Options));
+ sal::systools::BStr sStr1(ConnectionString);
+ sal::systools::BStr sStr2(UserID);
+ sal::systools::BStr sStr3(Password);
+ bool bErg = SUCCEEDED(pInterface->Open(sStr1, sStr2, sStr3, Options));
return bErg;
}
@@ -136,15 +138,15 @@ bool WpADOConnection::GetErrors(ADOErrors** pErrors)
OUString WpADOConnection::GetDefaultDatabase() const
{
assert(pInterface);
- OLEString aBSTR; pInterface->get_DefaultDatabase(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::PutDefaultDatabase(std::u16string_view _bstr)
{
assert(pInterface);
- OLEString bstr(_bstr);
- bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr.asBSTR()));
+ sal::systools::BStr bstr(_bstr);
+ bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
return bErg;
}
@@ -208,15 +210,15 @@ bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum)
OUString WpADOConnection::get_Provider() const
{
assert(pInterface);
- OLEString aBSTR; pInterface->get_Provider(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR; pInterface->get_Provider(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOConnection::put_Provider(std::u16string_view _bstr)
{
assert(pInterface);
- OLEString bstr(_bstr);
- return SUCCEEDED(pInterface->put_Provider(bstr.asBSTR()));
+ sal::systools::BStr bstr(_bstr);
+ return SUCCEEDED(pInterface->put_Provider(bstr));
}
sal_Int32 WpADOConnection::get_State() const
@@ -236,9 +238,9 @@ bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant const & Restrictions
OUString WpADOConnection::get_Version() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Version(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Version(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOCommand::putref_ActiveConnection(const WpADOConnection& rCon)
@@ -256,14 +258,14 @@ void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
void WpADOCommand::Create()
{
sal::systools::COMReference<IClassFactory2> pInterface2;
- if (!FAILED(pInterface2.TryCoGetClassObject(ADOS::CLSID_ADOCOMMAND_21, CLSCTX_INPROC_SERVER)))
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADOCOMMAND_21, CLSCTX_INPROC_SERVER)))
{
sal::systools::COMReference<ADOCommand> pCommand;
HRESULT hr = pInterface2->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADOCOMMAND_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&pCommand));
if( !FAILED( hr ) )
@@ -282,16 +284,16 @@ sal_Int32 WpADOCommand::get_State() const
OUString WpADOCommand::get_CommandText() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_CommandText(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_CommandText(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOCommand::put_CommandText(std::u16string_view aCon)
{
assert(pInterface);
- OLEString bstr(aCon);
- bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr.asBSTR()));
+ sal::systools::BStr bstr(aCon);
+ bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
return bErg;
}
@@ -334,8 +336,8 @@ ADOParameter* WpADOCommand::CreateParameter(std::u16string_view _bstr,DataTypeEn
{
assert(pInterface);
ADOParameter* pPara = nullptr;
- OLEString bstr(_bstr);
- bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr.asBSTR(),Type,Direction,nSize,Value,&pPara));
+ sal::systools::BStr bstr(_bstr);
+ bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr, Type, Direction, nSize, Value, &pPara));
return bErg ? pPara : nullptr;
}
@@ -366,16 +368,16 @@ CommandTypeEnum WpADOCommand::get_CommandType() const
OUString WpADOCommand::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
bool WpADOCommand::put_Name(std::u16string_view Name)
{
assert(pInterface);
- OLEString bstr(Name);
- bool bErg = SUCCEEDED(pInterface->put_Name(bstr.asBSTR()));
+ sal::systools::BStr bstr(Name);
+ bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
return bErg;
}
@@ -388,17 +390,17 @@ bool WpADOCommand::Cancel()
OUString WpADOError::GetDescription() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Description(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Description(&aBSTR);
+ return OUString(aBSTR);
}
OUString WpADOError::GetSource() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Source(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Source(&aBSTR);
+ return OUString(aBSTR);
}
sal_Int32 WpADOError::GetNumber() const
@@ -412,9 +414,9 @@ sal_Int32 WpADOError::GetNumber() const
OUString WpADOError::GetSQLState() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_SQLState(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_SQLState(&aBSTR);
+ return OUString(aBSTR);
}
sal_Int32 WpADOError::GetNativeError() const
@@ -468,9 +470,9 @@ sal_Int32 WpADOField::GetDefinedSize() const
OUString WpADOField::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOField::GetADOType() const
@@ -620,9 +622,9 @@ bool WpADOProperty::PutValue(const OLEVariant &aValVar)
OUString WpADOProperty::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOProperty::GetADOType() const
@@ -649,13 +651,13 @@ bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
void WpADORecordset::Create()
{
sal::systools::COMReference<IClassFactory2> pInterface2;
- if (!FAILED(pInterface2.TryCoGetClassObject(ADOS::CLSID_ADORECORDSET_21, CLSCTX_INPROC_SERVER)))
+ if (!FAILED(pInterface2.CoGetClassObject(ADOS::CLSID_ADORECORDSET_21, CLSCTX_INPROC_SERVER)))
{
sal::systools::COMReference<ADORecordset> pRec;
HRESULT hr = pInterface2->CreateInstanceLic(nullptr,
nullptr,
ADOS::IID_ADORECORDSET_21,
- ADOS::GetKeyStr().asBSTR(),
+ ADOS::GetKeyStr(),
reinterpret_cast<void**>(&pRec));
if( !FAILED( hr ) )
@@ -892,9 +894,9 @@ bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords)
OUString WpADOParameter::GetName() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
DataTypeEnum WpADOParameter::GetADOType() const
@@ -976,30 +978,30 @@ bool WpADOParameter::put_Size(sal_Int32 _nSize)
OUString WpADOColumn::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
OUString WpADOColumn::get_RelatedColumn() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_RelatedColumn(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_RelatedColumn(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOColumn::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
void WpADOColumn::put_RelatedColumn(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_RelatedColumn(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_RelatedColumn(bstr);
}
DataTypeEnum WpADOColumn::get_Type() const
@@ -1090,16 +1092,16 @@ WpADOProperties WpADOColumn::get_Properties() const
OUString WpADOKey::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOKey::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
KeyTypeEnum WpADOKey::get_Type() const
@@ -1119,16 +1121,16 @@ void WpADOKey::put_Type(const KeyTypeEnum& _eNum)
OUString WpADOKey::get_RelatedTable() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_RelatedTable(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_RelatedTable(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOKey::put_RelatedTable(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_RelatedTable(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_RelatedTable(bstr);
}
RuleEnum WpADOKey::get_DeleteRule() const
@@ -1170,16 +1172,16 @@ WpADOColumns WpADOKey::get_Columns() const
OUString WpADOIndex::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOIndex::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
bool WpADOIndex::get_Clustered() const
@@ -1281,24 +1283,24 @@ ADOProcedures* WpADOCatalog::get_Procedures()
OUString WpADOTable::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOTable::put_Name(std::u16string_view _rName)
{
assert(pInterface);
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
OUString WpADOTable::get_Type() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Type(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Type(&aBSTR);
+ return OUString(aBSTR);
}
WpADOColumns WpADOTable::get_Columns() const
@@ -1344,9 +1346,9 @@ WpADOProperties WpADOTable::get_Properties() const
OUString WpADOView::get_Name() const
{
assert(pInterface);
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOView::get_Command(OLEVariant& _rVar) const
@@ -1363,15 +1365,15 @@ void WpADOView::put_Command(OLEVariant const & _rVar)
OUString WpADOGroup::get_Name() const
{
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOGroup::put_Name(std::u16string_view _rName)
{
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
RightsEnum WpADOGroup::GetPermissions(
@@ -1405,22 +1407,22 @@ WpADOUsers WpADOGroup::get_Users( )
OUString WpADOUser::get_Name() const
{
- OLEString aBSTR;
- pInterface->get_Name(aBSTR.getAddress());
- return aBSTR.asOUString();
+ sal::systools::BStr aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return OUString(aBSTR);
}
void WpADOUser::put_Name(std::u16string_view _rName)
{
- OLEString bstr(_rName);
- pInterface->put_Name(bstr.asBSTR());
+ sal::systools::BStr bstr(_rName);
+ pInterface->put_Name(bstr);
}
bool WpADOUser::ChangePassword(std::u16string_view _rPwd,std::u16string_view _rNewPwd)
{
- OLEString sStr1(_rPwd);
- OLEString sStr2(_rNewPwd);
- bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1.asBSTR(),sStr2.asBSTR()));
+ sal::systools::BStr sStr1(_rPwd);
+ sal::systools::BStr sStr2(_rNewPwd);
+ bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1, sStr2));
return bErg;
}
@@ -1462,7 +1464,7 @@ ADORecordset* WpADOConnection::getExportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1502,7 +1504,7 @@ ADORecordset* WpADOConnection::getImportedKeys( const css::uno::Any& catalog, co
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1544,7 +1546,7 @@ ADORecordset* WpADOConnection::getPrimaryKeys( const css::uno::Any& catalog, con
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1584,7 +1586,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1618,7 +1620,7 @@ ADORecordset* WpADOConnection::getIndexInfo(
ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern )
+ std::u16string_view tableNamePattern )
{
SAFEARRAYBOUND rgsabound[1];
SAFEARRAY *psa = nullptr;
@@ -1626,7 +1628,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1638,7 +1640,7 @@ ADORecordset* WpADOConnection::getTablePrivileges( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -1672,7 +1674,7 @@ ADORecordset* WpADOConnection::getCrossReference( const css::uno::Any& primaryCa
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1713,7 +1715,7 @@ ADORecordset* WpADOConnection::getCrossReference( const css::uno::Any& primaryCa
ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern )
+ std::u16string_view procedureNamePattern )
{
SAFEARRAYBOUND rgsabound[1];
SAFEARRAY *psa = nullptr;
@@ -1721,7 +1723,7 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1733,7 +1735,7 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(procedureNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(procedureNamePattern, u"%"))
varCriteria[nPos].setString(procedureNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -1752,8 +1754,8 @@ ADORecordset* WpADOConnection::getProcedures( const css::uno::Any& catalog,
ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& procedureNamePattern,
- const OUString& columnNamePattern )
+ std::u16string_view procedureNamePattern,
+ std::u16string_view columnNamePattern )
{
// Create elements used in the array
SAFEARRAYBOUND rgsabound[1];
@@ -1762,7 +1764,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1774,11 +1776,11 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(procedureNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(procedureNamePattern, u"%"))
varCriteria[nPos].setString(procedureNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
- if(columnNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(columnNamePattern, u"%"))
varCriteria[nPos].setString(columnNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
@@ -1797,7 +1799,7 @@ ADORecordset* WpADOConnection::getProcedureColumns( const css::uno::Any& catalog
ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
const css::uno::Sequence< OUString >& types )
{
// Create elements used in the array
@@ -1814,7 +1816,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
++nPos;
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
++nPos;
@@ -1833,7 +1835,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
varCriteria[nPos].setString(sTypeNames);
// Create SafeArray Bounds and initialize the array
- const sal_Int32 nCrit = SAL_N_ELEMENTS(varCriteria);
+ const sal_Int32 nCrit = std::size(varCriteria);
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nCrit;
@@ -1860,7 +1862,7 @@ ADORecordset* WpADOConnection::getTables( const css::uno::Any& catalog,
ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
const OUString& schemaPattern,
- const OUString& tableNamePattern,
+ std::u16string_view tableNamePattern,
std::u16string_view columnNamePattern )
{
// Create elements used in the array
@@ -1870,7 +1872,7 @@ ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1882,7 +1884,7 @@ ADORecordset* WpADOConnection::getColumns( const css::uno::Any& catalog,
varCriteria[nPos].setString(schemaPattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
- if(tableNamePattern.toChar() != '%')
+ if(!o3tl::starts_with(tableNamePattern, u"%"))
varCriteria[nPos].setString(tableNamePattern);
SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
@@ -1914,7 +1916,7 @@ ADORecordset* WpADOConnection::getColumnPrivileges( const css::uno::Any& catalog
// Create SafeArray Bounds and initialize the array
rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = SAL_N_ELEMENTS(varCriteria);
+ rgsabound[0].cElements = std::size(varCriteria);
psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
sal_Int32 nPos=0;
@@ -1949,7 +1951,7 @@ ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
{
// Create elements used in the array
OLEVariant varCriteria[2];
- const int nCrit = SAL_N_ELEMENTS(varCriteria);
+ const int nCrit = std::size(varCriteria);
// Create SafeArray Bounds and initialize the array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;