Set Table privileges. (firebird-sdbc)

Change-Id: Ia73f2f2107e17c03bc568075a0a99bc7a21fb8a7
This commit is contained in:
Andrzej J.R. Hunt
2013-08-22 09:19:17 +01:00
parent 621c1e491e
commit 7a3eff2652
2 changed files with 37 additions and 5 deletions

View File

@@ -11,11 +11,14 @@
#include "Keys.hxx"
#include "Table.hxx"
#include <TConnection.hxx>
#include <comphelper/sequence.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/TIndexes.hxx>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
using namespace ::connectivity;
using namespace ::connectivity::firebird;
@@ -28,6 +31,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno;
Table::Table(Tables* pTables,
@@ -36,9 +40,10 @@ Table::Table(Tables* pTables,
OTableHelper(pTables,
rConnection,
sal_True),
m_rMutex(rMutex)
m_rMutex(rMutex),
m_nPrivileges(0)
{
OTableHelper::construct();
construct();
}
Table::Table(Tables* pTables,
@@ -55,11 +60,34 @@ Table::Table(Tables* pTables,
rDescription,
"",
""),
m_rMutex(rMutex)
m_rMutex(rMutex),
m_nPrivileges(0)
{
OTableHelper::construct();
construct();
}
void Table::construct()
{
OTableHelper::construct();
if (!isNew())
{
// TODO: get privileges when in non-embedded mode.
m_nPrivileges = Privilege::DROP |
Privilege::REFERENCE |
Privilege::ALTER |
Privilege::CREATE |
Privilege::READ |
Privilege::DELETE |
Privilege::UPDATE |
Privilege::INSERT |
Privilege::SELECT;
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRIVILEGES),
PROPERTY_ID_PRIVILEGES,
PropertyAttribute::READONLY,
&m_nPrivileges,
::getCppuType(&m_nPrivileges));
}
}
//----- OTableHelper ---------------------------------------------------------
OCollection* Table::createColumns(const TStringVector& rNames)
{
@@ -228,4 +256,5 @@ OUString Table::getAlterTableColumn(const OUString& rColumn)
{
return ("ALTER TABLE \"" + getName() + "\" ALTER COLUMN \"" + rColumn + "\" ");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -27,6 +27,7 @@ namespace connectivity
{
private:
::osl::Mutex& m_rMutex;
sal_Int32 m_nPrivileges;
/**
* Get the ALTER TABLE [TABLE] ALTER [COLUMN] String.
@@ -34,6 +35,9 @@ namespace connectivity
*/
::rtl::OUString getAlterTableColumn(const ::rtl::OUString& rColumn);
protected:
void construct();
public:
Table(Tables* pTables,
::osl::Mutex& rMutex,
@@ -81,7 +85,6 @@ namespace connectivity
SAL_CALL getTypes()
throw(::com::sun::star::uno::RuntimeException);
};
} // namespace firebird