苹果ios购买收据数据的可能最大长度是多少?

发布于 2024-10-26 20:03:08 字数 78 浏览 1 评论 0原文

在开始测试 iOS 自动续订购买之前,我需要准备我的服务器数据库。我的问题很简单。我只是想知道数据库中 varchar 字段的大小应该是多少。

Before beginning to test the iOS autorenewing purchases I need to prepare my server database. My question is simple. I just wanna know what size I should make the varchar field in my database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

绮筵 2024-11-02 20:03:08

我使用 varchar (4096) 来存储我的 Base64 编码收据。

但说实话,我在官方文档(或其他任何地方)上找不到有关收据长度的任何内容。我唯一找到的Apple 文档 指出收据内容/格式可能会发生变化:

商店收据的内容和格式是私人的,可能会发生变化。您的应用程序不应尝试直接解析收据数据。使用此处描述的机制来验证收据并检索其中存储的信息。

因此,使用文本而不是 varchar 可能确实是最好的选择。

I was using a varchar (4096) to store my base64 encoded receipts.

But to be honest, I couldn't find anything regarding receipt length on the official documentation (or anywhere else). The only thing I did find on Apple's docs was that the receipt content/format is subject to change:

The contents and format of the store receipt is private and subject to change. Your application should not attempt to parse the receipt data directly. Use the mechanism described here to validate the receipt and retrieve the information stored inside it.

So probably going for text instead of varchar really is the best option.

素染倾城色 2024-11-02 20:03:08

由于包含较旧的订阅信息,receipt-data 可能会变得更大。

实际上,典型大小可能低于 10KB。但由于重复创建新订阅,我在自动化测试中看到了超过 500KB 的收据数据。

最好使用 varchar(max) 或不受限制的文本。

receipt-data could grow to be much larger due to it containing older subscription information.

In practice, typical size is probably under 10KB. But I've seen receipt-data as large as over 500KB in automated testing, due to repeatedly creating new subscriptions.

It's better to use varchar(max) or text where it's not bounded.

人│生佛魔见 2024-11-02 20:03:08

在 MySQL 中,使用容量为 16 MB 的 MEDIUMTEXT 是安全的。

我们使用的是 TEXT,但有一次不太适合。

TEXT 的容量只有 64kb,但经过重复交易后,收据大小很可能会超过此大小。我只是在沙盒模式下进行多次交易后才观察到这一点。

TINYTEXT:255 个字符 - 255 B

文本 65,535 字节 - 64kb

中文本:16,777,215 - 16 MB

GBTEXT:65,535 个字符 - 64 MB

KBLONGTEXT:4,294,967,295 个字符 - 4 GB

In MySQL, it's safe to use MEDIUMTEXT which has capacity 16 MB.

We were using TEXT but didn't fit well at one point.

TEXT has only 64kb capacity but it's more likely that receipt size will be morethan this after repeated transactions. I only observed this after many transaction in sandbox mode.

TINYTEXT: 255 characters - 255 B

TEXT 65,535 bytes - 64kb

MEDIUMTEXT: 16,777,215 - 16 MB

GBTEXT: 65,535 characters - 64 MB

KBLONGTEXT: 4,294,967,295 characters - 4 GB

并安 2024-11-02 20:03:08

经过一些简单的数学计算后,我发现使用 MEDIUMTEXT 是安全的,因为每个收据大小以约 2KB/交易的倍数增长,因此您需要超过 800 个交易才能最大化大小。
因此,考虑到 10 年的非常安全的使用期限,每月需要超过 80 笔交易,或者每月大约 7-8 笔交易,这对于大多数用例来说并非如此。

After doing some simple math I figured out it was safe to use MEDIUMTEXT as each receipt size grows by the factor of ~2KB/transaction and so you would need more than 800 transactions to max out the size.
Thus, considering a very safe use span of 10 years it'd require more than 80 transactions a month or roughly 7-8 transactions every month which won't be the case for most use-cases.

寒冷纷飞旳雪 2024-11-02 20:03:08

可以使用jsonb来存储base64。它可以容纳长达 1MB 的数据。

May be use jsonb to store the base64. It can hold as long as 1MB.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文