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

Unclear how to implement SHOW TABLES query #21

Open
wpebley opened this issue Sep 9, 2023 · 1 comment
Open

Unclear how to implement SHOW TABLES query #21

wpebley opened this issue Sep 9, 2023 · 1 comment
Assignees

Comments

@wpebley
Copy link

wpebley commented Sep 9, 2023

Hi!

Love your PDO Wrapper! I am successfully using it in a large project
and it has significantly cut down on my code size.

I hope you'll pardon my ignorance here, but it is unclear to me how I go
about reading in and storing the results of TABLE SHOW using the
wrapper. In regular PDO code, I am using the following...

//Execute the SHOW TABLE query
 try {
     $conn = new PDO(...);
     $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $stmt = $conn->prepare("SHOW TABLES");
     $stmt->execute();
 }
 catch(PDOException $e){
     echo "Error: " . $e->getMessage();
 }

 //Build array from the resulting SQL file rows

 $table= [];

 $row = 0;
 while ($r = $stmt->fetch(PDO::FETCH_NUM)) {
     $table[$row] = $r[0];
     $row = $row + 1;
 }       

This is the last piece that will allow me to have converted the entire
project to your wrapper. Any guidance will be appreciated.

Thx,

Bill

@dcblogdev dcblogdev self-assigned this Sep 9, 2023
@wpebley
Copy link
Author

wpebley commented Nov 19, 2024

Hi dcblogdev!
While revisiting my code, I just came back around to this issue. Any thoughts on how to implement SHOW TABLES in your wrapper?

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

No branches or pull requests

2 participants