Ich Suche nach einer Möglichkeit (SQL-Statement), die Felder-Namen einer Tabelle x auszulesen, welche mit FULLTEXT markiert sind?
Mögliche Antworten auch mit Hilfe von PHP.
Mögliche Antworten auch mit Hilfe von PHP.
<?php
function searchDB($table) {
header("Content-Type: text/plain");
mysql_connect("test", "test", "test");
$query = "SHOW INDEX FROM ".$table;
include($cfgpath."scripts/dbExecuteQuery.php");
$test = mysql_fetch_array($result);
print_r($test);
// ...
}
?>
Array ( [0] => testTable [Table] => testTable [1] => 0 [Non_unique] => 0 [2] => PRIMARY [Key_name] => PRIMARY [3] => 1 [Seq_in_index] => 1 [4] => ID [Column_name] => ID [5] => A [Collation] => A [6] => 8 [Cardinality] => 8 [7] => [Sub_part] => [8] => [Packed] => [9] => [Null] => [10] => BTREE [Index_type] => BTREE [11] => [Comment] => )
CREATE TABLE testTable ( ID INT UNSIGNED NOT NULL AUTO_INCREMENT, active TINYINT(1) UNSIGNED NOT NULL, complete bigint(20) unsigned DEFAULT '0' NOT NULL, branch VARCHAR(32), name VARCHAR(50), shortDescription VARCHAR(100), Address VARCHAR(200), Phone VARCHAR(13), EMail VARCHAR(50), Url VARCHAR(200), description TEXT, createDate bigint(20) unsigned DEFAULT '0' NOT NULL, modifyDate bigint(20) unsigned DEFAULT '0' NOT NULL, activationCode VARCHAR(32), PRIMARY KEY (ID), FULLTEXT KEY `name` (`name`), FULLTEXT KEY `shortDescription` (`shortDescription`), FULLTEXT KEY `description` (`description`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1
<?php
$indexArray = array();
while($row = mysql_fetch_array($result)) {
array_push($indexArray, $row);
}
foreach($indexArray as $thisIndex) {
print($thisIndex["Index_type"]);
print("\n");
}
?>
Kommentar