Commit Graph

176 Commits

Author SHA1 Message Date
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
Lionel Elie Mamane
a261e36481 fdo#44813: don't replace NULLs given by the database by type-default values
It makes no sense, because non-nullable columns can have NULL value.
E.g. in "foo LEFT JOIN bar ON condition", the non-nullable columns of "bar"
when it has no row matching "condition".

Even when we are about to insert/update a row, we should not put a
hard-coded value (that just happens to be the one constructed by the
C++ default constructor for that type) in non-nullable columns: there
is no guarantee that this value makes sense in that database's context.
The database may or may not have a default value set for that column.
If it has, we should leave it up to the database to set it automatically.
If it has not, an error *is* the right reaction.

Another place where this substitution does damage is when we refresh a
row. We use the values we have read from the primary key to select the
row again. So we should not mangle those, else the select returns no
row and we mistakingly think the row has been deleted.
2012-01-17 15:47:43 +01:00
Olivier Hallot
545921f914 Fix for fdo43460 Part XII getLength() to isEmpty()
Part XII
Module
dbaccess
2011-12-21 09:52:48 +01:00
Norbert Thiebaud
281b13ce89 remove include of pch header in dbaccess 2011-11-27 13:04:48 -06:00
August Sodora
93253ee6ab Remove some uses of OUString::setCharAt 2011-11-26 00:49:26 -05:00
Caolán McNamara
871426533f just silence the auto_ptr deprecations in isolation 2011-09-22 15:01:05 +01:00
Jan Holesovsky
5d178b6a19 Merge remote-tracking branch 'origin/integration/dev300_m106'
Conflicts:
	dbaccess/source/ui/app/makefile.mk
2011-05-27 20:39:17 +02:00
Jan Holesovsky
bc3bbd2bb4 Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts:
	dbaccess/source/core/api/CacheSet.cxx
	dbaccess/source/core/api/KeySet.cxx
	dbaccess/source/core/api/KeySet.hxx
	dbaccess/source/core/api/OptimisticSet.hxx
	dbaccess/source/core/api/RowSet.cxx
	dbaccess/source/core/api/RowSetCache.cxx
	dbaccess/source/core/api/query.cxx
	dbaccess/source/core/dataaccess/SharedConnection.cxx
	dbaccess/source/ui/app/AppController.cxx
	dbaccess/source/ui/app/makefile.mk
	dbaccess/source/ui/control/FieldDescControl.cxx
	dbaccess/source/ui/querydesign/query.src
	dbaccess/source/ui/tabledesign/TEditControl.cxx
	reportdesign/source/ui/report/ReportController.cxx
	reportdesign/source/ui/report/ReportSection.cxx
	reportdesign/source/ui/report/SectionWindow.cxx
	reportdesign/source/ui/report/StartMarker.cxx
	reportdesign/source/ui/report/ViewsWindow.cxx
2011-04-22 15:07:40 +02:00
Caolán McNamara
f02937ddfb catch by const reference 2011-04-13 09:40:26 +01:00
Jan Holesovsky
41bc9ff8d7 Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts:
	dbaccess/source/core/misc/services.cxx
	dbaccess/source/filter/migration/cfgimport.cxx
	reportdesign/source/core/api/ReportDefinition.cxx
2011-03-17 16:09:38 +01:00
Thomas Arnhold
f6ccb8354a Move OSL_ENSURE(0,...) to OSL_FAIL(...) 2011-03-12 14:05:07 +01:00
Thomas Arnhold
7a7f390db3 Move OSL_ENSURE(false,...) to OSL_FAIL(...) 2011-03-12 14:05:06 +01:00
Norbert Thiebaud
256f6ca67d Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (76 commits)
  masterfix DEV300: #i10000# usage of L10N build_type
  removetooltypes01: Fix build problems after rebase to DEV300m99 in basctl, cui, reportdesign, sw
  hr75: #i116747#: remove obsolete copyright notices
  gnumake3: remove comphelper version; fix including extract.hxx
  removetooltypes01: #i112600# Replace missing tools types replacement
  removetooltypes01: #i112600# remove tooltypes from reportdesign
  removetooltypes01: #i112600# remove tooltypes from dbaccess
  undoapi: don't use deprecated JUnit API, this seems to fail now (but didn't before the rebase)
  undoapi: those two classes do not belong into JAVATESTFILES, but JAVAFILES only
  undoapi: (I|Sfx)UndoManager now working with size_t instead of USHORT
  gridsort: give the UnoControl(Model/Base) classes a ctor taking a service factory, so we have access to the factory which created us, and don't need to resort to the process'es service factory
  dba34b: #109956# notify column value in correct order
  dba34b: #i114309# set default values for bit boolean and reset when we are on the insertrow
  undoapi: assert unknown slots in ImplInvalidateFeature
  dba34b: #i110907# check if design handle event
  dba34b: #i109956# notify column values when row is refreshed
  dba34b: #i115753# add test again
  undoapi: renamed Undo.* to RptUndo.*, to not confuse a certain IDE with different same-named files in the source tree ...
  undoapi: migrated report designer to use an own, model-bound UndoManager, instead of the UndoManager formerly bound to the controller
  undoapi: split OSingleDocumentController into DBSubComponentController (which the report design's controller will be derived from) and the still-so-named OSingleDocumentController. Module reportdesign does not compile with this change, this is yet to come.
  ...

Conflicts:
	dbaccess/inc/IEnvironment.hxx
	dbaccess/inc/dataview.hxx
	dbaccess/qa/complex/dbaccess/RowSet.java
	dbaccess/source/core/api/CacheSet.cxx
	dbaccess/source/core/api/KeySet.hxx
	dbaccess/source/core/api/OptimisticSet.hxx
	dbaccess/source/core/api/RowSet.cxx
	dbaccess/source/core/api/RowSetCache.cxx
	dbaccess/source/ext/adabas/Acomponentmodule.cxx
	dbaccess/source/ext/adabas/Aservices.cxx
	dbaccess/source/filter/migration/cfgimport.cxx
	dbaccess/source/filter/migration/cfgimport.hxx
	dbaccess/source/filter/migration/cfgservices.cxx
	dbaccess/source/filter/migration/makefile.mk
	dbaccess/source/inc/cfg_reghelper.hxx
	dbaccess/source/sdbtools/misc/sdbt_services.cxx
	dbaccess/source/shared/cfg_reghelper.cxx
	dbaccess/source/shared/cfgstrings.cxx
	dbaccess/source/shared/registrationhelper.cxx
	dbaccess/source/ui/app/AppController.cxx
	dbaccess/source/ui/app/AppDetailPageHelper.cxx
	dbaccess/source/ui/app/AppDetailPageHelper.hxx
	dbaccess/source/ui/app/AppDetailView.cxx
	dbaccess/source/ui/app/AppIconControl.cxx
	dbaccess/source/ui/app/AppSwapWindow.cxx
	dbaccess/source/ui/browser/brwctrlr.cxx
	dbaccess/source/ui/browser/dataview.cxx
	dbaccess/source/ui/browser/unodatbr.cxx
	dbaccess/source/ui/control/dbtreelistbox.cxx
	dbaccess/source/ui/control/opendoccontrols.cxx
	dbaccess/source/ui/control/tabletree.cxx
	dbaccess/source/ui/dlg/ConnectionHelper.cxx
	dbaccess/source/ui/dlg/ConnectionPage.src
	dbaccess/source/ui/dlg/ExtensionNotPresent.cxx
	dbaccess/source/ui/dlg/ExtensionNotPresent.hrc
	dbaccess/source/ui/dlg/ExtensionNotPresent.src
	dbaccess/source/ui/dlg/TablesSingleDlg.cxx
	dbaccess/source/ui/dlg/adodatalinks.hxx
	dbaccess/source/ui/dlg/dbadmin2.src
	dbaccess/source/ui/dlg/dbadminsetup.src
	dbaccess/source/ui/dlg/dlgattr.cxx
	dbaccess/source/ui/dlg/dlgsize.src
	dbaccess/source/ui/dlg/makefile.mk
	dbaccess/source/ui/dlg/sqlmessage.cxx
	dbaccess/source/ui/inc/ExtensionNotPresent.hxx
	dbaccess/source/ui/inc/TokenWriter.hxx
	dbaccess/source/ui/inc/imageprovider.hxx
	dbaccess/source/ui/misc/DExport.cxx
	dbaccess/source/ui/misc/HtmlReader.cxx
	dbaccess/source/ui/misc/RowSetDrop.cxx
	dbaccess/source/ui/misc/RtfReader.cxx
	dbaccess/source/ui/misc/TokenWriter.cxx
	dbaccess/source/ui/misc/imageprovider.cxx
	dbaccess/source/ui/misc/linkeddocuments.cxx
	dbaccess/source/ui/misc/singledoccontroller.cxx
	dbaccess/source/ui/querydesign/ConnectionData.hxx
	dbaccess/source/ui/querydesign/JoinTableView.cxx
	dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
	dbaccess/source/ui/querydesign/TableConnectionData.cxx
	dbaccess/source/ui/querydesign/TableWindowListBox.cxx
	dbaccess/source/ui/relationdesign/RelationController.cxx
	dbaccess/source/ui/relationdesign/RelationTableView.cxx
	dbaccess/source/ui/tabledesign/table.src
	reportdesign/inc/RptPage.hxx
	reportdesign/qa/complex/reportdesign/ReportDesignerTest.java
	reportdesign/source/core/api/ReportDefinition.cxx
	reportdesign/source/core/sdr/ReportUndoFactory.cxx
	reportdesign/source/core/sdr/UndoEnv.cxx
	reportdesign/source/filter/xml/xmlservices.cxx
	reportdesign/source/ui/dlg/GroupsSorting.cxx
	reportdesign/source/ui/dlg/Navigator.cxx
	reportdesign/source/ui/inspection/metadata.cxx
	reportdesign/source/ui/misc/RptUndo.cxx
	reportdesign/source/ui/misc/UITools.cxx
	reportdesign/source/ui/misc/rptuiservices.cxx
	reportdesign/source/ui/report/DesignView.cxx
	reportdesign/source/ui/report/FixedTextColor.cxx
	reportdesign/source/ui/report/ReportController.cxx
	reportdesign/source/ui/report/ReportSection.cxx
	reportdesign/source/ui/report/SectionView.cxx
	reportdesign/source/ui/report/SectionWindow.cxx
	reportdesign/source/ui/report/StartMarker.cxx
	reportdesign/source/ui/report/ViewsWindow.cxx
	reportdesign/source/ui/report/dlgedfunc.cxx
	reportdesign/source/ui/report/report.src
2011-03-09 23:17:51 -06:00
Thomas Arnhold
ba7e0d7574 Replace suitable equalsAscii calls with equalsAsciiL.
Done with sed -i 's%\(\.equalsAscii\)(\(\s\?"[^"]\+"\)\(\s\?\))%\1L(\3RTL_CONSTASCII_STRINGPARAM(\2\3)\3)%g'.
2011-01-20 10:27:06 +01:00
Ocke Janssen [oj]
54b40663d2 dba34c: #i113405# remove row from rowset when it can not be accessed anymore and adjust rowcount 2011-01-06 12:32:17 +01:00
Takeshi Abe
da474bc40c Replace all occured, occurance etc. 2010-12-05 20:15:19 +00:00
Ocke.Janssen
1ae17f5b03 dba34c: #i102625# only fetch rows when the view moves outside the scope of the rowset window 2010-12-02 13:16:48 +01:00
Ocke.Janssen
f9416a7fd8 dba34b: #i115655# new ui setting for max row scan for text db 2010-11-25 11:23:27 +01:00
Ocke.Janssen
9ad6117703 dba34b: #i111542# fix for max rows 2010-11-24 14:23:06 +01:00
Takeshi Abe
98ab2fdde6 remove dead codes and undesired comments 2010-11-23 07:40:17 +01:00
Frank Schoenheit [fs]
088b7d6202 dba34b: merge after pulling DEV300.m94 2010-11-22 14:30:32 +01:00
Norbert Thiebaud
2abe026903 Revert "Smelling pistakes, german comments, and a little commented code in base"
This reverts commit 8d33d95cde5f423aee284bbbcff810cbba1a910a.

I've been told by a german native speaker that the translation was mostly babelish
and quite incomprehensible, so revert for now.
2010-11-08 02:50:53 -06:00
Wols Lists
450ede6604 Smelling pistakes, german comments, and a little commented code in base
I think I've translated most of the german stuff correctly (I speak
german somewhat, and used babelfish to help) .

From f203be2f74f8ea4df960876434f8e55cd7973ab9 Mon Sep 17 00:00:00 2001
From: Wol <anthony@youngman.org.uk>
Date: Sun, 7 Nov 2010 01:52:20 +0000
Subject: [PATCH] Miscellaneous spelling mistakes, german, and commented code
2010-11-06 22:25:03 -05:00
Caolán McNamara
12f6fcc934 fix my own cockup 2010-10-30 21:46:00 +01:00
Gert Faller
895f2b616c Use RTL_CONSTASCII_USTRINGPARAM 2010-10-30 21:44:13 +01:00