|
40 | 40 | Database::find($label)->disable_fatal_errors();
|
41 | 41 | $query = Database::find($label)->query($sample);
|
42 | 42 | Database::find($label)->enable_fatal_errors();
|
43 |
| - |
44 |
| - while ($row = $query->fetch_assoc()) { |
45 |
| - $row['possible_keys'] = str_replace(',', ', ', $row['possible_keys']); |
46 |
| - $row['ref'] = str_replace(',', ', ', $row['ref']); |
47 |
| - $row['Extra'] = str_replace(array('Using ', ';'), array('', ', '), $row['Extra']); |
48 |
| - foreach ($row as $key => $val) { |
49 |
| - if (is_null($row[$key])) |
50 |
| - $row[$key] = ''; |
51 |
| - $row[$key] = htmlentities($row[$key]); |
52 |
| - } |
53 |
| - |
54 |
| - $return['Explain'][] = $row; |
55 |
| - } |
| 43 | + |
| 44 | + if (is_null($query)) { |
| 45 | + $return['Warnings'][] = array('Code' => Database::find($label)->_errno(), 'Level' => 'Error', 'Message' => Database::find($label)->_errstr()); |
| 46 | + } |
| 47 | + else { |
| 48 | + while ($row = $query->fetch_assoc()) { |
| 49 | + $row['possible_keys'] = str_replace(',', ', ', $row['possible_keys']); |
| 50 | + $row['ref'] = str_replace(',', ', ', $row['ref']); |
| 51 | + $row['Extra'] = str_replace(array('Using ', ';'), array('', ', '), $row['Extra']); |
| 52 | + foreach ($row as $key => $val) { |
| 53 | + if (is_null($row[$key])) |
| 54 | + $row[$key] = ''; |
| 55 | + $row[$key] = htmlentities($row[$key]); |
| 56 | + } |
| 57 | + |
| 58 | + $return['Explain'][] = $row; |
| 59 | + } |
| 60 | + } |
56 | 61 | $query = Database::find($label)->query('SHOW WARNINGS');
|
57 | 62 | while ($row = $query->fetch_assoc()) {
|
58 | 63 | if ($row['Code'] == 1003)
|
|
0 commit comments