简体   繁体   English

如何使用API​​在Moodle中获取所有数据库表名称

[英]How can I get all database table names in Moodle using API

I need list of the database tables used by Moodle. 我需要Moodle使用的数据库表的列表。

How can I get it ? 我怎么才能得到它 ? Is there any API for that either in Java or PHP ? 是否有Java或PHP的API?

I checked - APIs like - Data definition API, Data Manipulation API , Web Services but I could not find what I require. 我检查了-诸如数据定义API,数据操作API,Web服务之类的API,但找不到所需的东西。

These API help getting data from Moodle, but I need MetaData. 这些API帮助从Moodle获取数据,但是我需要MetaData。

Please help. 请帮忙。 Thanks in Advance. 提前致谢。

You can use this in Moodle 你可以在Moodle中使用它

$tables = $DB->get_tables();

also

foreach ($tables as $table) {
    $columns = $DB->get_columns();
    foreach ($columns as $column) {
        ...
    }
}

Or use the information_schema 或使用information_schema

SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'yourmoodledatabasename'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM