我需要用户在 cakephp 中显示表查询,我尝试过手动编写SHOW table status FROM DATABASE like 'table_name'
,但我担心的是,当我住在这个站点时,我的数据库名称会相应更改,我不想手动更改它。
我也尝试了下面的代码,但我找不到我的表格详细信息。
$db =& ConnectionManager::getDataSource('default');
$modelname = "service_requests";
$query = $db->describe($modelname);
我希望我的查询会返回如下所示的内容。
[TABLES] => Array
(
[Name] => service_requests
[Engine] => MyISAM
[Version] => 10
[Row_format] => Dynamic
[Rows] => 201
[Avg_row_length] => 478
[Data_length] => 96536
[Max_data_length] => 281474976710655
[Index_length] => 4096
[Data_free] => 400
[Auto_increment] => 202
[Create_time] => 2012-12-13 17:10:16
[Update_time] => 2012-12-18 10:27:34
[Check_time] =>
[Collation] => utf8_general_ci
[Checksum] =>
[Create_options] =>
[Comment] =>
)
非常感谢你。