Valgrind is capable of detecting such bugs. No need for extra macros.
Conflicts:
dbaccess/source/ui/dlg/tablespage.cxx
Change-Id: I25ea9174a042050efdb371246417ee7f2edae997
Reviewed-on: https://gerrit.libreoffice.org/7532
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Instead of playing tricks with parameters that when filled in force a part of the WHERE clause to have not influence, actually use several different statements and hardcode in each the kind of test to be done
Change-Id: I93e1978f0420bc627a02291f209c788b9b4f2e96
- Sanitized some OUStringBuilder, avoiding creating a new one and after
make some appends
- Removed some ::rtl prefixes
- Remove RTL_* macro
Change-Id: Ide3d78f20c68774cd4864b82cb8d29784228d1cd
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/1552
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
This was done for the sake of ODBC,
but the cost was imposed on all backends.
The ODBC problems are now solved cleanly (and more efficiently)
in the SDBC<->ODBC layer.
Change-Id: Ib8a864da08deaaacc96a379fb72b3b7cbb34598c
This avoids fetching data that will not be requested when the "cursor" is only moved and no data requested. That is typically what RowSetCache does when its own cursor is moved within its window.
This basically makes the whole {next,previous,absolute,...}_checked story obsolete, by basically always being as fast as the i_bFetchRow==false case, but in a safer way.
Change-Id: I89eaf277069736b3077bde8b45325929db290f2d
... BOOST_STATIC_ASSERT_MSG was added in boost 1.46, while the internal
boost is still at version 1.44, so use BOOST_STATIC_ASSERT instead.
Change-Id: I14f8e48e31956b34a1a907cd2c4e454a5715889b
We do a "SELECT * FROM table" just to fetch the primary key columns;
so reuse the same XResultSet to fetch all columns.
Else, we immediately issue a "SELECT * FROM table WHERE
primary_key=current_value" to read the other columns, which is
wasteful and particularly silly.
Commit 1ae17f5b03 already tried
to do that, but was essentially reverted piecewise because
it caused fdo#47520, fdo#48345, fdo#50372.
Commit c08067d6da94743d53217cbc26cffae00a22dc3a thought it did that,
but actually reverted commit 1ae17f5b03.
This implementation fetches the whole current row and caches it in memory;
only one row is cached: when the current row changes, the cache contains
the new current row.
This could be problematic (wrt to memory consumption) if the current
row is big (e.g. with BLOBs) and nobody is interested in the data
anyway (as would often be the case with BLOBs). Note that because of
our "SELECT *", the driver most probably has it in memory already
anyway, so we don't make the situation that much worse.
This could be incrementally improved with a heuristic of not
preemptively caching binary data (and also not LONGVARCHAR / TEXT /
MEMO / ...); a getFOO on these columns would issue a specific "SELECT
column FROM table WHERE primary_key=current_value" each time.
The *real* complete fix to all these issues would be to not do "SELECT
*" at all. Use "SELECT pkey_col1, pkey_col2, ..." when we are only
interested in the key columns. As to data, somehow figure out which
columns were ar interested in and "SELECT" only these (and maybe only
those with "small datatype"?). Interesting columns could be determined
by our caller (creator) as an argument to our constructor, or some
heuristic (no binary data, no "big" unbound data).
Also be extra smart and use *(m_aKeyIter) when getFOO is called
on a column included in it (and don't include it in any subsequent
SELECT).
However, there are several pitfalls.
One is buggy drivers that give use column names of columns that we
cannot fetch :-| Using "SELECT *" works around that because the driver
there *obviously* gives us only fetchable columns in the result.
Another one is the very restrictive nature of some database access
technologies. Take for example ODBC:
- Data can be fetched only *once* (with the SQLGetData interface;
bound columns offer a way around that, but that's viable only for
constant-length data, not variable-length data).
This could be addressed by an intelligent & lazy cache.
- Data must be fetched in increasing order of column number
(again, this is about SQLGetData).
This is a harder issue. The current solution has the nice advantage
of completely isolating the rest of LibO from these restrictions.
I don't currently see how to cleanly avoid (potentially
unnecessarily) caching column 4 if we are asked for column 3 then
column 5, just in case we are asked for column 4 later on, unless
we issue a specific "SELECT column4" later. But the latter would be
quite expensive in terms of app-to-database roudtripe times :-( and
thus creates another performance issue.
Change-Id: I999b3f8f0b8a215acb390ffefc839235346e8353
This avoids asking the driver for the same data twice.
This is particularly important for ODBC data sources, because when asking for (VAR)CHAR data the second time, one gets no data (and status SQL_NO_DATA) because of the "retrieve in parts" semantics of these datatypes.
Change-Id: I96f2df9927fda72ccf19f78ec5c561f5626c003f
Instead, try to do the least unreasonable thing:
Fetch a new row
If that fails because no new row to fetch, at least we are properly positioned after last row. Calling code may not expect that and get confused, but that is the best we can do.
Change-Id: Ib7248e99ae3deee8344e9386cac2c9440e8bccd8