如何将多个列表作为值插入到任何logic数据库表中?

发布于 2025-02-09 16:45:33 字数 921 浏览 1 评论 0原文

为了记录每个代理的零件ID和过程时间,我创建了单个数据库表,其中记录了这些值。我想创建一个结果数据库表,以汇总单个表中的所有时间和ID。我尝试编写有关模型销毁的以下代码,以将单个表上的值输入结果表中:

List<String> list1 = selectFrom(identifiers).list(identifiers.part_id);
List<Double> list2 = selectFrom(cfs_time).list(cfs_time.cfs_time);
List<Double> list3 = selectFrom(deburr_time).list(deburr_time.deburr_time);
List<Double> list4 = selectFrom(drill_time).list(drill_time.drill_time);

insertInto( results )
.columns( results.part_id, results.cfs_time, results.deburr_time, results.drill_time) 
.values( list1, list2, list3, list4 )
.execute();

但是,当我运行模型时,我会得到“行计数不匹配” 模型销毁中的错误。当我尝试使用以下代码输入单个列表(例如list1)时:

insertInto( results )
.columns( results.part_id)
.values(list1)
.execute();

它无需任何问题,但显然只会添加一个列。这告诉我,当我尝试在上面的第一个代码上添加多个列表时,我会遇到问题。我想问一下我在该代码上做错了什么,应该做些什么,以便能够将多个列表输入单个列中。

预先感谢您的帮助。

In order to record part IDs and process times for each agent, I created individual database tables where these values are recorded. I wanted to create a results database table to summarize all times and IDs in a single table. I tried writing the following code on model destroy to input the values on the individual tables into the results table:

List<String> list1 = selectFrom(identifiers).list(identifiers.part_id);
List<Double> list2 = selectFrom(cfs_time).list(cfs_time.cfs_time);
List<Double> list3 = selectFrom(deburr_time).list(deburr_time.deburr_time);
List<Double> list4 = selectFrom(drill_time).list(drill_time.drill_time);

insertInto( results )
.columns( results.part_id, results.cfs_time, results.deburr_time, results.drill_time) 
.values( list1, list2, list3, list4 )
.execute();

However when I run the model I get a "row column count mismatch" error on model destroy. When I try to input a single list (such as list1) with the following code:

insertInto( results )
.columns( results.part_id)
.values(list1)
.execute();

it works without any issue but obviously only adds a single column. This tells me that I am having a problem when I try to add multiple list like on the first code above. I wanted to ask what I am doing wrong with that code and what should I do differently to be able to input multiple lists into individual columns.

Thank you in advance for your assistance.

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

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

发布评论

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

评论(1

吃素的狼 2025-02-16 16:45:33

您的4个列表有不同数量的条目。在将其写入摘要dbase表之前,请确保它们具有相同的.size()

(这也是错误也要说的:))

Your 4 lists have a different number of entries. Ensure they have the same .size() for the lists before writing them into the summary dbase table.

(this is what the error is trying to say as well :) )

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