Made more changes as per review

This commit is contained in:
Jenny Tam 2017-12-05 13:43:53 -08:00
parent 69793cdafc
commit cf9e54fb74
10 changed files with 26 additions and 40 deletions

View file

@ -9,7 +9,7 @@ This test is similar to the other test TC33_ComplexQuery but using UTF-8 data
<?php
require_once('MsCommon.inc');
function insertTest($conn, $tableName, $inputs, $query = null)
function insertTest($conn, $tableName, $inputs, $query)
{
$stmt = null;
if (!AE\isColEncrypted()) {

View file

@ -1,7 +1,7 @@
--TEST--
Test using sqlsrv_query for binding parameters with column encryption and a custom keystore provider
--SKIPIF--
<?php require('skipif_not_ksp.inc'); ?>
<?php require('skipif_versions_old.inc'); ?>
--FILE--
<?php
class Patient

View file

@ -153,7 +153,7 @@ function getInputData($index)
try {
setup();
$conn = connect();
$conn = AE\connect();
// Create a temp table that will be automatically dropped once the connection is closed
$tableName = 'param_input_variants';

View file

@ -116,8 +116,8 @@ setup();
// connect
$conn = AE\connect();
// Create a test table that will be automatically dropped once the connection is closed
$tableName = GetTempTableName('test_output_variants', false);
// Create a test table
$tableName = 'test_output_variants';
createVariantTable($conn, $tableName);
testOutputParam($conn, $tableName);

View file

@ -12,9 +12,9 @@ function getFirstInputParam()
return array(1, null, null, $intType);
}
function MinMaxScale($conn)
function minMaxScale($conn)
{
$tableName = 'MinMaxScale';
$tableName = 'minMaxScale';
$columns = array(new AE\ColumnMeta('int', 'c1_int'),
new AE\ColumnMeta('decimal(28,4)', 'c2_decimal'),
new AE\ColumnMeta('numeric(32,4)', 'c3_numeric'));
@ -31,9 +31,9 @@ function MinMaxScale($conn)
dropTable($conn, $tableName);
}
function MinMaxSize($conn)
function minMaxSize($conn)
{
$tableName = 'MinMaxSize';
$tableName = 'minMaxSize';
$columns = array(new AE\ColumnMeta('int', 'c1_int'),
new AE\ColumnMeta('varchar(max)', 'c2_varchar_max'));
$stmt = AE\createTable($conn, $tableName, $columns);
@ -49,9 +49,9 @@ function MinMaxSize($conn)
dropTable($conn, $tableName);
}
function MinMaxPrecision($conn)
function minMaxPrecision($conn)
{
$tableName = 'MinMaxPrecision';
$tableName = 'minMaxPrecision';
$columns = array(new AE\ColumnMeta('int', 'c1_int'),
new AE\ColumnMeta('decimal(28,4)', 'c2_decimal'),
new AE\ColumnMeta('numeric(32,4)', 'c3_numeric'));
@ -76,9 +76,9 @@ try {
// connect
$conn = AE\connect();
MinMaxScale($conn);
MinMaxSize($conn);
MinMaxPrecision($conn);
minMaxScale($conn);
minMaxSize($conn);
minMaxPrecision($conn);
sqlsrv_close($conn);
} catch (Exception $e) {

View file

@ -66,15 +66,18 @@ try {
sqlsrv_configure('WarningsReturnAsErrors', 1);
// connect
$conn = connect();
if (!$conn) {
fatalError("Could not connect.\n");
}
$conn = AE\connect();
// create a test table
$tableName = 'null_binary_stream';
$stmt = sqlsrv_query($conn, "CREATE TABLE $tableName ([c1_int] int, [c2_varbinary] varbinary(512), [c3_varbinary_max] varbinary(max), [c4_image] image)");
sqlsrv_free_stmt($stmt);
$columns = array(new AE\ColumnMeta('int', 'c1_int'),
new AE\ColumnMeta('varbinary(512)', 'c2_varbinary'),
new AE\ColumnMeta('varbinary(max)', 'c3_varbinary_max'),
new AE\ColumnMeta('image', 'c4_image'));
$stmt = AE\createTable($conn, $tableName, $columns);
if (!$stmt) {
fatalError("Failed to create table.\n");
}
nullBin2String($conn, $tableName);
nullPrepBin2String($conn, $tableName);

View file

@ -17,7 +17,7 @@ $tableName = 'testLOBTypes_GH231_lob';
$columnNames = array("c1", "c2");
for ($k = 1; $k <= 3; $k++) {
$sqlType = getFieldType($k);
$sqlType = SQLType($k);
$columns = array(new AE\ColumnMeta('int', $columnNames[0]),
new AE\ColumnMeta($sqlType, $columnNames[1]));
AE\createTable($conn, $tableName, $columns);
@ -91,7 +91,7 @@ function getData($k)
return $data;
}
function getFieldType($k)
function SQLType($k)
{
switch ($k) {
case 1: return ("text");

View file

@ -20,10 +20,6 @@ for ($k = 1; $k <= 8; $k++) {
new AE\ColumnMeta($sqlType, $columnNames[1]));
AE\createTable($conn, $tableName, $columns);
// $sql = "CREATE TABLE [$tableName] ($dataType)";
// $stmt1 = sqlsrv_query($conn, $sql);
// sqlsrv_free_stmt($stmt1);
$sql = "INSERT INTO [$tableName] ($columnNames[0], $columnNames[1]) VALUES (?, ?)";
$data = getData($k);
$phpType = getPhpType($k);

View file

@ -10,9 +10,6 @@ Send an empty stream and null stream test.
require_once("MsCommon.inc");
$conn = AE\connect();
// if (!$conn) {
// fatalError("sqlsrv_connect failed.");
// }
$tableName = 'test_empty_stream';
$columns = array(new AE\ColumnMeta('int', 'id'),
@ -23,16 +20,6 @@ Send an empty stream and null stream test.
fatalError("Failed to create table $tableName\n");
}
// $stmt = sqlsrv_query($conn, "IF OBJECT_ID('test_empty_stream', 'U') IS NOT NULL DROP TABLE test_empty_stream");
// if ($stmt !== false) {
// sqlsrv_free_stmt($stmt);
// }
// $stmt = sqlsrv_query($conn, "CREATE TABLE $tableName (id int, varchar_stream varchar(max), varbinary_stream varbinary(max))");
// if ($stmt === false) {
// die(print_r(sqlsrv_errors(), true));
// }
$f1 = 1;
$f2 = fopen("data://text/plain,", "r");
$stmt = sqlsrv_prepare($conn, "INSERT INTO $tableName (id, varchar_stream) VALUES (?, ?)", array( &$f1, &$f2 ));

View file

@ -105,7 +105,7 @@ error messages when trying to retrieve past the end of a result set and when no
}
print_r(sqlsrv_errors());
sqlsrv_query($conn, "DROP TABLE $tableName");
dropTable($conn, $tableName);
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);