无法使用 Cairngorm 持久性库为 PersistenceClient 创建 SqlMap

发布于 2024-12-27 04:30:56 字数 1013 浏览 5 评论 0原文

我试图通过以下方式创建持久性客户端对象:

var create:Create = new Create();
create.sql = "CREATE TABLE IF NOT EXISTS REPOFILE( REPOFILEID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, CHECKSUM TEXT, BYTES INTEGER, CREATED INTEGER, UPDATED INTEGER, ISDIRECTORY INTEGER )";

var sqlMap:SqlMap = new SqlMap( { createRepoFileTable : create } );

connectionManager = new ConnectionManagerFactory().createConnectionManager();
persistenceClient = new PersistenceClient( sqlMap, connectionManager );

我遇到的问题是,即使 sqlmap 对象内有一个有效的“_maps”数组,sqlmap 的“map”属性仍然不可检索。

maps    [] (@b812d09)   
    [0] Object (@b103d61)   
        createRepoFileTable com.adobe.cairngorm.persistence.api.grammar.Create (@b103a91)       
    length  1   

当尝试执行创建表sql时,语句工厂抱怨:

Error: SQLERROR0014: Statement 'createRepoFileTable' not found in SQL map

不知何故,sqlmap类无法使用ObjectUtil类将传递给它的对象的属性复制到map属性。

我不想使用 mxml 文件,也不想像示例中那样使用 SPICElib。

我在这里做错了什么?

i am trying to create a persistence client object in the following way:

var create:Create = new Create();
create.sql = "CREATE TABLE IF NOT EXISTS REPOFILE( REPOFILEID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, CHECKSUM TEXT, BYTES INTEGER, CREATED INTEGER, UPDATED INTEGER, ISDIRECTORY INTEGER )";

var sqlMap:SqlMap = new SqlMap( { createRepoFileTable : create } );

connectionManager = new ConnectionManagerFactory().createConnectionManager();
persistenceClient = new PersistenceClient( sqlMap, connectionManager );

the problem i am encountering is that the "map" property of the sqlmap stays not retrievable even though there is a valid "_maps" array inside the sqlmap object.

maps    [] (@b812d09)   
    [0] Object (@b103d61)   
        createRepoFileTable com.adobe.cairngorm.persistence.api.grammar.Create (@b103a91)       
    length  1   

when trying to execute the create table sql, the statement factory complains:

Error: SQLERROR0014: Statement 'createRepoFileTable' not found in SQL map

somehow the sqlmap class is unable to copy the properties of the object passed to it to the map property using the ObjectUtil class.

i do not want to use an mxml file and i also do not want to use spicelib like in the example.

what am i doing wrong here?

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

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

发布评论

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

评论(1

黎夕旧梦 2025-01-03 04:30:56

所以我发现在我的例子中,SqlMap 类中对 Spicelib 组件的调用不起作用:

var classInfo:ClassInfo=ClassInfo.forInstance(source);
var properties:Array=classInfo.getProperties();

属性数组始终为空。

但是,我获取了持久性库的源代码并更改了 ObjectUtil 中的循环以直接遍历对象的属性:

for (var propertyName:String in source)

现在它可以工作了,尽管我对修改 ObjectUtil 类并不是很高兴......也许有人对此有更好的看法。

so i figured out that in my case somehow the calls in the SqlMap class to the spicelib components didn't work:

var classInfo:ClassInfo=ClassInfo.forInstance(source);
var properties:Array=classInfo.getProperties();

the properties array was always empty.

however, i took the persistence lib's source code and changed the loop in the ObjectUtil's to go over the object's properties directly:

for (var propertyName:String in source)

now it works, although i am not really happy having modified the ObjectUtil class... maybe someone has a better take on this.

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