public static List<SObject> selectStar(String sobjectName) {
Set<String> fieldNames = schema.describeSObjects(new String[] {sobjectName})[0].fields.getMap().keyset();
List<String> iterableFields = new List<String>(fieldNames);
//or
Map<String, Schema.SObjectField> fieldMap = SObjectType.sobjectName.fields.getMap();
List<String> iterableFields = new List<String>(fieldMap.keyset());
return Database.query(String.format('SELECT {0} FROM {1}', new String[] {String.join(iterableFields, ','), sobjectName}));
}
参考
https://developer.salesforce.com/forums/?id=906F00000008os8IAA