summaryrefslogtreecommitdiff
path: root/connectivity
AgeCommit message (Collapse)Author
2021-10-07tdf#85148 New option on database wizard to connect to Firebird Serverjucasaca
Add a new option to the database connection wizard to connect to firebird database server Change-Id: Ie9c75187347a8532c1d869939c72a6f0a892d861 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122073 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-07ofz: Integer-overflowCaolán McNamara
Change-Id: Ib0c1863c5fed92622b4bd601021a1174cf6ee68d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123213 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-06loplugin:moveparam in connectivityNoel Grandin
Change-Id: Iaf3a64effb69fd82c6303d8fa75723ccc5ced543 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-02ofz#39515 avoid Integer-overflowCaolán McNamara
Change-Id: I8bef8e19f066883d5fc731a1c7b7cd85948ae5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122968 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-10-01loplugin:constmethodNoel Grandin
Change-Id: I3ed657c5c5e6840e38e3c8505505b4b372125df0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122910 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30loplugin:constparams improve handling of pointer paramsNoel Grandin
Change-Id: I4c0002e72703eded435bfe4985f5b0121bf8524b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122843 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-29"is missing" has gone missingStephan Bergmann
...in 4c1bf9d7790ca037933c3c6825d48736572a1886 "Make loplugin:bufferadd look through O[U]String::operator std::[u16]string_view" (thanks to Ming Hua for spotting it) Change-Id: I0fa18b0a5c824cb77988edda1ba8971d2ab86366 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122798 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-29this scoping detracts from readabilityCaolán McNamara
Change-Id: I99a51bf68ef1c98e4023413b9274c4361f8a9b96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122797 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-29ofz#39403 avoid Integer-overflowCaolán McNamara
Change-Id: I3471e2fbd2b47dbc681aa3069794184eb9ab33e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122796 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-28Make loplugin:bufferadd look through O[U]String::operator std::[u16]string_viewStephan Bergmann
Change-Id: I79a32f64541a90b0b824f7721e8815c1e7c873ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122788 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-28Fix typosAndrea Gelmini
Change-Id: I05fdb2378f48b7e2c7373c16c66065111c5d2f73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122716 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-09-28ofz: Integer-overflow in lcl_CalDateCaolán McNamara
FWIW we have another similar implementation of this as Calendar_hijri::getGregorianDay Change-Id: I785f739d8f69ed0e596c27411cc8c7c58c631866 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122757 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27fetch the column names once and keep it up to date as new names insertedCaolán McNamara
Change-Id: Ic865c82c2bbf8cb3be730158c823bd8769038bbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122661 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27pass the column names in as an external argumentCaolán McNamara
Change-Id: I14ab9e6de0a704076a1c632b6b33aaeabdfc23d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122660 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27split getUniqueColumnNameCaolán McNamara
Change-Id: Ibcac473463c02e7ce6f853ac2dcdf953c13c14e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122659 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27appendColumns is always called with m_aSelectColumns as 1st argCaolán McNamara
Change-Id: I791c0eef1fda97d21ba9efb170ef226c9a495eed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122658 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27setSelectColumnName is always called with m_aSelectColumns as 1st argCaolán McNamara
Change-Id: If86c4f48ed7eb6860f461fe905c0628cb9b73043 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122657 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-27ofz#39309 collect the names just onceCaolán McNamara
Change-Id: Iad8a6c80ecac7b8dc380a4c16ccd82650ecc10f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122656 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-26ofz#39304 short timestamp recordCaolán McNamara
Change-Id: I8f783473dd5d4679846c7c866cd1853ef7d919fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122628 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-26ofz#39301 month has to be in range [1-12]Caolán McNamara
Change-Id: I5a4ca534b24098342d8f465a32bc1887f40f5b63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122629 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24for fuzzing hardcode a case sensitive file system result for detectionCaolán McNamara
rather than throwing ucb exceptions continously Change-Id: Ia3545619fe9a7c4c8f0470179eca68f0ae4bf4de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122588 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24use a min of 1 as 0 triggers refreshHeader to reloadCaolán McNamara
Change-Id: Iecc6adcce7e32a205f0c9cc6d634d703ea88de06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122573 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24make SQLExceptionInfo utilities available for external useCaolán McNamara
Change-Id: I6561fa433f6619d8de97983fa962f874cbf5b536 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122570 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24split SQLExceptionInfo::append moreCaolán McNamara
Change-Id: Id6dd8dfc3dc072f573e3a1a750428cb149be8e83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122569 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24refactor getting the last exception of a SQLException chainCaolán McNamara
Change-Id: Ia60766709e5093f5cc60d44697343e5a63f7ba03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122568 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24split SQLExceptionInfo::appendCaolán McNamara
Change-Id: I4e86e580843042e482e8732843a45a9eedfad320 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122567 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24some prerequisites to use dbase import with config unavailableCaolán McNamara
Change-Id: I0a7f32a69112d7ce9ffc39481154c9da346c8d24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122544 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-24do some sanity checks on the number of records claimedCaolán McNamara
while retaining the fix of #i83401# to recovered a broken case Change-Id: I283c45b10aaa24004a34bfe6faee517d4a443b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122543 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23check if headersize is greater than available dataCaolán McNamara
Change-Id: I5d78da49436c7dfbe7cfb50e52549b61abc00ee9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122542 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23leaks of OCollection in dbase importCaolán McNamara
presumably since... commit 5c7b954935369cbbd22a6f43be63ac7c0ddbbfdc Date: Mon Jan 29 13:28:44 2018 +0200 loplugin:useuniqueptr in OTable OCollection has a unique and nonstandard acquire/release which forwards to a parent cppu::OWeakObject. So when it would appear to a casual observer, who assumes that it has an internal refcount, that its refcount would drop to zero and then get auto-deleted, nothing of the kind occurs. Change-Id: Ic292663a61b4d7dbf7636be7ad4c00aed0b5a7fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122528 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23check claimed number of records against max possible with available dataCaolán McNamara
Change-Id: I50d9354da00137c64c83970eb66792b37d7e545a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122536 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23EOF isn't an error from SvStream::GetError perspectiveCaolán McNamara
Change-Id: Ib2bc2c35d78d92728d592676def300e28a8b9e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122534 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23don't looks for dbt memo files when fuzzingCaolán McNamara
Change-Id: I483606a36d8a91fe7af73f1c6dba740b2475e95d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122533 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-23Extend loplugin:stringviewparam to starts/endsWith: connectivityStephan Bergmann
Change-Id: I10a6f919034a83d134c92f3c510641c10c7c133d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122506 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-22drop comments about disabling optimizationCaolán McNamara
which are 10 years old Change-Id: I9645cd4e227d089ff97852fb18b25d5ddaf12b28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122422 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-17Use OUString::unacquiredStephan Bergmann
Change-Id: I9264291ba55accbb07401e29499b99e9765b3f63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122220 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 5Mike Kaganski
- Revise uses of getSomething to use getFromUnoTunnel Where that is impossible, use getSomething_cast to unify casting, and minimize number of places doing low-level transformations. The change keeps the existing tunnel references that last for the duration of the pointers' life, because sometimes destroying such reference may destroy the pointed object, and result in use after free. Change-Id: I291c33223582c34cd2c763aa8aacf0ae899ca4c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122101 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4Mike Kaganski
- Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in <comphelper/servicehelper.hxx>. TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 3 [API CHANGE]Mike Kaganski
- Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> OImplementationId uses broken double checked locking; additionally, it uses it at the first call to getImplementationId, not when the object is constructed. This implementation can't be changed, cince it's part of published API; it can't rely on C++11, which would be required for use of thread-safe statics and move the initialization to ctor. The class has obsolete _bUseEthernetAddress member, that is unused and ignored since 4e9fa7e339a1cd6cb2fec643715991bcf5057cec. No need to implement it when replacing its uses to UnoIdInit. The deprecation is the API CHANGE. No published API is introduced to replace it; 3rd-party code should seek alternative solutions, or just keep using the deprecated functionality. TODO (in separate commits): - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: I8b6e684e5389bc0d5bb3b7f21f72a4c8f684107d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122077 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1Mike Kaganski
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-14Adapt to Bison 3.8 internal yyn -> yyrule renameStephan Bergmann
see <https://git.savannah.gnu.org/cgit/bison.git/commit/?id=f30067ed51f23802fc91761ede1506dfa72b2865> "glr2.cc: log the execution of deferred actions" including "Rename argument yyn as yyrule for clarity." YYBISON was defined as 1 rather than as a representation of the Bison version prior to <https://git.savannah.gnu.org/cgit/bison.git/commit/?id=21c147b6e5372563b7c4741deadaddb9354f4b09> "yacc.c: provide the Bison version as an integral macro", which shouldn't be a problem here. And YYBISON is apparently completely undefined with /usr/bin/bison on macOS. (The preceding comment always mentioned "yyi" and "yyrmap" in apparent mismatch with the actually used "yyn" and "yyr1" ever since c25ec0608a167bcf1d891043f02273761c351701 "initial import", so just leave it untouched.) Change-Id: I4f901407aa21ed4abec84e661d813ee7599f02f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122082 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-12Simplify OFileDriver::getDataDefinitionByConnectionMike Kaganski
Change-Id: Ia808f5e7867d474e36e60d163d1a556a59e2f89d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121974 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-12tdf#117842: use XUnoTunnel to get wrapped connection reliablyMike Kaganski
XDataDefinitionSupplier::getDataDefinitionByConnection may take not only direct reference to expected connection type, but also connectivity::OConnectionWeakWrapper wrapping it. Change-Id: I88925f9403b51f0cf13f02b5f00d3765a242230e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121890 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-10tdf#125286: Inform Firebird that we use UTF8 in pathsMike Kaganski
Use isc_dpb_utf8_filename for that, which is introduced in Firebird 2.5. It is documented in Firebird's doc/README.connection_string_charset.txt. Without this, on Windows, where UTF-8 is not a common "ANSI code page", one would not be able to connect to a DB file that has non-ASCII chars in path, because its UTF-8 representation would differ from 8-bit system encoding used in the API used by Firebird. This still does not enable full Unicode support, because of Firebird's [CORE2172]/[CORE3172]. It may only improve experience when using paths with characters representable in system encoding. Change-Id: Ia31407b181266a2bf1b90bc8cfc71dd3f78b7cd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121886 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-10tdf#115547: Fix DB path handlingMike Kaganski
1. The code used wrong procedure to convert file URLs to local paths. It assumed that it's enough to just strip the leading 'file://', which is only sometimes true on Unix-like systems; on Windows, this converts a valid 'file:///C:/path/file.ext' to '/C:/path/file.ext', where the leading slash is then treated as a network path, resulting in errors. 2. It is incorrect to assume the same length for UTF-16 and UTF-8 encoded URLs coming from untrusted source (like user file). It may contain non-ASCII characters (be an IRL), and then the assumption would fail. Change-Id: Ie2ea6c8cb9a690975db956fa025bf926a8010984 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121885 Reviewed-by: Lionel Mamane <lionel@mamane.lu> Tested-by: Jenkins
2021-09-10Clarify that css::sdbc::XClob::getSubString takes 1-based posMike Kaganski
... and fix connectivity::firebird::Clob::getSubString. XClob::getSubString is modelled after JDBC counterpart, that also takes 1-based position argument. This is also described in multiple places in our code: - OPreparedStatement::setClob in connectivity/source/drivers/firebird/PreparedStatement.cxx - OSingleSelectQueryComposer::setConditionByColumn in dbaccess/source/core/api/SingleSelectQueryComposer.cxx - ORowSetValue::getString in connectivity/source/commontools/FValue.cxx However in some places 0-based value was used (fixed here). To clarify, the mention that the pos argument is 1-based is put to the corresponding IDL file. Also the code in connectivity::firebird::Clob::getSubString had multiple issues: - no checks of arguments; - possibility to throw "nPosition out of range" when just-read segment has enough data; - wrong start position in case when nPosition is not aligned to segment boundary. This change fixes these, and simplifies the implementation. Change-Id: I119a62dd7f02c9569ce36395ed8cc1a98c931fcf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121884 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-10tdf#123055 - Start to read unicode text in order to avoid the BOMAndreas Heinisch
Change-Id: Ica5a2e11b4be1764cc94aafe5366197065cf6363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121391 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2021-09-10A copy-paste message text errorMike Kaganski
Change-Id: I3d6f7a968fc5fca112087212ab7730f654534dfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121876 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-10Use std::vector instead of css::uno::SequenceMike Kaganski
This allows to avoid multiple reallocations during successive reads Change-Id: I74102d21c5dc4d1e92e27ede3490e9ed07bd568e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121873 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>