简体   繁体   English

ADODataset:如何在没有临时文件的情况下加载XML(在ADO模式中预先保存在DB中)数据?

[英]ADODataset: how to load XML (saved beforehand in DB in ADO schema) data without temporary files?

Warning: total rewrite. 警告:完全重写。

Scenario: 场景:

I loaded some data from database on a TCustomADODataset descendant. 我在TCustomADODataset后代上从数据库加载了一些数据。 After that, I saved this data on XML temp file (using TCustomADODataset.SaveToFile) to allow getting the XML data as a string and store it on a database table as text blob - it's an exports table. 之后,我将此数据保存在XML临时文件中(使用TCustomADODataset.SaveToFile),以允许将XML数据作为字符串获取并将其作为文本Blob存储在数据库表中-这是一个导出表。

Another program (different from the one that stored the XML) will take that data, show the elements inside, and allow an user to select which element to import to the main database schema. 另一个程序(与存储XML的程序不同)将获取该数据,显示其中的元素,并允许用户选择要导入到主数据库模式的元素。

Problem: 问题:

The problem with the approach above is the need of temporary files to allow TCustomADODataset use the LoadFromFile method. 上面方法的问题是需要临时文件以允许TCustomADODataset使用LoadFromFile方法。

There's any other way to load that XML data stored as text in the database exports table into a TCustomADODataset that don't need temporary files? 还有其他方法可以将存储在数据库导出表中的XML数据作为文本加载到不需要临时文件的TCustomADODataset中吗?

Notes: 笔记:

  • TClientDataset is not an option in this case . 在这种情况下,不能选择TClientDataset。

Check this example. 检查示例。 It is probably exactly what you are looking for. 它可能正是您要寻找的。 Using the RecordsetFromXML from that example you can simply assign the recordset to your TCustomADODataSet.Recordset property. 使用该示例中的RecordsetFromXML ,您可以简单地将记录集分配给TCustomADODataSet.Recordset属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM