与 iSeries 的 ODBC 连接给出奇数个结果

发布于 2024-07-15 02:02:30 字数 602 浏览 3 评论 0原文

我在 Ubuntu 8.04 LTS 上使用 UnixODBC 和 PHP 5.2.4,并尝试从 IBM i 上的表中提取所有结果并将它们复制到本地 MySQL 表。

从代码角度来说,它工作时没有错误,但我最终得到的行数比 IBM i 上包含的行数还要多。

我最终应该得到 25,613 行,但 PHP 报告有 25,630 行被插入到 MySQL 数据库中:

$counter = 0;
while($row = odbc_fetch_array($result)) {
    //Insert into MySQL using Zend Framework
    $counter++;
}
echo $counter;

当我查看 MySQL 数据库时,有些行实际上是重复的。 我在 odbc_fetch_array() 有关访问 IBM i 时不稳定行为的文档,但尝试该解决方案会导致脚本不断运行,似乎从未完成。

关于检查什么有什么想法吗?

I'm using UnixODBC with PHP 5.2.4 on Ubuntu 8.04 LTS and trying to pull all the results from a table sitting on an IBM i and replicate them to a local MySQL table.

Code-wise it is working with no errors but I'm ending up with more rows that what is contained on the IBM i.

I should end up with 25,613 rows but PHP reports that 25,630 rows are being inserted into the MySQL database:

$counter = 0;
while($row = odbc_fetch_array($result)) {
    //Insert into MySQL using Zend Framework
    $counter++;
}
echo $counter;

When I look in the MySQL database some of the rows are actually duplicated. I saw a note on the odbc_fetch_array() documentation about erratic behavior when accessing the IBM i, but trying that solution causes the script to run and run without ever seeming to finish.

Any ideas on what to check?

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

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

发布评论

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

评论(1

最美不过初阳 2024-07-22 02:02:30

每次都是重复相同的行吗? 如果是这样,这些记录是否有任何独特之处可以暗示它们为何重复?

也许使用另一个绑定来获取结果 - 例如 odbc_fetch_row()。 odbc_num_rows() 说什么?

这些技术和其他技术可能会帮助您锁定错误。

Is it the same rows being duplicated each time? If so, is there anything unique about these records that could hint on why they are duplicated?

Perhaps use another binding for getting results -- like odbc_fetch_row(). What does odbc_num_rows() say?

These and other techniques might help you zone in on the bug.

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