How do you create a BLOB column in rails postgresql database -


I am trying to store binary data in database (PostGrassClose on Heroco)

I I understand that there are two different ways to store binary data in postgres. A blob and a byte ..

When I create a table in my migration,

  create_table: binaries do | T | T. Binary: Data termination   

This creates a column in the data type database.

My question is ... How can I create a record of Blob?

Why should I ask? It seems that when I send a ten byte file to my box, it keeps it as a string of hex values, which is prepared with "e". So my 10 bytes are 21. My 10 meg file is 20 mega (and one byte), ext, ext, ext ...
Now what bothers me, but as I really do not care about performance (I Beaten), which does not bother me the most.
which really bothers me; When I read the contents of the database, I get 21 bytes, not 10. This is unrecognizable.

Then my question is again .. How do I create a Blob column in Rail / PostGraskcl / Harokee environment?

Bitia is a blog postgresql version from:

The SQL standard defines a different binary string type, which is called BLOB or BINARY LARGE OBJECT . The input format is different from bytea , but the provided functions and operators are mostly identical.

Then bytea is what you want. As far as the format goes:

Bitia supports two external formats for input and output: the historical "escape" format of PostgreSQL, and "Hex" format. Both of these are always accepted on input, the output format depends on the configuration parameter bytea_output; The default is hex (note that hex format was introduced in postgresqual 9.0; earlier versions and some tools do not understand it.)

So what you see is only text The version that is used for it is to obtain data from the database and database.

It may also be of interest:



Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -