gpt4 book ai didi

php - 使用 Propel ORM 保存和检索 blob

转载 作者:行者123 更新时间:2023-11-30 23:42:12 32 4
gpt4 key购买 nike

我将 Propel (1.4) 与 Symfony 1.31(带有 mySQL 数据库)一起使用。我想将保存/检索 BLOB(gzip 压缩)数据保存到数据库中/从数据库中保存

我的数据库模式是在 YML 中定义的。

假设架构如下所示:

demo_blobbed_object:
_attributes: { phpName: MrBlobby }
id:
name: {type: varchar(32)}
data: {type: ? }

我有以下问题

  1. 什么是类型:YML 中 BLOB 字段类型的值?
  2. 我可以使用普通的 getter setter 方法从 MrBlobby 对象获取/设置 blob 数据吗?

推进文档说 here需要调用 _toString() 方法,但不清楚这是否仍然适用于 Propel 1.4

最佳答案

它应该是 BLOBCLOB,具体取决于您的使用情况。在你的情况下,我会认为 BLOB...

http://propel.phpdb.org/trac/wiki/Users/Documentation/1.4/Schema-Reference

至于设置/获取我不确定,因为我从未存储过图像/gz/等。在之前使用 Propel 时在数据库中,所以我从来没有使用过它。然而,这可能会回答您的问题:

http://propel.phpdb.org/trac/wiki/Users/Documentation/1.4/LOB-Columns

关于php - 使用 Propel ORM 保存和检索 blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2142667/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com