/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// get the data source name
pSourceItem = pArgs->GetItemIfSet(FN_DB_DATA_SOURCE_ANY, false); if(pSourceItem)
pSourceItem->GetValue() >>= sSourceArg;
// get the command
pCommandItem = pArgs->GetItemIfSet(FN_DB_DATA_COMMAND_ANY, false); if(pCommandItem)
pCommandItem->GetValue() >>= sCommandArg;
// get the command type
pCommandTypeItem = pArgs->GetItemIfSet(FN_DB_DATA_COMMAND_TYPE_ANY, false); if(pCommandTypeItem)
pCommandTypeItem->GetValue() >>= nCommandTypeArg;
Reference<XConnection> xConnection;
pConnectionItem = pArgs->GetItemIfSet(FN_DB_CONNECTION_ANY, false); if(pConnectionItem)
pConnectionItem->GetValue() >>= xConnection; // may be we even get no connection if ( !xConnection.is() )
{
Reference<XDataSource> xSource;
SwView &rSwView = GetView();
xConnection = SwDBManager::GetConnection(sSourceArg, xSource, &rSwView);
} if(!xConnection.is()) return ;
// get the cursor, we use to travel, may be NULL
Reference<XResultSet> xCursor; if ( const SfxUnoAnyItem* pCursorItem = pArgs->GetItemIfSet(FN_DB_DATA_CURSOR_ANY, false) )
pCursorItem->GetValue() >>= xCursor;
switch (rReq.GetSlot())
{ case FN_QRY_INSERT:
{ if(pSourceItem && pCommandItem && pCommandTypeItem)
{
DBTextStruct_Impl* pNew = new DBTextStruct_Impl;
pNew->aDBData.sDataSource = sSourceArg;
pNew->aDBData.sCommand = sCommandArg;
pNew->aDBData.nCommandType = nCommandTypeArg;
pNew->aSelection = aSelection; //if the cursor is NULL, it must be created inside InsertDBTextHdl // because it called via a PostUserEvent
pNew->xCursor = xCursor;
pNew->xConnection = xConnection;
Application::PostUserEvent( LINK( this, SwBaseShell, InsertDBTextHdl ), pNew ); // the pNew will be removed in InsertDBTextHdl !!
}
} break;
case FN_QRY_MERGE_FIELD:
{ // we don't get any cursor, so we must create our own bool bDisposeResultSet = false; if ( !xCursor.is() )
{
SwView &rSwView = GetView();
xCursor = SwDBManager::createCursor(sSourceArg,sCommandArg,nCommandTypeArg,xConnection,&rSwView);
bDisposeResultSet = xCursor.is();
}
bool bDispose = false;
Reference< sdbc::XConnection> xConnection = pDBStruct->xConnection;
Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection,pDBStruct->aDBData.sDataSource); // #111987# the connection is disposed and so no parent has been found if(xConnection.is() && !xSource.is()) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.