Forum OpenACS Development: Blob question

Collapse
Posted by Gilbert Wong on

I'm about half way through the simple survey data model and I just encountered a blob in one of the tables.

create table survsimp_question_responses (
    response_id          ...,
      .
      .
      .
    attachment_answer    blob,
      .
);

I read through Dan's content repository documentation and I didn't see any mention on how to handle blobs when the old data model didn't already use the content repository. Do I just make attachment_answer reference cr_items and modify the query to use the content repository?

This content repository stuff is confusing. :)

Thanks!

Collapse
2: Response to Blob question (response to 1)
Posted by Don Baccus on
We've discussed putting things into the CR for both Oracle and PG, in order to hide stuff like this.  There are some concerns about scalability, but there are also advantages, like hiding the differences between PG, Oracle and other RDBMS's in one place, providing the option of storing stuff in the file system rather than db, automatic searching via the site-wide search mechanism, etc.

I'm sure Dan would be more than glad to help you out with questions, he's already done this for the APM.

Collapse
3: Response to Blob question (response to 1)
Posted by Dan Wickstrom on
Don's right.  The apm was converted to use the CR for storing tarballs, and it would be a good example to follow for handling the conversion of the simple-survey data-model.  The apm_package_versions table is the place to start.

If you have any problems with it, just let me know, and I'll be glad to help out.

Collapse
4: Response to Blob question (response to 1)
Posted by Gilbert Wong on
Thanks guys. I'll take a look at the APM.
Collapse
5: Response to Blob question (response to 1)
Posted by Gilbert Wong on

I finally got a chance to get back to porting. I took a look at the apm_package_versions table. The lines that reference the cr_items table have been commented out.

   -- This constraint can't be added yet, as the cr_items table
   -- has not been created yet.
                      -- constraint apm_package_ver_item_id_fk
                      -- references cr_items(item_id),

Dan, it looks like the cr_items table was ported but this constraint might not have been uncommented. Also, the Oracle sql doesn't have the constraint listed. Both the Postgresql and Oracle code have been modified to use the cr_items table. Should I do the same for the simple_survey table? Thanks.

Don, I might be able to finish this package this weekend. I'll let you know on Monday. Now where did I put those Oracle CDs? :)

Collapse
6: Response to Blob question (response to 1)
Posted by Gilbert Wong on
Since I will be using the content repository to store blobs in PostgreSQL and since the Simple Survey package currently does not use the content repository, should I modify the Oracle queries to utilize the content repository to store the blobs?  It seems like I would have to make both Oracle and PostgreSQL queries the same.  Am I correct?  Thanks.
Collapse
7: Response to Blob question (response to 1)
Posted by Don Baccus on
Yes, that's our thinking.