Filemaker 重复字段和 ODBC

发布于 2024-08-18 15:23:56 字数 343 浏览 7 评论 0原文

因此,我正在将旧的 filemaker 数据库传输到 MySQL,一些重复字段给我带来了一些问题。我读到,ODBC 标准仅当它们的类型为“文本”并且每个重复都与特定分隔符连接时才支持这些字段(参见第 47 页 (PDF))。但是,我无法重现这一点。我得到的只是第一次重复。

如果我将数据库导出为 .csv 格式,字段会正确连接,因此我不会完全陷入困境,但如果可能的话,我希望能够通过 ODBC 连接获得相同的结果。谢谢!

So I'm transferring an old filemaker database to MySQL and some repeating fields are causing me some problems. I've read that the ODBC standard support those fields, only when their types is "Text" and that each repetition is concatenated with a certain delimiter (see page 47 (PDF)). However, I just can't reproduce this. All I get is the first repetition.

If I export the database to the .csv format, the fields are correctly concatenated, so I'm not completely stuck, but if possible, I'd like to be able to obtain the same result with the ODBC connection. Thanks!

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

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

发布评论

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

评论(4

小ぇ时光︴ 2024-08-25 15:23:57

使用 JDBC 和 Filemaker 12,我可以使用括号访问重复字段,因为它是以索引 1 开头的表。
ODBC 中应该是一样的。
当然,我建议标准化,但了解还有其他选择会有所帮助。

With JDBC and Filemaker 12 I can access the repeating field using brackets as it was table beginning with index 1.
It should be the same in ODBC.
Of course I recommend to normalize but it can help to know there is other options.

故事灯 2024-08-25 15:23:57

根据我的经验,有关重复字段的文档是一个谎言。 :)

如果您可以让它工作,请发布答案。但我想你必须使用 csv 导出来解决这个问题。

In my experience the documentation about repeating fields is a lie. :)

If you can get it to work, please, please post an answer. But I imagine you'll have to do the workaround using the csv export.

还在原地等你 2024-08-25 15:23:57

我对此的建议是将重复字段标准化为 FileMaker 中的单独表,然后执行数据传输。您可以在 FileMaker 中创建相关表,然后使用脚本使用重复字段值填充该表。如果您需要帮助编写此类脚本,请告诉我。

My recommendation regarding this would be to normalize the repeating fields to a separate table within FileMaker and then perform the transfer of the data. You can create a related table in FileMaker and then use a script to populate the table with the repeating field values. Let me know if you need assistance writing such a script.

岛歌少女 2024-08-25 15:23:57

我想提供有关上面 @Signix 答案的详细信息。我能够从 JDBC 获取重复字段,但这很棘手。 FileMaker“ODBC 和 JDBC 指南”第 30 页指出:

注意 FileMaker 重复字段与数组一样受支持。

示例

INSERT INTO mytable(repField[3]) VALUES ('这是代表 3')
从 mytable 中选择repField[1]、repField[2]

这是唯一的文档!所以理论上你可以使用这个查询:

ResultSet resultSet = fmStatement.executeQuery("SELECT id, repField[1], repField[2] FROM mytable");

但棘手的部分是获取结果。唯一的方法似乎是使用列索引。

System.out.println(resultSet.getString("repField[1]")); // fails, throws FMSQLException
System.out.println(resultSet.getString("repField[2]")); // fails, throws FMSQLException
System.out.println(resultSet.getString("repField")); // returns repField[1]
System.out.println(resultSet.getString(2)); // returns repField[1]
System.out.println(resultSet.getString(3)); // returns repField[2]

我认为原因是因为字段的命名没有括号部分。

System.out.println(resultSet.getMetaData().getColumnName(1)); // returns "id"
System.out.println(resultSet.getMetaData().getColumnName(2)); // returns "repField"
System.out.println(resultSet.getMetaData().getColumnName(3)); // returns "repField"

因此,当使用 resultSet.getString("repField") 时,它会返回具有该名称的第一个列值。这很愚蠢,但很有效。

I want to provide details about @Signix answer above. I was able to fetch repeating fields from JDBC but it's tricky. At page 30 of FileMaker "ODBC and JDBC Guide", it states:

Note FileMaker repeating fields are supported like arrays.

Example

INSERT INTO mytable(repField[3]) VALUES (‘this is rep 3’)
SELECT repField[1], repField[2] FROM mytable

This is the only documentation! So in theory you could use this query:

ResultSet resultSet = fmStatement.executeQuery("SELECT id, repField[1], repField[2] FROM mytable");

But the tricky part is getting the results. The only way seems to use the column index.

System.out.println(resultSet.getString("repField[1]")); // fails, throws FMSQLException
System.out.println(resultSet.getString("repField[2]")); // fails, throws FMSQLException
System.out.println(resultSet.getString("repField")); // returns repField[1]
System.out.println(resultSet.getString(2)); // returns repField[1]
System.out.println(resultSet.getString(3)); // returns repField[2]

I think the reason is because fields are being named without their bracket parts.

System.out.println(resultSet.getMetaData().getColumnName(1)); // returns "id"
System.out.println(resultSet.getMetaData().getColumnName(2)); // returns "repField"
System.out.println(resultSet.getMetaData().getColumnName(3)); // returns "repField"

So when using resultSet.getString("repField") it returns the first column value with that name. It's stupid but it works.

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