summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-03-30 07:47:18 +0000
committerOcke Janssen <oj@openoffice.org>2001-03-30 07:47:18 +0000
commit21d596a931864c36e22f4d876440c497c256c512 (patch)
treeba08511e567ceba2f89ed12e43da45dc2c190a92 /dbaccess
parent14482ffc65c689c4aadbd2cd1134ae9c4e9b2e6c (diff)
correct the creation of views
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/browser/dsbrowserDnD.cxx10
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx5
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx15
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx56
4 files changed, 71 insertions, 15 deletions
diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
index 4be205bbe893..b5092315cbf6 100644
--- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx
+++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dsbrowserDnD.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: fs $ $Date: 2001-03-28 15:44:58 $
+ * last change: $Author: oj $ $Date: 2001-03-30 08:47:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -570,6 +570,9 @@ namespace dbaui
::comphelper::disposeComponent(xDestRsUpd);
}
break;
+ case OCopyTableWizard::WIZARD_DEF_VIEW:
+ xTable = aWizard.createView();
+ break;
default:
break;
}
@@ -798,6 +801,9 @@ namespace dbaui
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.3 2001/03/28 15:44:58 fs
+ * changed the ctor of ODataClipboard
+ *
* Revision 1.2 2001/03/27 07:09:19 oj
* use of new initialize
*
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 8314fc81815c..718f46adb907 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WCopyTable.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-02-23 14:59:07 $
+ * last change: $Author: oj $ $Date: 2001-03-30 08:44:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -245,6 +245,7 @@ namespace dbaui
void clearDestColumns();
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createTable();
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createView();
};
}
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 2f7f971b07de..7f78e90e6589 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WCPage.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-02-23 15:07:07 $
+ * last change: $Author: oj $ $Date: 2001-03-30 08:44:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -135,7 +135,7 @@ OCopyTable::OCopyTable( Window * pParent, EImportMode atWhat, sal_Bool bIsQuery,
::rtl::OUString sValue = xRow->getString(1);
if(!xRow->wasNull() && sValue.equalsIgnoreCase(sVIEW))
{
- m_bIsViewAllowed &= sal_True;
+ m_bIsViewAllowed = m_bIsViewAllowed || sal_True;
break;
}
}
@@ -187,8 +187,7 @@ OCopyTable::OCopyTable( Window * pParent, EImportMode atWhat, sal_Bool bIsQuery,
m_edKeyName.Enable(sal_False);
m_edKeyName.SetText(String::CreateFromAscii("ID"));
sal_Int32 nMaxLen = xMetaData->getMaxColumnNameLength();
- if(nMaxLen)
- m_edKeyName.SetMaxTextLen(nMaxLen);
+ m_edKeyName.SetMaxTextLen(nMaxLen ? (xub_StrLen)nMaxLen : EDIT_NOLIMIT);
FreeResource();
@@ -349,8 +348,7 @@ void OCopyTable::ActivatePage()
//////////////////////////////////////////////////////////////////////////
// Ist der Name zu lang?
sal_Int32 nLen = m_pParent->m_xConnection->getMetaData()->getMaxTableNameLength();
- if(nLen)
- m_edTableName.SetMaxTextLen(nLen);
+ m_edTableName.SetMaxTextLen(nLen ? (xub_StrLen)nLen : EDIT_NOLIMIT);
//m_pParent->EnableButton(OCopyTableWizard::WIZARD_FINISH,FALSE);
// if (m_pParent->m_xSourceDef.Is() && (m_pParent->m_xSourceDef->GetDatabase() == m_pParent->m_xDatabase))
@@ -368,8 +366,7 @@ void OCopyTable::Reset()
sal_Int32 nLen = m_pParent->m_xConnection->getMetaData()->getMaxTableNameLength();
- if(nLen)
- m_edTableName.SetMaxTextLen(nLen);
+ m_edTableName.SetMaxTextLen(nLen ? (xub_StrLen)nLen : EDIT_NOLIMIT);
String aTableName = m_pParent->m_sName;
if(nLen && nLen < aTableName.Len())
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 5f07fd347e04..c7cd2e692ee4 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WCopyTable.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: fs $ $Date: 2001-03-15 08:23:44 $
+ * last change: $Author: oj $ $Date: 2001-03-30 08:44:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@
#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#endif
#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#endif
@@ -119,6 +122,9 @@
#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
#endif
+#ifndef DBAUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
@@ -889,6 +895,52 @@ void OCopyTableWizard::setColumnProperties(const Reference<XPropertySet>& _rxCol
_rxColumn->setPropertyValue(PROPERTY_DEFAULTVALUE,makeAny(_pFieldDesc->GetDefaultValue()));
}
// -----------------------------------------------------------------------------
+Reference< XPropertySet > OCopyTableWizard::createView()
+{
+ Reference<XViewsSupplier> xSup(m_xConnection,UNO_QUERY);
+ Reference< XNameAccess > xViews;
+ if(xSup.is())
+ xViews = xSup->getViews();
+ Reference<XDataDescriptorFactory> xFact(xViews,UNO_QUERY);
+ OSL_ENSURE(xFact.is(),"No XDataDescriptorFactory available!");
+ if(!xFact.is())
+ return NULL;
+
+ m_xDestObject = xFact->createDataDescriptor();
+ ::rtl::OUString sCatalog,sSchema,sTable;
+ ::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),
+ m_sName,
+ sCatalog,
+ sSchema,
+ sTable);
+
+ m_xDestObject->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
+ m_xDestObject->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
+ m_xDestObject->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
+
+ ::rtl::OUString sCommand = ::rtl::OUString::createFromAscii("SELECT * FROM ");
+ ::rtl::OUString sComposedName;
+ ::dbaui::composeTableName(m_xConnection->getMetaData(),m_xSourceObject,sComposedName,sal_True);
+ sCommand += sComposedName;
+ m_xDestObject->setPropertyValue(PROPERTY_COMMAND,makeAny(sCommand));
+
+ Reference<XAppend> xAppend(xViews,UNO_QUERY);
+ if(xAppend.is())
+ xAppend->appendByDescriptor(m_xDestObject);
+
+ m_xDestObject = NULL;
+ // we need to reget the view because after appending it it is no longer valid
+ // but this time it isn't a view object it is a table object with type "VIEW"
+ Reference<XTablesSupplier> xTabSup(m_xConnection,UNO_QUERY);
+ Reference< XNameAccess > xTables;
+ if(xSup.is())
+ xTables = xTabSup->getTables();
+ if(xTables.is() && xTables->hasByName(m_sName))
+ xTables->getByName(m_sName) >>= m_xDestObject;
+
+ return m_xDestObject;
+}
+// -----------------------------------------------------------------------------
Reference< XPropertySet > OCopyTableWizard::createTable()
{
Reference<XTablesSupplier> xSup(m_xConnection,UNO_QUERY);