RedBeanPHP
The Power ORM

LOBs

LOBs are large objects. The term refers to special database column types and functions for dealing with large chunks of unstructured data, like photos.

No Support

RedBeanPHP does not offer support for LOBS.
However it's possible to leverage LOB functions of your database through the PDO object which can be accessed like this:

    R::getDatabaseAdapter()->getDatabase()->getPDO();

Advantages/Disadvantages LOBs

Storing files as LOBs in the database has some advantages. The most important advantage of using LOBs this way is to have data integrity and transactions for files.

Using LOBs comes at a price though. You're databases will become quite large which makes it hard to backup them or move them around. Another possible drawback is that your files cannot be served from a cache layer, due to the fact they are tucked away in the database. Some people might argue you're using the wrong tool for the job: a file system is for files, a database is for records. I am not sure how important this philosophical consideration is in practice though.

Alternatives

There are alternatives to using LOBs. One solution is to store the path to the file in the database and the actual file on disk. If you're worried about data integrity you can also rename the file to a hash and store the hash in the database.


back to main menu

Donate to RedBeanPHP using Monero:
47mmY3AVbRu 7zVVd4bxQnzD
2jR7PQtBJ cF93jWHQ
rP7yRED4qr fqu6G9Q8ZNu7
zqwnB28rz76 w7MaExf
mALVg69yFd 9sUmz
(remove spaces and new lines)

Performance monitor: this page has been generated in 0.026862859725952s. Is the performance lacking? Please drop me an e-mail to notify me!

Partners  
Uurboek.nl PapelDigital

 

RedBeanPHP Easy ORM for PHP © 2024 () and the RedBeanPHP community () - Licensed New BSD/GPLv2 - RedBeanPHP Archives
RedBeanPHP, the power ORM for PHP since 2009.

Privacy Statement