Saving and retrieving blobs using Propel ORM
I a开发者_Python百科m using Propel (1.4) with Symfony 1.31 (with mySQL db). I want to save save/retriev BLOB (gzipped) data to/from the database
My db schema is defined in YML.
Suppose the schema looks like this:
demo_blobbed_object:
_attributes: { phpName: MrBlobby }
id:
name: {type: varchar(32)}
data: {type: ? }
I have the following questions
- What is the type: value for a BLOB field type in YML?
- Can I use the normal getter setter methods to get/set the blob data from a MrBlobby object?
The propel documentation says here that the _toString() method needs to be called, but it is not clear if this still applies to Propel 1.4
It should be BLOB
or CLOB
depending on what is appropriate for your usage. In your case i would think BLOB
...
http://propel.phpdb.org/trac/wiki/Users/Documentation/1.4/Schema-Reference
As far as setting/getting im not sure as ive never stored an image/gz/etc. in a db when using Propel before so ive never had to use it. However this may answer your questions:
http://propel.phpdb.org/trac/wiki/Users/Documentation/1.4/LOB-Columns
精彩评论