I'm writing a new computed field type that doesn't require any database storage.

For single values I can stop a field being added to the content_type_ table by returning an empty array for 'database columns' in _field_settings.

If I change the field to use multiple values, I get the error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') SELECT vid, nid, 0, FROM content_type_host' at line 1 query: INSERT INTO content_field_filesysem (vid, nid, delta, ) SELECT vid, nid, 0, FROM content_type_host in /home/croomes/workspace/cmdb/sites/all/modules/cck/content_admin.inc on line 1128.

The content_field_filesysem is being created in content_alter_db when I'd prefer it not to, and subsequent calls to populate it fail as it expects at least one column.

From what I understand from comments in the code, being able to override the default storage is intended. Is this true, and if so, has anyone got it working? I'm happy to work on a patch to allow this but was hoping for some guidance before I start.

Firstly, am I just being stupid?

If not, I could patch content_alter_db to only create tables if there are columns other than vid, nid & delta. I'm worried that fixes will be needed in other places with this approach.

Alternatively, should something like CONTENT_DB_STORAGE_NONE be allowed which would effictively ignore most database code?

Any suggestions or pointers would be very welcome. Thanks to the developers for the great work on CCK - it is extremely powerful!

Simon

Comments

Anonymous’s picture

I've got it working, but only by duplicating the data from my tables in the cck tables.

When the data in the external tables is updated I clear any affected nodes from cache_content. Then in hook_field (load) I load the data from my external table and run content_write_record to update the cck tables.

It seems to work quite well but I'd still like to hear if someone has other suggestions.

Cheers,
Simon