Skip to content

Unclear how to implement SHOW TABLES query #21

@wpebley

Description

@wpebley

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions