I’m not able to return same data with PDO functions and with ODBC_* functions. With the same driver.
The database is SAP HANA.
Code:
$driver = 'HDBODBC';
$host = "XX.XX.XX.XX:30015";
$db_name = "MY_DATABASE";
$username = "XXX";
$password = "XXXX";
$conn = odbc_connect("Driver=$driver;ServerNode=$host;Database=$db_name;", $username, $password, SQL_CUR_USE_ODBC);
$params = [
'Belkin',
'',
'',
'AL'
];
$sql = 'SELECT * FROM "MY_DATABASE"."PRODUCT" (%s%s%s) LIMIT 10';
$sql = sprintf($sql,"'",implode("','",$params),"'");
$result = odbc_exec($conn,$sql);
while($row = odbc_fetch_array($result)){
dump($row);
break;
}
$dsn = "odbc:Driver=$driver;ServerNode=$host;Database=$db_name";
$dbh = new PDO($dsn, $username, $password);
$stmt = $dbh->prepare($sql);
$stmt -> execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
dump($result[0]);
First dump returns:
Second dump returns: