25#include <com/sun/star/sdb/CommandType.hpp>
26#include <com/sun/star/sdbc/XDataSource.hpp>
27#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
34#include <osl/diagnose.h>
68 OUString sSourceArg, sCommandArg;
69 sal_Int32 nCommandTypeArg = 0;
77 Sequence<Any> aSelection;
79 pSelectionItem->
GetValue() >>= aSelection;
84 pSourceItem->
GetValue() >>= sSourceArg;
89 pCommandItem->
GetValue() >>= sCommandArg;
94 pCommandTypeItem->
GetValue() >>= nCommandTypeArg;
96 Reference<XConnection> xConnection;
99 pConnectionItem->
GetValue() >>= xConnection;
101 if ( !xConnection.is() )
103 Reference<XDataSource> xSource;
107 if(!xConnection.is())
111 Reference<XResultSet> xCursor;
113 pCursorItem->GetValue() >>= xCursor;
119 if(pSourceItem && pCommandItem && pCommandTypeItem)
140 bool bDisposeResultSet =
false;
145 bDisposeResultSet = xCursor.is();
148 ODataAccessDescriptor aDescriptor;
149 aDescriptor.setDataSource(sSourceArg);
150 aDescriptor[DataAccessDescriptorProperty::Command] <<= sCommandArg;
151 aDescriptor[DataAccessDescriptorProperty::Cursor] <<= xCursor;
152 aDescriptor[DataAccessDescriptorProperty::Selection] <<= aSelection;
153 aDescriptor[DataAccessDescriptorProperty::CommandType] <<= nCommandTypeArg;
156 pDBManager->
Merge(aMergeDesc);
158 if ( bDisposeResultSet )
159 ::comphelper::disposeComponent(xCursor);
169 OUString sColumnName;
171 pColumnNameItem->
GetValue() >>= sColumnName;
172 OUString sDBName = sSourceArg + OUStringChar(
DB_DELIM)
173 + sCommandArg + OUStringChar(
DB_DELIM)
174 + OUString::number(nCommandTypeArg)
175 + OUStringChar(
DB_DELIM) + sColumnName;
185 uno::Reference< XDispatchRecorder > xRecorder =
187 if ( xRecorder.is() )
201 OSL_ENSURE(
false,
"wrong dispatcher");
211 bool bDispose =
false;
212 Reference< sdbc::XConnection> xConnection = pDBStruct->
xConnection;
215 if(xConnection.is() && !xSource.is())
218 if ( !xConnection.is() )
220 SwView &rSwView = GetView();
225 Reference< XColumnsSupplier> xColSupp;
240 if(
RET_OK == pDlg->Execute() )
242 Reference <XResultSet> xResSet = pDBStruct->
xCursor;
243 pDlg->DataToDoc( pDBStruct->
aSelection, xSource, xConnection, xResSet);
247 ::comphelper::disposeComponent(xConnection);
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void AppendItem(const SfxPoolItem &)
void Done(bool bRemove=false)
const css::uno::Any & GetValue() const
SfxBindings & GetBindings()
SfxViewFrame & GetViewFrame() const
virtual VclPtr< AbstractSwInsertDBColAutoPilot > CreateSwInsertDBColAutoPilot(SwView &rView, css::uno::Reference< css::sdbc::XDataSource > rxSource, css::uno::Reference< css::sdbcx::XColumnsSupplier > xColSupp, const SwDBData &rData)=0
static SwAbstractDialogFactory * Create()
SwWrtShell * GetShellPtr()
static css::uno::Reference< css::sdbc::XConnection > GetConnection(const OUString &rDataSource, css::uno::Reference< css::sdbc::XDataSource > &rxSource, const SwView *pView)
static css::uno::Reference< css::sdbcx::XColumnsSupplier > GetColumnSupplier(css::uno::Reference< css::sdbc::XConnection > const &xConnection, const OUString &rTableOrQuery, SwDBSelect eTableOrQuery=SwDBSelect::UNKNOWN)
bool Merge(const SwMergeDescriptor &rMergeDesc)
Merging of data records into fields.
static css::uno::Reference< css::sdbc::XDataSource > getDataSourceAsParent(const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const OUString &_sDataSourceName)
try to get the data source from the given connection through the XChild interface.
static css::uno::Reference< css::sdbc::XResultSet > createCursor(const OUString &_sDataSourceName, const OUString &_sCommand, sal_Int32 _nCommandType, const css::uno::Reference< css::sdbc::XConnection > &_xConnection, const SwView *pView)
creates a RowSet, which must be disposed after use.
SwDBManager * GetDBManager() const
For evaluation of DB fields (new DB-manager).
bool InsertField(SwInsertField_Data &rData)
void ExecDB(SfxRequest const &)
#define FN_DB_DATA_SOURCE_ANY
#define FN_DB_DATA_CURSOR_ANY
#define FN_INSERT_DBFIELD
#define FN_DB_CONNECTION_ANY
#define FN_QRY_INSERT_FIELD
#define FN_QRY_MERGE_FIELD
#define FN_DB_DATA_COLUMN_NAME_ANY
#define FN_DB_DATA_COMMAND_ANY
#define FN_DB_DATA_SELECTION_ANY
#define FN_DB_DATA_COMMAND_TYPE_ANY
#define FN_PARAM_FIELD_TYPE
@ DBMGR_MERGE
Data records in fields.
#define LINK(Instance, Class, Member)
constexpr OUStringLiteral aData
Reference< XResultSet > xCursor
Reference< XConnection > xConnection
Sequence< Any > aSelection
IMPL_LINK(SwBaseShell, InsertDBTextHdl, void *, p, void)