PDO Fetch assoc iSeries AS400 unixodbc仅返回列

时间:2016-05-11 13:00:58

标签: php pdo ibm-midrange unixodbc

使用PDO ASSOC语句时,我只获得列的第一个字母而不是完整的一个字母。有任何想法吗 ?更多信息如下:

通过PHP获取fetch_assoc的小代码块:

$pdo = new PDO("xxx", "user","pwd");
$pdo->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING);
$query = $pdo->query("SELECT TRND.TRANID FROM PCRMTRND AS TRND");
$query->execute();
$tmp = array();
while($row=$query->fetch(PDO::FETCH_ASSOC)) {
        array_push($tmp,$row);
}

填充数组tmp后:

enter image description here

每行Var DUMP:

enter image description here

ODBC的设置:

[xxx]
Description             = iSeries ODBC
Driver                  = IBM i Access ODBC Driver
System                  = /
UserID                  = 
Password                = 
Naming                  = 0
DefaultLibraries        = QGPL
Database                =
ConnectionType          = 0
CommitMode              = 2
ExtendedDynamic         = 1
DefaultPkgLibrary       = QGPL
DefaultPackage          = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression    = 1
LibraryView             = 0
AllowUnsupportedChar    = 0
ForceTranslation        = 0
Trace                   = 0

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,它似乎与区域设置有关。当我从" en_US.UTF-8"更改LC_ALL时到" en_US.ISO-8859-1"问题消失了。因此,我没有UTF的输出:(