// 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.