Commit Graph

200 Commits

Author SHA1 Message Date
Stephan Bergmann
5e21a413c7 cppuhelper: retrofit std::exception into overriding exception specs
Change-Id: I56e32131b7991ee9948ce46765632eb823d463b3
2014-02-26 18:22:20 +01:00
Arnaud Versini
5b2ba8ed5d DBACCESS : Remove usage of DBG_CTOR and DBG_DTOR.
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>
2014-01-21 16:20:10 +00:00
Andras Timar
b55259eeb5 typo fixes
Change-Id: Ia5f104bfd707bcf4e159c78ca2764c861fb0b6d9
2013-12-20 15:55:00 +01:00
Noel Grandin
2ac31b06ae Unnecessary use of OUString constructor inside OUStringBuffer constructor
Convert code like:
    OUStringBuffer sVal(OUString("0x"));
to:
    OUStringBuffer sVal("0x");

Change-Id: Idc5a3f6a8bf1dc33f93c2b488f866c8ea58d582a
2013-12-17 11:49:05 +02:00
Lionel Elie Mamane
dd0990db74 fdo#72463 RowSet: on execute when not dirty, rebuild cache
Change-Id: I3f27b7572b88cd1200483121614c29d414c37e20
2013-12-12 20:19:06 +01:00
Noel Grandin
3ef88d370e remove unnecessary use of OUString constructor in DBACCESS module
Change-Id: I831a6506211be30c5b743c20724904c903c5b3c0
2013-11-11 11:21:24 +02:00
Lionel Elie Mamane
a102d822c9 janitorial: more const, comments
Change-Id: I5366840ab67fdf89575e890a0d97602b8e78f71a
2013-10-02 19:02:33 +02:00
Stephan Bergmann
34063e35f7 -Werror,-Wunused-variable
Change-Id: I805b898faaae631d047ec82e7139c6d6ccaea3b1
2013-10-02 18:40:14 +02:00
Jelle van der Waa
2ec606730b fdo#62475 removed pointless comments
Conflicts:
	dbaccess/source/filter/xml/xmlfilter.cxx
	dbaccess/source/ui/dlg/ConnectionPage.cxx
	dbaccess/source/ui/dlg/detailpages.cxx
	dbaccess/source/ui/dlg/odbcconfig.cxx
	dbaccess/source/ui/querydesign/querycontroller.cxx

Change-Id: I3a05649efa3a43dd8d8fb069fc1bce14ca0a6338
Reviewed-on: https://gerrit.libreoffice.org/5484
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Tested-by: Petr Mladek <pmladek@suse.cz>
2013-08-27 16:11:09 +00:00
Radu Ioan
61db96daa8 fdo#63690 - replace RTL_CONTEXT_ macros with SAL_INFO
- replaced RTL_CONTEXT_ with SAL_INFO
- replace OSL_* with SAL_*

Change-Id: I26761cf1d4c1cfe21dec7d8ede6df6f177bf2c3e
Reviewed-on: https://gerrit.libreoffice.org/4620
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
2013-07-03 07:59:33 +00:00
Thomas Arnhold
ba0a57702c remove OUString wrap for string literals
For some functions and all kinds of Exceptions.

CannotConvertException
CloseVetoException
DisposedException
EmptyUndoStackException
ErrorCodeIOException
Exception
GridInvalidDataException
GridInvalidModelException
IOException
IllegalAccessException
IllegalArgumentException
IllegalTypeException
IndexOutOfBoundsException
NoMasterException
NoSuchElementException
NoSupportException
PropertyVetoException
RuntimeException
SAXException
ScannerException
StorageWrappedTargetException
UnsupportedFlavorException
VetoException
WrappedTargetException
ZipIOException
throwGenericSQLException
throwIllegallArgumentException

createInstance
createInstanceWithContext
forName
getByName
getPackageManager
getPropertyValue
getUnpackedValueOrDefault
getValueByName
hasPropertyByName
openKey
setName
setPropertyValue
supportsService

bash command:

for i in `cat list`; do git grep "$i\s*(\s*OUString(\s*\"" -- '*.[hc]xx'
	| cut -d ':' -f1 | sort -u
	| xargs sed -i
		-e "s/\(\<$i\s*(\)\s*OUString(\s*\(\"[^\")\\]*\"\)\s*)\s*/\1\2/g"
		-e "s/\($i.*\)\"+ /\1\" + /g";
done

Change-Id: Iaf8e641b0abf28c082906014f87a183517630535
Reviewed-on: https://gerrit.libreoffice.org/4624
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2013-06-29 21:52:54 +00:00
Tor Lillqvist
0987f56912 WaE: unused variable 'insert_result'
Change-Id: I5b0b7eeaa44e3e9e215b8d0bba7e7189c63c766c
2013-04-09 01:49:04 +03:00
Thomas Arnhold
6dddefc6e7 fdo#43460: use isEmpty()
Change-Id: Ia768e684d3cf255239c04d024b35488830cc9fe6
2013-03-09 21:47:31 +01:00
Thomas Arnhold
8035a3af26 some further OUString cleanup
Change-Id: I13eb94092e29ececc9fbf494074acde5f893b605
2013-03-08 04:51:28 +01:00
Lionel Elie Mamane
a2db9096e2 fdo#61203 initialise m_aComposedTableName *before* trying to use it
Change-Id: Ie7a19bdfe9e7bc729a62191362ce0779d73385a0
2013-02-28 18:07:20 +01:00
Lionel Elie Mamane
cb9e5e786b fdo#51976 make "refetch one row" query easier to optimise
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
2013-02-27 07:01:12 +01:00
Lionel Elie Mamane
a4322a23a9 janitorial: save one object
Change-Id: I52b7d8204bb2d34639dea544833318fe86a5ddcf
2013-02-27 07:01:11 +01:00
Lionel Elie Mamane
0c87818750 janitorial
- more const qualifiers
 - remove unnecessary cast
 - don't hardcode magic number
   (length of hardcoded string)

Change-Id: Id8165ec556c913213b5be22c731b78f6b325f22c
2013-02-27 07:01:11 +01:00
Lionel Elie Mamane
1b77302ef9 spelling in comments
Change-Id: I3a7df167a91dd6ef845d16d5e6cf46ff5a82d455
2013-02-27 07:01:11 +01:00
Thomas Arnhold
405caad685 loplugin: unused variables
Change-Id: I46a748bf2c54d15c0f5718901197f3b4c34b82bf
2013-02-25 03:14:00 +01:00
Marcos Paulo de Souza
2e22005234 fdo#57950: Remove some chained appends and more in dbaccess
- 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>
2013-01-07 09:36:27 +00:00
Lionel Elie Mamane
bd60c90f85 fdo#53281 Don't cache whole row in KeySet
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
2012-12-06 19:38:28 +01:00
Lionel Elie Mamane
91fff62c87 Typo in comment
Change-Id: I63e866d5ad6ae76c8e19d04f3be1476f82966e31
2012-11-26 06:56:58 +01:00
David Ostrovsky
9e716494a8 fix some VS 2010 specific issues
Change-Id: Iae27a96c1e2ed72d2744fcbe100d6ada7dc41c82
Reviewed-on: https://gerrit.libreoffice.org/914
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2012-10-28 18:09:02 +00:00
Michael Meeks
286a7733ac re-base on ALv2 code. 2012-09-29 15:07:42 +01:00
Lionel Elie Mamane
cdadb1b4fb fdo#53557: use metadata's idea of column count to allocate a row
m_pColumnNames contains only the columns that come straight from a table, not calculated columns

Change-Id: I2706790e8c1447d1c4e144bbdef773deeca3e2e8
2012-08-31 18:18:03 +02:00
Lionel Elie Mamane
1e89c6f3d1 fdo#51239 refresh row lazily (when data is requested)
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
2012-07-17 09:19:45 +02:00
Caolán McNamara
2106d8e648 callcatcher: update unused code
Change-Id: Id5f730fc447b11000b266954f9e7f5287bad02f4
2012-06-11 14:46:45 +01:00
Michael Stahl
1ca20c89c0 KeySet.cxx: fix boost include; also...
... 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
2012-06-04 20:07:26 +02:00
Lionel Elie Mamane
e581bef6df i#102625 avoid fetching same row twice in different queries
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
2012-06-04 19:22:48 +02:00
Lionel Elie Mamane
60f5a9d372 Need to refresh row after moving to bookmark!
Change-Id: Ia8d12d02829087309e248506a7d3b0f94b5a425e
2012-06-04 19:22:48 +02:00
Lionel Elie Mamane
d147ade334 Cleanup m_xSet in destructor
Change-Id: I3d7023fcb1857da1ef107a8af0d373b9ca464f03
2012-06-04 19:22:48 +02:00
Lionel Elie Mamane
5e6a233e7b typos in comments
Change-Id: I1dbb1990033602d7909ecdee72b8b699cce44cab
2012-06-04 19:22:45 +02:00
Norbert Thiebaud
cf04745f7a targeted string re-work
Change-Id: I08114529cc6be6148a4f9ee3c89aafaafada77fe
2012-06-02 12:58:04 -05:00
Lionel Elie Mamane
24ea39d726 OKeySet::refreshRow: Invalidate m_xRow/m_xSet when BeforeFirst or AfterLast
Change-Id: I0f48c099eddc077b2a89e3b7fab66b5da55b57c8
2012-06-01 17:03:13 +02:00
Lionel Elie Mamane
e7e21a6fea organise & comment code better
Continuation of commits to fix fdo#48345

Change-Id: Ie28f6a55cd8715a7180f5d88fe23c5b310440744
2012-06-01 17:03:01 +02:00
Lionel Elie Mamane
3c436c2b0c dbaccess::OKeySet::wasNull(): OSL_ENSURE we have a m_xRow
Change-Id: I087d2893d853f431d27c592ba26bdc16e0a9cb84
2012-06-01 17:02:44 +02:00
Lionel Elie Mamane
228c360e7d fdo#47520 use the already retrieved row instead of driver row
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
2012-06-01 17:02:10 +02:00
Lionel Elie Mamane
76a74b72db fdo#50372: crash when refresh of last already-known row unexpectedly fails
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
2012-06-01 17:01:52 +02:00
Julien Nabet
dcd5136b80 Fix typos
Change-Id: I39d54e3f635be6cb7a42fc9a0f7055619c885950
2012-05-28 14:51:14 +02:00
Lionel Elie Mamane
2ffe693d7e simplify/clarify code 2012-05-15 18:52:21 +02:00
Lionel Elie Mamane
8fca982829 fdo#48345 need to refresh row also when not m_bRowCountFinal 2012-05-15 18:52:12 +02:00
Julien Nabet
e34d9be24e Prefix ++/-- operators for non-primitive types
Change-Id: I827e539c65a7463709af6425d39ccaaedaa73a8d
2012-04-29 16:35:32 +02:00
Szabolcs Dezsi
d6bc02f8c4 Replaced equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(...)) with == operator 2012-04-06 20:03:42 +02:00
Takeshi Abe
5d9b072cef removed duplicate includes in dbaccess 2012-03-30 00:42:35 +09:00
Lionel Elie Mamane
f96a392d2e fdo#45453: use integers rather than booleans
for always-true and always-false tests.
Some databases have poor or no support for booleans.
2012-01-31 21:33:25 +01:00
Lionel Elie Mamane
ef08c38172 Oups... where is my brown paper bag? 2012-01-18 13:55:45 +01:00
Lionel Elie Mamane
773668c6ab OKeySet: tryRefetch and refreshRow share most of their code 2012-01-18 13:13:59 +01:00
Lionel Elie Mamane
3623701d65 fdo#44813: make the refresh query filter NULL-safe 2012-01-18 12:37:11 +01:00
Lionel Elie Mamane
d30ecc1a23 janitorial: const iterator where may be, indentation 2012-01-17 15:47:45 +01:00