Database: Add Limit in Query Desing View

Levels of implementation
 - Add a new toolbar item to ui (designobjectbar.xml)
 - Make a control for this element( LimitBox: derived from NumericBox)
 - Make an own controller for this control (LimitBoxController) and
   register it
 - Add new feature to the general\central controller (OQueryController)
   and construct a communication channel between the two controller
 - Modify the view switching (SQL<->Design) methods to use\set limit
   value (QueryDesignView.cxx)

Conflicts:
	dbaccess/source/ui/querydesign/QueryDesignView.cxx

Change-Id: I0eb09d1d40cfdb9b8a2a57ab8911faca91d5e690
Reviewed-on: https://gerrit.libreoffice.org/1994
Reviewed-by: Andras Timar <atimar@suse.com>
Tested-by: Andras Timar <atimar@suse.com>
This commit is contained in:
Zolnai Tamás
2013-02-04 15:21:33 +01:00
committed by Andras Timar
parent b57cb53267
commit 9a471b8cd8
14 changed files with 488 additions and 4 deletions

View File

@@ -2003,7 +2003,7 @@ namespace
}
const OSQLParseNode* pTableExp = pParseTree->getChild(3);
if ( pTableExp->getChild(6)->count() > 0 || pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0)
if ( pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0)
{
eErrorCode = eStatementTooComplex;
break;
@@ -2101,6 +2101,18 @@ namespace
{
rController.setDistinct(sal_False);
}
///check if query has a limit
if( pTableExp->getChild(6)->count() >= 2 && pTableExp->getChild(6)->getChild(1) )
{
rController.setLimit(
pTableExp->getChild(6)->getChild(1)->getTokenValue().toInt64() );
}
else
{
rController.setLimit(-1);
}
if ( (eErrorCode = InstallFields(_pView,pParseTree, pTableView->GetTabWinMap())) == eOk )
{
// GetSelectionCriteria must be called before GetHavingCriteria
@@ -2932,7 +2944,7 @@ OUString OQueryDesignView::getStatement()
}
// ----------------- Statement aufbauen ----------------------
OUStringBuffer aSqlCmd(OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT ")));
if(static_cast<OQueryController&>(getController()).isDistinct())
if(rController.isDistinct())
aSqlCmd.append(OUString(RTL_CONSTASCII_USTRINGPARAM(" DISTINCT ")));
aSqlCmd.append(aFieldListStr);
aSqlCmd.append(OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM ")));
@@ -2970,6 +2982,14 @@ OUString OQueryDesignView::getStatement()
m_rController.displayError();
}
// --------------------- Limit Clause -------------------
{
const sal_Int64 nLimit = rController.getLimit();
if( nLimit != -1 )
{
aSqlCmd.append( " LIMIT " + OUString::number(nLimit) );
}
}
OUString sSQL = aSqlCmd.makeStringAndClear();
if ( xConnection.is() )