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
97a142d6
Kaydet (Commit)
97a142d6
authored
Tem 29, 2013
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implement getColumnPrivileges. (firebird-sdbc)
Change-Id: I31e179462a06db135467e8b78e4b550cc603a04a
üst
1db4ed1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
10 deletions
+102
-10
FDatabaseMetaData.cxx
connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+102
-10
No files found.
connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
Dosyayı görüntüle @
97a142d6
...
...
@@ -848,16 +848,106 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
{
return
NULL
;
}
// -------------------------------------------------------------------------
uno
::
Reference
<
XResultSet
>
SAL_CALL
ODatabaseMetaData
::
getColumnPrivileges
(
const
Any
&
catalog
,
const
OUString
&
schema
,
const
OUString
&
table
,
const
OUString
&
columnNamePattern
)
throw
(
SQLException
,
RuntimeException
)
const
Any
&
aCatalog
,
const
OUString
&
sSchema
,
const
OUString
&
sTable
,
const
OUString
&
sColumnNamePattern
)
throw
(
SQLException
,
RuntimeException
)
{
(
void
)
catalog
;
(
void
)
schema
;
(
void
)
table
;
(
void
)
columnNamePattern
;
return
NULL
;
(
void
)
aCatalog
;
(
void
)
sSchema
;
SAL_INFO
(
"connectivity.firebird"
,
"getColumnPrivileges() with "
"Table: "
<<
sTable
<<
" & ColumnNamePattern: "
<<
sColumnNamePattern
);
ODatabaseMetaDataResultSet
*
pResultSet
=
new
ODatabaseMetaDataResultSet
(
ODatabaseMetaDataResultSet
::
eTables
);
uno
::
Reference
<
XResultSet
>
xResultSet
=
pResultSet
;
uno
::
Reference
<
XStatement
>
statement
=
m_pConnection
->
createStatement
();
static
const
OUString
wld
(
"%"
);
OUStringBuffer
queryBuf
(
"SELECT "
"priv.RDB$RELATION_NAME, "
// 1 Table name
"priv.RDB$GRANTOR,"
// 2
"priv.RDB$USER, "
// 3 Grantee
"priv.RDB$PRIVILEGE, "
// 4
"priv.RDB$GRANT_OPTION, "
// 5 is Grantable
"priv.RDB$FIELD_NAME "
// 6 Column name
"FROM RDB$USER_PRIVILEGES priv "
);
{
OUString
sAppend
=
"WHERE priv.RDB$RELATION_NAME = '%' "
;
queryBuf
.
append
(
sAppend
.
replaceAll
(
"%"
,
sTable
));
}
if
(
!
sColumnNamePattern
.
isEmpty
())
{
OUString
sAppend
;
if
(
sColumnNamePattern
.
match
(
wld
))
sAppend
=
"AND priv.RDB$FIELD_NAME LIKE '%' "
;
else
sAppend
=
"AND priv.RDB$FIELD_NAME = '%' "
;
queryBuf
.
append
(
sAppend
.
replaceAll
(
wld
,
sColumnNamePattern
));
}
queryBuf
.
append
(
" ORDER BY priv.RDB$FIELD, "
"priv.RDB$PRIVILEGE"
);
OUString
query
=
queryBuf
.
makeStringAndClear
();
uno
::
Reference
<
XResultSet
>
rs
=
statement
->
executeQuery
(
query
.
getStr
());
uno
::
Reference
<
XRow
>
xRow
(
rs
,
UNO_QUERY_THROW
);
ODatabaseMetaDataResultSet
::
ORows
aResults
;
while
(
rs
->
next
()
)
{
ODatabaseMetaDataResultSet
::
ORow
aCurrentRow
(
8
);
// 1. TABLE_CAT
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
());
// 2. TABLE_SCHEM
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
());
// 3. TABLE_NAME
{
OUString
sTableName
=
xRow
->
getString
(
1
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
sTableName
));
}
// 3. COLUMN_NAME
{
OUString
sColumnName
=
xRow
->
getString
(
6
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
sColumnName
));
}
// 4. GRANTOR
{
OUString
sGrantor
=
xRow
->
getString
(
2
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
sGrantor
));
}
// 5. GRANTEE
{
OUString
sGrantee
=
xRow
->
getString
(
3
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
sGrantee
));
}
// 6. Privilege
{
OUString
sPrivilege
=
xRow
->
getString
(
4
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
sPrivilege
));
}
// 7. IS_GRANTABLE
{
sal_Bool
bIsGrantable
=
xRow
->
getBoolean
(
5
);
aCurrentRow
.
push_back
(
new
ORowSetValueDecorator
(
bIsGrantable
));
}
aResults
.
push_back
(
aCurrentRow
);
}
pResultSet
->
setRows
(
aResults
);
return
xResultSet
;
}
uno
::
Reference
<
XResultSet
>
SAL_CALL
ODatabaseMetaData
::
getColumns
(
...
...
@@ -1256,6 +1346,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
uno
::
Reference
<
XResultSet
>
xResultSet
=
pResultSet
;
uno
::
Reference
<
XStatement
>
statement
=
m_pConnection
->
createStatement
();
// TODO: column specific privileges are included, we may need
// to have WHERE RDB$FIELD_NAME = NULL or similar.
static
const
OUString
wld
(
"%"
);
OUStringBuffer
queryBuf
(
"SELECT "
...
...
@@ -1271,9 +1363,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
{
OUString
sAppend
;
if
(
sTableNamePattern
.
match
(
wld
))
sAppend
=
"
AND
priv.RDB$RELATION_NAME LIKE '%' "
;
sAppend
=
"
WHERE
priv.RDB$RELATION_NAME LIKE '%' "
;
else
sAppend
=
"
AND
priv.RDB$RELATION_NAME = '%' "
;
sAppend
=
"
WHERE
priv.RDB$RELATION_NAME = '%' "
;
queryBuf
.
append
(
sAppend
.
replaceAll
(
wld
,
sTableNamePattern
));
}
...
...
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