我可以创建一个填充有 Salesforce 对象的 sql table 吗?

Can i create a sql table populated with Salesforce objects?

Salesforce 是否提供一种方法来获取所有对象(如客户、联系人等)并使用某些列(如 对象实体、字段名称、字段类型?

我很确定实现此目的的唯一方法是使用 Schema.sObjectTypeSchema.sObjectFieldHere is a link to the documentation for getting all sObjects. You will basically call the Schema.getGlobalDescribe() method which will return you a map of sObjectTypes with their sObject name as the key. Then you'll need to call getDesribe() on each sObjectType get the fields of the object from that Describe result. You'll again need to call getDescribe() on each sObjectField in order to have access to the columns you wanted (eg. FieldType). Here is the documentation on that 您可以将每个 DescribeFieldResult 保存到一个列表中,该列表以 sObject 名称作为键进入 > 的 Map,然后您可以对它们做任何您想做的事...将它们放在 table 如果你喜欢。请记住,就 CPU 时间而言,这一切都将非常昂贵。您甚至可以 运行 进入某些调控器限制。 这是一个小示例,您可以 运行 在开发人员控制台中使用 Execute Anonymous,其中 sObject 名称及其所有字段名称和类型都打印到调试日志中

Map<String, sObjectType> objects = Schema.getGlobalDescribe();
for(String objName : objects.keySet()){
    system.debug('=======' + objName + '=========\n Fields: ');
    sObjectType o = objects.get(objName);
    DescribeSobjectResult oDRes = o.getDescribe();
    Map<String, Schema.SObjectField> fields = dResult.fields.getMap();
    for(Schema.SObjectField f : fields.values()){
        DescribeFieldResult fDRes = f.getDescribe();
        system.debug('name: ' + fDRes.getName() + ' | type: ' + fDRes.getType());
    }
}

希望对您有所帮助