function drupal_schema_fields_sql
drupal_schema_fields_sql($table, $prefix = NULL)
Retrieves a list of fields from a table schema.
The returned list is suitable for use in an SQL query.
Parameters
$table: The name of the table from which to retrieve fields.
An optional prefix to to all fields.:
Return value
An array of fields.
Related topics
File
- includes/common.inc, line 7222
- Common functions that many Drupal modules will need to reference.
Code
function drupal_schema_fields_sql($table, $prefix = NULL) { $schema = drupal_get_schema($table); $fields = array_keys($schema['fields']); if ($prefix) { $columns = array(); foreach ($fields as $field) { $columns[] = "$prefix.$field"; } return $columns; } else { return $fields; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_schema_fields_sql/7.x