Skip to content
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

added getCollectionSize method for mysql mariadb postgres and mongodb… #1

Merged
merged 4 commits into from
May 22, 2023

Conversation

faisalill
Copy link
Owner

No description provided.

@faisalill
Copy link
Owner Author

It works for MySQL, MariaDB and Postgres (I tested it). I don't know about mongodb becuase I tried to use the UTOPIA\MONGO\CLIENT and it is just crashing the server. So I used the MongoDB\Client and made a function to get the size in bytes and it worked so I have implemented a similar thing for the utopia mongo client class.

throw new Exception("Invalid table name");
}

return (int) $size;
Copy link

@fogelito fogelito May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need the casting? need to be tasted with big numbers..

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it to a string.

$name = $this->filter($name);

$query = $this->getPDO()->prepare("
SELECT pg_size_pretty(pg_total_relation_size(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please double-check with pg_size_pretty() as we want data in bytes?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed getCollectionSize for Postgres as it works but is giving erros in the tests.

@faisalill
Copy link
Owner Author

Thanks for the review. I will work on it

faisalill pushed a commit that referenced this pull request May 22, 2023
@faisalill faisalill merged commit 962db9b into main May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants