66 " SELECT \"priv_bit\", \"object\", \"name\", \"user\", " +
67 " \"grant_option\", \"granter\" " +
68 " FROM " + SystemSchema.UserGrantsTableName +
69 " WHERE ( user = user() OR user = '@PUBLIC' )");
73 " SELECT \"description\", \"object\", \"name\", \"user\", " +
74 " \"grant_option\", \"granter\" " +
75 " FROM " + SystemSchema.UserGrantsTableName +
", " + SystemSchema.PrivilegesTableName +
76 " WHERE ( user = user() OR user = '@PUBLIC' )" +
77 " AND " + SystemSchema.UserGrantsTableName +
".priv_bit = " +
78 SystemSchema.PrivilegesTableName +
".priv_bit");
83 " SELECT * FROM " + SystemSchema.SchemaInfoTableName +
84 " WHERE \"name\" IN ( " +
88 " AND \"description\" = '" +
Privileges.List +
"' )");
93 " SELECT * FROM " + SystemSchema.TableColumnsTableName +
94 " WHERE \"schema\" IN ( " +
100 " SELECT * FROM " + SystemSchema.TableInfoTableName +
101 " WHERE \"schema\" IN ( " +
104 query.ExecuteQuery(
" CREATE VIEW " +
Tables +
" AS " +
105 " SELECT NULL AS \"TABLE_CATALOG\", \n" +
106 " \"schema\" AS \"TABLE_SCHEMA\", \n" +
107 " \"name\" AS \"TABLE_NAME\", \n" +
108 " \"type\" AS \"TABLE_TYPE\", \n" +
109 " \"other\" AS \"REMARKS\", \n" +
110 " NULL AS \"TYPE_CATALOG\", \n" +
111 " NULL AS \"TYPE_SCHEMA\", \n" +
112 " NULL AS \"TYPE_NAME\", \n" +
113 " NULL AS \"SELF_REFERENCING_COL_NAME\", \n" +
114 " NULL AS \"REF_GENERATION\" \n" +
117 query.ExecuteQuery(
" CREATE VIEW " +
Schemata +
" AS " +
118 " SELECT \"name\" AS \"TABLE_SCHEMA\", \n" +
119 " NULL AS \"TABLE_CATALOG\" \n" +
122 query.ExecuteQuery(
" CREATE VIEW " +
Catalogs +
" AS " +
123 " SELECT NULL AS \"TABLE_CATALOG\" \n" +
124 " FROM " + SystemSchema.SchemaInfoTableName +
"\n" +
127 query.ExecuteQuery(
" CREATE VIEW " +
Columns +
" AS " +
128 " SELECT NULL AS \"TABLE_CATALOG\",\n" +
129 " \"schema\" AS \"TABLE_SCHEMA\",\n" +
130 " \"table\" AS \"TABLE_NAME\",\n" +
131 " \"column\" AS \"COLUMN_NAME\",\n" +
132 " \"sql_type\" AS \"DATA_TYPE\",\n" +
133 " \"type_desc\" AS \"TYPE_NAME\",\n" +
134 " IIF(\"size\" = -1, 1024, \"size\") AS \"COLUMN_SIZE\",\n" +
135 " NULL AS \"BUFFER_LENGTH\",\n" +
136 " \"scale\" AS \"DECIMAL_DIGITS\",\n" +
137 " IIF(\"sql_type\" = -7, 2, 10) AS \"NUM_PREC_RADIX\",\n" +
138 " IIF(\"not_null\", 0, 1) AS \"NULLABLE\",\n" +
139 " '' AS \"REMARKS\",\n" +
140 " \"default\" AS \"COLUMN_DEFAULT\",\n" +
141 " NULL AS \"SQL_DATA_TYPE\",\n" +
142 " NULL AS \"SQL_DATETIME_SUB\",\n" +
143 " IIF(\"size\" = -1, 1024, \"size\") AS \"CHAR_OCTET_LENGTH\",\n" +
144 " \"seq_no\" + 1 AS \"ORDINAL_POSITION\",\n" +
145 " IIF(\"not_null\", 'NO', 'YES') AS \"IS_NULLABLE\"\n" +
149 " SELECT \"TABLE_CATALOG\",\n" +
150 " \"TABLE_SCHEMA\",\n" +
151 " \"TABLE_NAME\",\n" +
152 " \"COLUMN_NAME\",\n" +
153 " IIF(\"ThisUserGrant.granter\" = '@SYSTEM', \n" +
154 " NULL, \"ThisUserGrant.granter\") AS \"GRANTOR\",\n" +
155 " IIF(\"ThisUserGrant.user\" = '@PUBLIC', \n" +
156 " 'public', \"ThisUserGrant.user\") AS \"GRANTEE\",\n" +
157 " \"ThisUserGrant.description\" AS \"PRIVILEGE\",\n" +
158 " IIF(\"grant_option\" = 'true', 'YES', 'NO') AS \"IS_GRANTABLE\" \n" +
159 " FROM " +
Columns +
", INFORMATION_SCHEMA.ThisUserGrant \n" +
160 " WHERE CONCAT(columns.TABLE_SCHEMA, '.', columns.TABLE_NAME) = \n" +
161 " ThisUserGrant.name \n" +
162 " AND INFORMATION_SCHEMA.ThisUserGrant.object = 1 \n" +
163 " AND INFORMATION_SCHEMA.ThisUserGrant.description IS NOT NULL \n");
166 " SELECT \"TABLE_CATALOG\",\n" +
167 " \"TABLE_SCHEMA\",\n" +
168 " \"TABLE_NAME\",\n" +
169 " IIF(\"ThisUserGrant.granter\" = '@SYSTEM', \n" +
170 " NULL, \"ThisUserGrant.granter\") AS \"GRANTOR\",\n" +
171 " IIF(\"ThisUserGrant.user\" = '@PUBLIC', \n" +
172 " 'public', \"ThisUserGrant.user\") AS \"GRANTEE\",\n" +
173 " \"ThisUserGrant.description\" AS \"PRIVILEGE\",\n" +
174 " IIF(\"grant_option\" = 'true', 'YES', 'NO') AS \"IS_GRANTABLE\" \n" +
175 " FROM " +
Tables +
", INFORMATION_SCHEMA.ThisUserGrant \n" +
176 " WHERE CONCAT(tables.TABLE_SCHEMA, '.', tables.TABLE_NAME) = \n" +
177 " ThisUserGrant.name \n" +
178 " AND INFORMATION_SCHEMA.ThisUserGrant.object = 1 \n" +
179 " AND INFORMATION_SCHEMA.ThisUserGrant.description IS NOT NULL \n");
181 query.ExecuteQuery(
" CREATE VIEW " +
PrimaryKeys +
" AS " +
182 " SELECT NULL \"TABLE_CATALOG\",\n" +
183 " \"schema\" \"TABLE_SCHEMA\",\n" +
184 " \"table\" \"TABLE_NAME\",\n" +
185 " \"column\" \"COLUMN_NAME\",\n" +
186 " \"SYSTEM.pkey_cols.seq_no\" \"KEY_SEQ\",\n" +
187 " \"name\" \"PK_NAME\"\n" +
188 " FROM " + SystemSchema.PrimaryKeyInfoTableName +
", " + SystemSchema.PrimaryKeyColumnsTableName +
"\n" +
189 " WHERE pkey_info.id = pkey_cols.pk_id\n" +
190 " AND \"schema\" IN\n" +
191 " ( SELECT \"name\" FROM INFORMATION_SCHEMA.ThisUserSchemaInfo )\n");
193 query.ExecuteQuery(
" CREATE VIEW " +
ImportedKeys +
" AS " +
194 " SELECT NULL \"PKTABLE_CATALOG\",\n" +
195 " \"fkey_info.ref_schema\" \"PKTABLE_SCHEMA\",\n" +
196 " \"fkey_info.ref_table\" \"PKTABLE_NAME\",\n" +
197 " \"fkey_cols.pcolumn\" \"PKCOLUMN_NAME\",\n" +
198 " NULL \"FKTABLE_CATALOG\",\n" +
199 " \"fkey_info.schema\" \"FKTABLE_SCHEMA\",\n" +
200 " \"fkey_info.table\" \"FKTABLE_NAME\",\n" +
201 " \"fkey_cols.fcolumn\" \"FKCOLUMN_NAME\",\n" +
202 " \"fkey_cols.seq_no\" \"KEY_SEQ\",\n" +
203 " I_FRULE_CONVERT(\"fkey_info.update_rule\") \"UPDATE_RULE\",\n" +
204 " I_FRULE_CONVERT(\"fkey_info.delete_rule\") \"DELETE_RULE\",\n" +
205 " \"fkey_info.name\" \"FK_NAME\",\n" +
206 " NULL \"PK_NAME\",\n" +
207 " \"fkey_info.deferred\" \"DEFERRABILITY\"\n" +
208 " FROM " + SystemSchema.ForeignKeyInfoTableName +
", " + SystemSchema.ForeignKeyColumnsTableName +
"\n" +
209 " WHERE fkey_info.id = fkey_cols.fk_id\n" +
210 " AND \"fkey_info.schema\" IN\n" +
211 " ( SELECT \"name\" FROM INFORMATION_SCHEMA.ThisUserSchemaInfo )\n");
213 query.ExecuteQuery(
" CREATE VIEW " +
ExportedKeys +
" AS " +
214 " SELECT NULL \"PKTABLE_CAT\",\n" +
215 " \"fkey_info.ref_schema\" \"PKTABLE_SCHEMA\",\n" +
216 " \"fkey_info.ref_table\" \"PKTABLE_NAME\",\n" +
217 " \"fkey_cols.pcolumn\" \"PKCOLUMN_NAME\",\n" +
218 " NULL \"FKTABLE_CATALOG\",\n" +
219 " \"fkey_info.schema\" \"FKTABLE_SCHEMA\",\n" +
220 " \"fkey_info.table\" \"FKTABLE_NAME\",\n" +
221 " \"fkey_cols.fcolumn\" \"FKCOLUMN_NAME\",\n" +
222 " \"fkey_cols.seq_no\" \"KEY_SEQ\",\n" +
223 " I_FRULE_CONVERT(\"fkey_info.update_rule\") \"UPDATE_RULE\",\n" +
224 " I_FRULE_CONVERT(\"fkey_info.delete_rule\") \"DELETE_RULE\",\n" +
225 " \"fkey_info.name\" \"FK_NAME\",\n" +
226 " NULL \"PK_NAME\",\n" +
227 " \"fkey_info.deferred\" \"DEFERRABILITY\"\n" +
228 " FROM " + SystemSchema.ForeignKeyInfoTableName +
", " + SystemSchema.ForeignKeyColumnsTableName +
"\n" +
229 " WHERE fkey_info.id = fkey_cols.fk_id\n" +
230 " AND \"fkey_info.schema\" IN\n" +
231 " ( SELECT \"name\" FROM INFORMATION_SCHEMA.ThisUserSchemaInfo )\n");
234 " SELECT NULL \"PKTABLE_CAT\",\n" +
235 " \"fkey_info.ref_schema\" \"PKTABLE_SCHEMA\",\n" +
236 " \"fkey_info.ref_table\" \"PKTABLE_NAME\",\n" +
237 " \"fkey_cols.pcolumn\" \"PKCOLUMN_NAME\",\n" +
238 " NULL \"FKTABLE_CAT\",\n" +
239 " \"fkey_info.schema\" \"FKTABLE_SCHEMA\",\n" +
240 " \"fkey_info.table\" \"FKTABLE_NAME\",\n" +
241 " \"fkey_cols.fcolumn\" \"FKCOLUMN_NAME\",\n" +
242 " \"fkey_cols.seq_no\" \"KEY_SEQ\",\n" +
243 " I_FRULE_CONVERT(\"fkey_info.update_rule\") \"UPDATE_RULE\",\n" +
244 " I_FRULE_CONVERT(\"fkey_info.delete_rule\") \"DELETE_RULE\",\n" +
245 " \"fkey_info.name\" \"FK_NAME\",\n" +
246 " NULL \"PK_NAME\",\n" +
247 " \"fkey_info.deferred\" \"DEFERRABILITY\"\n" +
248 " FROM " + SystemSchema.ForeignKeyInfoTableName +
", " + SystemSchema.ForeignKeyColumnsTableName +
"\n" +
249 " WHERE fkey_info.id = fkey_cols.fk_id\n" +
250 " AND \"fkey_info.schema\" IN\n" +
251 " ( SELECT \"name\" FROM INFORMATION_SCHEMA.ThisUserSchemaInfo )\n");
DbObjectType
The kind of objects that can be handled by a database system and its managers