--TEST-- Test fetching varbinary max fields with client buffer --DESCRIPTION-- Test fetching varbinary max fields as streams or strings using client buffer --SKIPIF-- --ENV-- PHPT_EXEC=true --FILE-- SQLSRV_CURSOR_CLIENT_BUFFERED)); } else { trace("Test without using a client buffer\n"); $stmt = sqlsrv_prepare($conn, $query); } if (!$stmt) { fatalError("runTest: failed to prepare select statement"); } fetchData($stmt, 1); fetchData($stmt, 2); fetchData($stmt, 3); fetchStream($stmt, 1); fetchStream($stmt, 2); fetchStream($stmt, 3); } function checkData($actual, $expected) { $success = true; $pos = strpos($actual, $expected); if (($pos === false) || ($pos > 1)) { $success = false; } return ($success); } $conn = AE\connect(); $tableName = "binary_max_fields"; $columns = array(new AE\ColumnMeta("varbinary(max)", "varbinary_max_col"), new AE\ColumnMeta("varbinary(max)", "varbinary_null_col")); AE\createTable($conn, $tableName, $columns); $bin = 'abcdefghijk'; $binaryValue = str_repeat($bin, 400); $hexValue = strtoupper(bin2hex($binaryValue)); $insertSql = "INSERT INTO $tableName (varbinary_max_col, varbinary_null_col) VALUES (?, ?)"; $params = array(array($binaryValue, null, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max')), array(null, null, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARBINARY('max'))); $stmt = sqlsrv_prepare($conn, $insertSql, $params); if ($stmt) { $res = sqlsrv_execute($stmt); if (!$res) { fatalError("Failed to insert data"); } } else { fatalError("Failed to prepare insert statement"); } runTest($conn, false); runTest($conn, true); echo "Done\n"; dropTable($conn, $tableName); sqlsrv_free_stmt($stmt); sqlsrv_close($conn); ?> --EXPECT-- Done