public function DataHandler::load in Data 7
Same name and namespace in other branches
- 8 includes/DataHandler.inc \DataHandler::load()
- 6 includes/DataHandler.inc \DataHandler::load()
Load a record.
1 call to DataHandler::load()
- DataHandler::save in includes/
DataHandler.inc - Save one or more records to the table.
File
- includes/
DataHandler.inc, line 47 - Definition of DataHandler class.
Class
- DataHandler
- Simple access methods to table data. Can be used on any table, not just Data managed tables.
Code
public function load($keys) {
$schema = drupal_get_schema($this->table);
$fields = $schema['fields'];
$query = db_select(db_escape_table($this->table))
->fields(db_escape_table($this->table));
foreach ($keys as $key => $value) {
if (!isset($fields[$key]['type'])) {
return FALSE;
}
$query
->condition($key, $value, is_array($value) ? 'IN' : '=');
}
if ($query
->getArguments()) {
$results = $query
->execute()
->fetchAll(PDO::FETCH_ASSOC);
return empty($results) ? FALSE : $results;
}
return FALSE;
}