Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
077e711b
Kaydet (Commit)
077e711b
authored
Mar 27, 2012
tarafından
Lionel Elie Mamane
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#47937: copy column privileges into table privileges
üst
31d0dcfa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
11 deletions
+62
-11
dbtools2.cxx
connectivity/source/commontools/dbtools2.cxx
+62
-11
No files found.
connectivity/source/commontools/dbtools2.cxx
Dosyayı görüntüle @
077e711b
...
@@ -674,19 +674,20 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
...
@@ -674,19 +674,20 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
Reference
<
XResultSet
>
xPrivileges
=
_xMetaData
->
getTablePrivileges
(
aVal
,
_sSchema
,
_sTable
);
Reference
<
XResultSet
>
xPrivileges
=
_xMetaData
->
getTablePrivileges
(
aVal
,
_sSchema
,
_sTable
);
Reference
<
XRow
>
xCurrentRow
(
xPrivileges
,
UNO_QUERY
);
Reference
<
XRow
>
xCurrentRow
(
xPrivileges
,
UNO_QUERY
);
const
::
rtl
::
OUString
sUserWorkingFor
=
_xMetaData
->
getUserName
();
static
const
::
rtl
::
OUString
sSELECT
(
RTL_CONSTASCII_USTRINGPARAM
(
"SELECT"
));
static
const
::
rtl
::
OUString
sINSERT
(
RTL_CONSTASCII_USTRINGPARAM
(
"INSERT"
));
static
const
::
rtl
::
OUString
sUPDATE
(
RTL_CONSTASCII_USTRINGPARAM
(
"UPDATE"
));
static
const
::
rtl
::
OUString
sDELETE
(
RTL_CONSTASCII_USTRINGPARAM
(
"DELETE"
));
static
const
::
rtl
::
OUString
sREAD
(
RTL_CONSTASCII_USTRINGPARAM
(
"READ"
));
static
const
::
rtl
::
OUString
sCREATE
(
RTL_CONSTASCII_USTRINGPARAM
(
"CREATE"
));
static
const
::
rtl
::
OUString
sALTER
(
RTL_CONSTASCII_USTRINGPARAM
(
"ALTER"
));
static
const
::
rtl
::
OUString
sREFERENCE
(
RTL_CONSTASCII_USTRINGPARAM
(
"REFERENCE"
));
static
const
::
rtl
::
OUString
sDROP
(
RTL_CONSTASCII_USTRINGPARAM
(
"DROP"
));
if
(
xCurrentRow
.
is
()
)
if
(
xCurrentRow
.
is
()
)
{
{
::
rtl
::
OUString
sUserWorkingFor
=
_xMetaData
->
getUserName
();
// after creation the set is positioned before the first record, per definition
static
const
::
rtl
::
OUString
sSELECT
(
RTL_CONSTASCII_USTRINGPARAM
(
"SELECT"
));
static
const
::
rtl
::
OUString
sINSERT
(
RTL_CONSTASCII_USTRINGPARAM
(
"INSERT"
));
static
const
::
rtl
::
OUString
sUPDATE
(
RTL_CONSTASCII_USTRINGPARAM
(
"UPDATE"
));
static
const
::
rtl
::
OUString
sDELETE
(
RTL_CONSTASCII_USTRINGPARAM
(
"DELETE"
));
static
const
::
rtl
::
OUString
sREAD
(
RTL_CONSTASCII_USTRINGPARAM
(
"READ"
));
static
const
::
rtl
::
OUString
sCREATE
(
RTL_CONSTASCII_USTRINGPARAM
(
"CREATE"
));
static
const
::
rtl
::
OUString
sALTER
(
RTL_CONSTASCII_USTRINGPARAM
(
"ALTER"
));
static
const
::
rtl
::
OUString
sREFERENCE
(
RTL_CONSTASCII_USTRINGPARAM
(
"REFERENCE"
));
static
const
::
rtl
::
OUString
sDROP
(
RTL_CONSTASCII_USTRINGPARAM
(
"DROP"
));
// after creation the set is positioned before the first record, per definitionem
#ifdef DBG_UTIL
#ifdef DBG_UTIL
Reference
<
XResultSetMetaDataSupplier
>
xSup
(
xPrivileges
,
UNO_QUERY
);
Reference
<
XResultSetMetaDataSupplier
>
xSup
(
xPrivileges
,
UNO_QUERY
);
if
(
xSup
.
is
()
)
if
(
xSup
.
is
()
)
...
@@ -743,6 +744,56 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
...
@@ -743,6 +744,56 @@ sal_Int32 getTablePrivileges(const Reference< XDatabaseMetaData>& _xMetaData,
}
}
}
}
disposeComponent
(
xPrivileges
);
disposeComponent
(
xPrivileges
);
// Some drivers put a table privilege as soon as any column has the privilege,
// some drivers only if all columns have the privilege.
// To unifiy the situation, collect column privileges here, too.
Reference
<
XResultSet
>
xColumnPrivileges
=
_xMetaData
->
getColumnPrivileges
(
aVal
,
_sSchema
,
_sTable
,
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"%"
)));
Reference
<
XRow
>
xColumnCurrentRow
(
xColumnPrivileges
,
UNO_QUERY
);
if
(
xColumnCurrentRow
.
is
()
)
{
// after creation the set is positioned before the first record, per definition
::
rtl
::
OUString
sPrivilege
,
sGrantee
;
while
(
xColumnPrivileges
->
next
()
)
{
#ifdef DBG_UTIL
::
rtl
::
OUString
sCat
,
sSchema
,
sTableName
,
sColumnName
,
sGrantor
,
sGrantable
;
sCat
=
xColumnCurrentRow
->
getString
(
1
);
sSchema
=
xColumnCurrentRow
->
getString
(
2
);
sTableName
=
xColumnCurrentRow
->
getString
(
3
);
sColumnName
=
xColumnCurrentRow
->
getString
(
4
);
sGrantor
=
xColumnCurrentRow
->
getString
(
5
);
#endif
sGrantee
=
xColumnCurrentRow
->
getString
(
6
);
sPrivilege
=
xColumnCurrentRow
->
getString
(
7
);
#ifdef DBG_UTIL
sGrantable
=
xColumnCurrentRow
->
getString
(
8
);
#endif
if
(
!
sUserWorkingFor
.
equalsIgnoreAsciiCase
(
sGrantee
))
continue
;
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sSELECT
))
nPrivileges
|=
Privilege
::
SELECT
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sINSERT
))
nPrivileges
|=
Privilege
::
INSERT
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sUPDATE
))
nPrivileges
|=
Privilege
::
UPDATE
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sDELETE
))
nPrivileges
|=
Privilege
::
DELETE
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sREAD
))
nPrivileges
|=
Privilege
::
READ
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sCREATE
))
nPrivileges
|=
Privilege
::
CREATE
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sALTER
))
nPrivileges
|=
Privilege
::
ALTER
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sREFERENCE
))
nPrivileges
|=
Privilege
::
REFERENCE
;
else
if
(
sPrivilege
.
equalsIgnoreAsciiCase
(
sDROP
))
nPrivileges
|=
Privilege
::
DROP
;
}
}
disposeComponent
(
xColumnPrivileges
);
}
}
catch
(
const
SQLException
&
e
)
catch
(
const
SQLException
&
e
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment