-
-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement compileTables missing method #868
Conversation
A new method 'compileTables' has been added to OracleGrammar.php. This addition allows the query to be compiled to determine the tables for a database. Accompanying tests for this feature were also added in Oci8SchemaGrammarTest.php.
Thank you for the PR, the initial review looks good with a test. I will review this further as soon as I can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running on local, Schema::getTables()
returns duplicates and other fields are null.
[
"name" => "JOBS",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "JOBS",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "JOB_BATCHES",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "JOB_BATCHES",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "JOB_BATCHES",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "JOB_BATCHES",
"schema" => null,
"size" => null,
"comment" => null,
"collation" => null,
"engine" => null,
],
Using SQLite:
[
"name" => "job_batches",
"schema" => null,
"size" => 8192,
"comment" => null,
"collation" => null,
"engine" => null,
],
[
"name" => "jobs",
"schema" => null,
"size" => 16384,
"comment" => null,
"collation" => null,
"engine" => null,
],
Maybe MySQL would return more values, I suggest we try to match it. Thanks! |
The OracleGrammar.php and associated test file have been updated. These modifications provide additional information, such as the schema, size, comments, and collation when compiling table data. Now, the user will have a more detailed view of their database tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I've updated the query to remove duplicates and add the missing information.
the new query
SELECT ALL_TAB_COMMENTS.TABLE_NAME AS "NAME",
ALL_TABLES.OWNER AS "SCHEMA",
COALESCE(ROUND(SUM(USER_SEGMENTS.BYTES) / 1024 / 1024, 2), 0) AS "SIZE",
ALL_TAB_COMMENTS.COMMENTS AS "COMMENTS",
(SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER = 'NLS_SORT') AS "COLLATION"
FROM ALL_TABLES
JOIN ALL_TAB_COMMENTS ON ALL_TAB_COMMENTS.TABLE_NAME = ALL_TABLES.TABLE_NAME
LEFT JOIN USER_SEGMENTS ON USER_SEGMENTS.SEGMENT_NAME = ALL_TABLES.TABLE_NAME
WHERE ALL_TABLES.OWNER = '{OWNER}'
AND ALL_TAB_COMMENTS.OWNER = '{OWNER}'
AND ALL_TAB_COMMENTS.TABLE_TYPE IN ('TABLE')
GROUP BY ALL_TAB_COMMENTS.TABLE_NAME, ALL_TABLES.OWNER, ALL_TABLES.NUM_ROWS, ALL_TABLES.AVG_ROW_LEN, ALL_TABLES.BLOCKS,
ALL_TAB_COMMENTS.COMMENTS
order by all_tab_comments.table_name;
Thanks for the updates, will review this again as soon as I can. |
Co-authored-by: Arjay Angeles <aqangeles@gmail.com>
Lowercased table names, schema, and collation parameters to ensure consistency. Also simplified the size calculation by removing the rounding and conversion to megabytes.
Release on https://github.com/yajra/laravel-oci8/releases/tag/v11.5.0 🚀 Thanks! |
Hi,
This pr is for implemente the missing method compileTables from laravel
i write the following query for get all table from database