2 * Firebird ADO.NET Data provider for .NET and Mono
4 * The contents of this file are subject to the Initial
5 * Developer's Public License Version 1.0 (the "License");
6 * you may not use this file except in compliance with the
7 * License. You may obtain a copy of the License at
8 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 * Software distributed under the License is distributed on
11 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12 * express or implied. See the License for the specific
13 * language governing rights and limitations under the License.
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16 * All Rights Reserved.
21 using System.Globalization;
24 namespace FirebirdSql.Data.Firebird.DbSchema
26 internal class FbProcedurePrivilegesSchema : FbDbSchema
30 public FbProcedurePrivilegesSchema() : base("ProcedurePrivileges")
36 #region Protected Methods
38 protected override StringBuilder GetCommandText(object[] restrictions)
40 StringBuilder sql = new StringBuilder();
41 StringBuilder where = new StringBuilder();
45 "null AS PROCEDURE_CATALOG, " +
46 "null AS PROCEDURE_SCHEMA, " +
47 "rdb$relation_name AS PROCEDURE_NAME, " +
48 "rdb$user AS GRANTEE, " +
49 "rdb$grantor AS GRANTOR, " +
50 "rdb$privilege AS PRIVILEGE, " +
51 "rdb$grant_option AS WITH_GRANT " +
53 "rdb$user_privileges");
55 where.Append("rdb$object_type = 5");
57 if (restrictions != null)
61 /* PROCEDURE_CATALOG */
62 if (restrictions.Length >= 1 && restrictions[0] != null)
66 /* PROCEDURE_SCHEMA */
67 if (restrictions.Length >= 2 && restrictions[1] != null)
72 if (restrictions.Length >= 3 && restrictions[2] != null)
74 where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$relation_name = @p{0}", index++);
78 if (restrictions.Length >= 5 && restrictions[4] != null)
80 where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$grantor = @p{0}", index++);
84 if (restrictions.Length >= 4 && restrictions[3] != null)
86 where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$user = @p{0}", index++);
92 sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString());
95 sql.Append(" ORDER BY rdb$relation_name");