ColdFusion:有人使用 WDDX 吗?
我正在一个 ColdFusion 站点上工作,其中数据存储在数据库内的 WDDX 数据包中,这确实很痛苦。 (我不知道为什么这些值不只是存储在另一个表中。)
我以前没有使用过 WDDX,而且我能找到的关于它的唯一文档似乎很旧。 所以我很好奇是否还有人使用 WDDX,如果是的话,用途是什么?
I'm working on a ColdFusion site where data is stored in WDDX packets inside a database and it's a real pain. (I have no idea why the values aren't just stored in another table.)
I've not used WDDX before and the only documentation I can find about it seems quite old. So I'm curious if anyone still uses WDDX, and if so, what for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我使用 WDDX 在不需要数据库的小型应用程序中存储配置值。 我可以使用 ini 文件和
GetProfileString()
,但 WDDX 更方便。它是 XML,因此理论上您可以使用它来执行 AJAX(原始意义上的)。 特别是因为直到 CF8 才原生支持 JSON。
您还可以将其用作 XSL 转换的输入,因此您不必编写自己的 XML 来表示 CF 数据类型(如结构或查询)。
最后但并非最不重要的一点是,您可以将其用作在数据库中存储不同结构化数据的可扩展方式(例如,涵盖不同情况的日志消息)。 我不确定为什么这对您来说是一个痛苦,但也许这更多是一个架构问题而不是 WDDX 问题(?)。
归结为:拥有快速、简单、可移植且安全(无需 Evaluate() 或自定义管道)的序列化和反序列化(即“存储”或“持久化”)任何 CF 数据类型。
I use WDDX for storing configuration values in a small app that requires no database. I could use an ini file and
GetProfileString()
, but WDDX is a lot more convenient.It is XML, so in theory you could use it to do AJAX (in the original sense). Especially because there was no native support for JSON until CF8.
You could also use it as a input for XSL transformations, so you don't have to make up your own XML to represent CF data types like structs or queries.
Last but not least you can use it as an extensible way of storing varying structured data in a database (log messages that cover different cases, for example). I'm not sure why this is a pain in your case, but maybe it's more of an architectural problem than a WDDX problem (?).
It boils down to this: It is handy to have quick and simple, yet portable and safe (no
Evaluate()
or custom plumbing required) way of serializing and de-serializing (i.e. "storing" or "persisting") any CF data type.我们这样做,用于 CMS 中的页面块配置数据。 这个决定可以追溯到 CF5,我现在可能会使用更简单的 XML 格式(存储的数据只是标量值的序列化哈希),但这是一种避免每次需要的数据的额外多行查询开销的便捷方法父记录被访问。
我想文档并没有太大变化,因为关于简单的数据序列化操作你只能写这么多:)
We do, for page chunk configuration data in our CMS. The decision dates back to CF5, and I might use a simpler XML format now (the data stored is just a serialized hash of scalar values) but it's a handy way to avoid the overhead of extra multi-row queries for data that's needed every time the parent record is accessed.
I guess the documentation hasn't changed much as there's only so much you can write about a simple data serialization operation :)
自从 CF8 推出以来,我就使用 JSON 而不是 WDDX。
两者都非常适合序列化一些不需要查询的数据字段,同时保持数据库不变。 我随时都会选择 JSON 而不是 WDDX。 :)
Ever since CF8 is out, I've used JSON instead of WDDX.
Both are great for serializing some data fields that don't need to be query against, while keeping the DB unchanged. I'll take JSON over WDDX any day. :)
我出于多种原因使用过它。 其中之一是允许两个不同的 ColdFusion 服务器之间使用类似 Web 服务的功能。 由于它只是 XML 的一种风格,因此是纯文本,因此它不需要比使用 CFHTTP 的简单 HTTP 调用更复杂的东西。 而且,由于它是 WDDX,因此它很容易转换回 CF 结构。
在 CF5 时代,这非常重要。 即使现在,当 CF 提供了一些非常强大的 XML 解析工具时,原生数据结构仍然更容易使用。
I've used it for a variety of reasons. One such was to allow a webservice-like functionality between two disparate ColdFusion servers. Since it's just a flavor of XML and, thus, plain text, it required nothing more complicated than a simple HTTP call using CFHTTP. And, since it's WDDX, it translated very easily back into CF structures.
Back in the CF5 days this was really important. Even now, when CF offers some pretty powerful tools for XML parsing, the native data structures are still easier to work with.
我用它来存储一堆查询结果和结构。 它很有用,因为它可以在一次操作中捕获多个表。 JSON 是 WDDX 解决问题的更现代的方法。 如果我有选择的话,我会选择 JSON,因为它具有更强的互操作性。
I use it to store a bunch on query results and structs. It is useful because it can capture multiple tables in one operation. JSON is a more modern approach to what WDDX solves. If I had a choice I would pick JSON because of its greater interoperability.
我上次使用它是为了序列化表单范围。 不太记得为什么我需要这样做,但该表单有很多变化,并且要重新填充字段,我可以反序列化 WDDX,一切都很好。
有一段时间没使用它了。
The last time I used it was to serialize the form scope. Can't remember much about why I needed to, but that the form had many variations and to repopulate the fields I could deserialize the WDDX and all was well with the world.
Haven't used it in a while now.
我必须使用它来存储 cookie 中的结构,因为我在一家 assclown 公司工作,该公司构建了禁用会话变量范围的电子商务网站。 这并不是出于任何实际的用户安全原因。 如果在启用了会话变量的服务器上运行,他们的后端管理应用程序会由于某种未知原因而自行崩溃。 因此,您知道,也许修复导致问题的任何问题,或者也许在单独的服务器上运行管理系统,他们禁用会话,因为这是解决问题的“最快、最便宜和最简单”的方法。
很高兴我不再在那里工作了。
I had to use it to store structures in cookies because I worked for an assclown company that built e-commerce websites with the session variable scope disabled. This wasn't for any kind of practical user security reason. Their back end administrative application for some unknown reason would cave in on itself if run on a server with session variables enabled. So instead of, you know, maybe fixing whatever was causing the problem, or perhaps running the admin system on a separate server, they disabled sessions, because it was the 'fastest, cheapest, and easiest' way to fix the problem.
So glad I don't work there anymore.
我曾经存储一些有关产品运输的信息 - 基本上,哪些产品放在哪个盒子里。 在设计此应用程序时,不需要将该信息存储在数据库中的单独行中,因此构建的包含该信息的结构使用 WDDX 进行序列化并填充到数据库中。
I used to store some information about product shipping- which products go in which boxes, basically. At the time of the design of this application, there was no need to store that information in separate rows in the DB, so the struct that was built containing that information was serialized with WDDX and stuffed in the DB.