diff options
Diffstat (limited to 'connectivity/source/drivers/firebird/Util.cxx')
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 2d694eac94ec..3cee5dab6e0b 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/SQLException.hpp> +#include <o3tl/string_view.hxx> using namespace ::connectivity; @@ -22,12 +23,12 @@ using namespace ::com::sun::star::uno; using namespace firebird; -OUString firebird::sanitizeIdentifier(const OUString& rIdentifier) +OUString firebird::sanitizeIdentifier(std::u16string_view rIdentifier) { - OUString sRet = rIdentifier.trim(); - assert(sRet.getLength() <= 31); // Firebird identifiers cannot be longer than this. + std::u16string_view sRet = o3tl::trim(rIdentifier); + assert(sRet.size() <= 31); // Firebird identifiers cannot be longer than this. - return sRet; + return OUString(sRet); } OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector, @@ -43,8 +44,8 @@ OUString firebird::StatusVectorToString(const ISC_STATUS_ARRAY& rStatusVector, while(fb_interpret(msg, sizeof(msg), &pStatus)) { // TODO: verify encoding - buf.append("\n*"); - buf.append(OUString(msg, strlen(msg), RTL_TEXTENCODING_UTF8)); + buf.append("\n*" + + OUString(msg, strlen(msg), RTL_TEXTENCODING_UTF8)); } } catch (...) @@ -342,8 +343,9 @@ void firebird::mallocSQLVAR(XSQLDA* pSqlda) case SQL_BOOLEAN: pVar->sqldata = static_cast<char *>(malloc(sizeof(sal_Bool))); break; + // See https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref25/firebird-25-language-reference.html#fblangref25-datatypes-special-sqlnull case SQL_NULL: - assert(false); // TODO: implement + pVar->sqldata = nullptr; break; case SQL_QUAD: assert(false); // TODO: implement @@ -388,7 +390,8 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda) } break; case SQL_NULL: - assert(false); // TODO: implement + // See SQL_NULL case in mallocSQLVAR + assert(pVar->sqldata == nullptr); break; case SQL_QUAD: assert(false); // TODO: implement @@ -408,22 +411,6 @@ void firebird::freeSQLVAR(XSQLDA* pSqlda) } -OUString firebird::escapeWith( const OUString& sText, const char aKey, const char aEscapeChar) -{ - OUString sRet(sText); - sal_Int32 aIndex = 0; - for (;;) - { - aIndex = sRet.indexOf(aKey, aIndex); - if ( aIndex <= 0 || aIndex >= sRet.getLength()) - break; - sRet = sRet.replaceAt(aIndex, 1, rtl::OUStringConcatenation(OUStringChar(aEscapeChar) + OUStringChar(aKey)) ); - aIndex += 2; - } - - return sRet; -} - sal_Int64 firebird::pow10Integer(int nDecimalCount) { sal_Int64 nRet = 1; |