how can i define the database {table},which for the field storage?

In the "field example", the data storage in the {rgb table}, but which function determine the goal {table} of "field_example_rgb"?

i see the code hook_field_schema only determine the structure of database's table,nothing shows its bind to "field_example_rgb",only the key word "rgb".

Comments

rfay’s picture

Status: Active » Fixed

The field API handles its own table creation (which may be different based on the storage back-end selected). You don't get involved in the choice of the name (and shouldn't query it directly or generally even know what it is). Remember that it might have a completely different backend somewhere. Use the field api instead.

mile23’s picture

Like rfay says, you only give Drupal the schema in hook_field_schema(). That's your declaration that this is the schema for your field.

To do queries against it, you use EntityFieldQuery. We have an issue to create an example of that, with some useful code: #916776: Add an EntityFieldQuery example

Also documentation: http://api.drupal.org/api/drupal/includes%21entity.inc/class/EntityField...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.