| @@ 460-477 (lines=18) @@ | ||
| 457 | * |
|
| 458 | * @return array|bool |
|
| 459 | */ |
|
| 460 | public function showIndex($index = null) |
|
| 461 | { |
|
| 462 | $sql = "SHOW INDEX FROM {$this->table}"; |
|
| 463 | if (isset($index)) { |
|
| 464 | $sql .= " WHERE KEY_NAME = '{$index}'"; |
|
| 465 | } |
|
| 466 | if (!$result = $this->db->queryF($sql)) { |
|
| 467 | xoops_error($this->db->error() . '<br>' . $sql); |
|
| 468 | ||
| 469 | return false; |
|
| 470 | } |
|
| 471 | $ret = []; |
|
| 472 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
| 473 | $ret[] = $myrow; |
|
| 474 | } |
|
| 475 | ||
| 476 | return $ret; |
|
| 477 | } |
|
| 478 | ||
| 479 | /** |
|
| 480 | * Add Index to a table |
|
| @@ 1219-1236 (lines=18) @@ | ||
| 1216 | * |
|
| 1217 | * @return array|bool |
|
| 1218 | */ |
|
| 1219 | public function showFields($field = null) |
|
| 1220 | { |
|
| 1221 | $sql = "SHOW FIELDS FROM {$this->table}"; |
|
| 1222 | if (isset($field)) { |
|
| 1223 | $sql .= " LIKE '{$field}'"; |
|
| 1224 | } |
|
| 1225 | if (!$result = $this->db->queryF($sql)) { |
|
| 1226 | xoops_error($this->db->error() . '<br>' . $sql); |
|
| 1227 | ||
| 1228 | return false; |
|
| 1229 | } |
|
| 1230 | $ret = []; |
|
| 1231 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 1232 | $ret[$myrow['Field']] = $myrow; |
|
| 1233 | } |
|
| 1234 | ||
| 1235 | return $ret; |
|
| 1236 | } |
|
| 1237 | ||
| 1238 | /** |
|
| 1239 | * Add Field in a table |
|
| @@ 1305-1322 (lines=18) @@ | ||
| 1302 | * |
|
| 1303 | * @return array|bool |
|
| 1304 | */ |
|
| 1305 | public function showIndex($index = null) |
|
| 1306 | { |
|
| 1307 | $sql = "SHOW INDEX FROM {$this->table}"; |
|
| 1308 | if (isset($index)) { |
|
| 1309 | $sql .= " WHERE KEY_NAME = '{$index}'"; |
|
| 1310 | } |
|
| 1311 | if (!$result = $this->db->queryF($sql)) { |
|
| 1312 | xoops_error($this->db->error() . '<br>' . $sql); |
|
| 1313 | ||
| 1314 | return false; |
|
| 1315 | } |
|
| 1316 | $ret = []; |
|
| 1317 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 1318 | $ret[] = $myrow; |
|
| 1319 | } |
|
| 1320 | ||
| 1321 | return $ret; |
|
| 1322 | } |
|
| 1323 | ||
| 1324 | /** |
|
| 1325 | * Add Index to a table |
|