I have had issues from the very beginning with storing to the database. I am not sure what causes it since I see no errors. Basically anything that I store or try to add ever shows in the database, nor does it show on my page if the setting is enabled.

If I uncheck database storing then it displays on the page as intended.


nicholas.alipaz’s picture

BTW, there does not seem to be any table for storing these values in my database.

nicholas.alipaz’s picture

on a fresh installation i got this:
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 'DEFAULT NULL' at line 1 query: ALTER TABLE content_type_page ADD `field_test_value` DEFAULT NULL in /home/account/public_html/test/includes/database.mysql-common.inc on line 298.

It happens when I create the field. There is really no reason the error should occur since all I have is:

Computed code:
$node_field[0]['value'] = "testy";

Display Format:
$display = $node_field_item['value'];

nicholas.alipaz’s picture

developers if you want access to this test installation to see the issue please let me know

nicholas.alipaz’s picture

perhaps the issue is that I am on mysqli? It looks like it is trying to use the mysql file.

mbelos’s picture

Version: 6.x-1.x-dev » 5.x-1.2

I'm seeing the same behaviour here in 5.x-1.2. Whenever the 'Store using the database settings below' is selected, I can't see the field in my 'Edit' view. Once it is unchecked, it appears to work, but obviously it does not get stored in the DB.

yngvewb’s picture

I can comfirm this behaviour in 5.x-1.2. "Store using the database settings below" and longtext is checked. In Computed code: $node_field[0]['value'] is used, and in Display Format, $display = $node_field_item['value'];

nicholas.alipaz’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Priority: Normal » Critical

This is a pretty big deal I think, does anyone think they might be able to come up with a patch?

nicholas.alipaz’s picture

I was able to work around this issue by creating a new content type then creating a new field that stores in the database. Not sure why it wasn't working on the current content type. I then pulled the existing field into the current content type and it is working. ODD!

pjsz’s picture

The sql syntax error is because it is missing the data type for the column in the alter table statement. Did you check a data type? Can you reproduce this and on what version? Also be aware that existing nodes will not get their data columns populated when you create the new field. The database column will be populated for newly created nodes.


pjsz’s picture

What behavior can you confirm exactly? I cannot duplicate the sql syntax error on either 5.x-1.2 or 6.x-1.dev.

Thank you.

nicholas.alipaz’s picture

started investigating some more and no it is actually not storing properly as I had thought. There is no table for computed fields. When it stopped giving me an error I assumed it was storing but it wasn't.

Steps to reproduce (drupal 6.9 with Computed field 6.x-1.x-dev):
* Create new content type
* Add a computed field setting it at typical store in db varchar 255
* Create some content using the content type.
* The computed field does not get stored in the db, nor is there even a table for storing

What should the table that computed fields store in be?

pjsz’s picture

It creates a column in your content_type table. If your content type is named page then you will have a table named content_type_page. If your field is named test then there will be a column named field_test_value in that table. It is shown in there. Do you see your table and field? When I do the steps you mention I see the field added to the table.

nicholas.alipaz’s picture

I was able to get them into the db now. It seems that if I choose "longtext" as the type then I get the previous error and nothing goes into the db. However, if I choose varchar then give it an outrageous number like 999999999 then it gets into the db as longtext... weird eh? So this is what I have done and it seems to be working. Strange bug though.

Thanks for your assistance and attention. Wouldn't have figured it out without you.

pjsz’s picture

Did you say you have a test server I can test this on? I cannot replicate it. When i pick longtext it works fine.

nicholas.alipaz’s picture

I can set up a test page for you. Please give me a few days to find some time to do it. I will do it, likely monday or tuesday.

Aren Cambre’s picture

Title: Can't add to database » Longtext field is broken

I'm getting errors, too. Longtext is totally broken, but finite-length varchar or text fields work.

Making issue title more direct.

Moonshine’s picture

Status: Active » Fixed

It looks like this stems from a D5 CCK -> D6 CCK change, where D6 CCK now uses the Schema API to define fields for the database. I just committed a fix in the Drupal 6 branch, so you should see it in the 6.x-1.x-dev tarball here once the server refreshes it. Works fine with a quick test here. Re-open if there is a problem with the new dev tarball.

Aren Cambre’s picture

Thanks, Moonshine!

Status: Fixed » Closed (fixed)

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