[Building Sakai] Reading Contents of Content_Resource Binary_Entity Column

Matthew Jones jonespm at umich.edu
Tue Feb 2 11:15:36 PST 2010


This field is actually a specially encoded binary, and you'll need to read
this with code. The code that parses this out, I believe, is the
EntityReader (readSqlResultRecord) You might get some ideas from the
functions that allowed this column to be copied to a file as part of a
database->filesystem conversion.

The full details of the format are on described on the entity encoding page
on confluence [1] if you wanted to try to reproduce it in some other
language.

convertToFile() and putResourceBodyFilesystem() are the specific functions
that do db->file.

They are in this file in the kernel:
https://source.sakaiproject.org/svn/kernel/trunk/kernel-impl/src/main/java/org/sakaiproject/content/impl/DbContentService.java

This query in oracle *kind of* will show you the data in this in text
format. Many things have identifiers or block lengths so are unprintable. I
don't know the mysql equivalent.
select utl_raw.cast_to_varchar2(hextoraw(dbms_lob.substr(binary_entity)))
from content_collection;

[1]
http://confluence.sakaiproject.org/display/~ianeboston/Entity+Type1+Block+Encoding

On Mon, Feb 1, 2010 at 2:13 PM, Matt Hoyt <mrhoyt4 at yahoo.com> wrote:

> How do you read the contents of the Binary_Entity Column of
> Content_Resource table?
>
> --
> Matt Hoyt
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100202/9f41ddeb/attachment.html 


More information about the sakai-dev mailing list