Fixed a flawed emulate prepare test with AE (#1301)

This commit is contained in:
Jenny Tam 2021-09-14 17:36:35 -07:00 committed by GitHub
parent 4af55d5818
commit 48b6a6013f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,17 +47,21 @@ try {
print_r($row); print_r($row);
//with emulate prepare and no bind param options //with emulate prepare and no bind param options
print_r("Prepare with emulate prepare and no bindParam options:\n");
if (!isAEConnected()) { if (!isAEConnected()) {
$options = array(PDO::ATTR_EMULATE_PREPARES => true); $options = array(PDO::ATTR_EMULATE_PREPARES => true);
} else { } else {
$options = array(PDO::ATTR_EMULATE_PREPARES => false); $options = array(PDO::ATTR_EMULATE_PREPARES => false);
} }
$stmt = prepareStmt($conn, $query, $options);
$row = $stmt->fetch(PDO::FETCH_ASSOC); print_r("Prepare with emulate prepare and no bindParam options:\n");
print_r($row); // This test only makes sense without AE because the default encoding is PDO::SQLSRV_ENCODING_UTF8
if ($stmt->rowCount() == 0) { if (!isAEConnected()) {
print_r("No results for this query\n"); $stmt = prepareStmt($conn, $query, $options);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($stmt->rowCount() != 0) {
print_r("Do not expect results for this query!\n");
print_r($row);
}
} }
//with emulate prepare and SQLSRV_ENCODING_UTF8 //with emulate prepare and SQLSRV_ENCODING_UTF8
@ -117,7 +121,6 @@ Array
[age] => 30 [age] => 30
) )
Prepare with emulate prepare and no bindParam options: Prepare with emulate prepare and no bindParam options:
No results for this query
Prepare with emulate prepare and SQLSRV_ENCODING_UTF8: Prepare with emulate prepare and SQLSRV_ENCODING_UTF8:
Array Array
( (