--TEST-- Test for inserting encrypted fixed size types data and retrieve both encrypted and decrypted data --SKIPIF-- --FILE-- 255, "SmallIntData" => 32767, "IntData" => 2147483647, "BigIntData" => 92233720368547, "DecimalData" => 79228162514264, "BitData" => 1, "DateTimeData" => '9999-12-31 23:59:59.997', "DateTime2Data" => '9999-12-31 23:59:59.123456'); $r; $stmt = AE\insertRow($conn, $tbname, $inputs, $r); if ($r === false) { var_dump(sqlsrv_errors()); } print "Decrypted values:\n"; $stmt = selectFromTable($conn, $tbname); while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { foreach ($row as $key => $value) { if (is_object($value)) { // datetime objects $t = date_format($value,"Y-m-d H:i:s.u"); $tz = $value->getTimezone()->getName(); print("$key: $t $tz\n"); } else { print("$key: $value\n"); } } } sqlsrv_free_stmt($stmt); // for AE only if (AE\isDataEncrypted()) { $conn1 = connect(null, true); $selectSql = "SELECT * FROM $tbname"; $stmt = sqlsrv_query($conn1, $selectSql); if ($stmt === false) { var_dump(sqlsrv_errors()); } $encrypted_row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC); foreach ($encrypted_row as $key => $value) { if (ctype_print($value)) { print "Error: expected a binary array for $key!\n"; } } sqlsrv_free_stmt($stmt); sqlsrv_close($conn1); } dropTable($conn, $tbname); sqlsrv_close($conn); echo "Done\n"; ?> --EXPECT-- Decrypted values: TinyIntData: 255 SmallIntData: 32767 IntData: 2147483647 BigIntData: 92233720368547 DecimalData: 79228162514264 BitData: 1 DateTimeData: 9999-12-31 23:59:59.997000 Canada/Pacific DateTime2Data: 9999-12-31 23:59:59.123456 Canada/Pacific Done