fix expected values in sqlsrv tests

This commit is contained in:
v-kaywon 2017-09-14 11:40:13 -07:00
parent 49a5c9e461
commit 199ad557bb
8 changed files with 66 additions and 60 deletions

View file

@ -17,7 +17,6 @@ foreach ( $dataTypes as $dataType ) {
// create table
$tbname = GetTempTableName( "", false );
$tbname = "test_numeric";
$colMetaArr = array( new columnMeta( $dataType, "c_det" ), new columnMeta( $dataType, "c_rand" ));
create_table( $conn, $tbname, $colMetaArr );
@ -30,16 +29,29 @@ foreach ( $dataTypes as $dataType ) {
}
else {
echo "****Encrypted default type is compatible with encrypted $dataType****\n";
fetch_all( $conn, $tbname );
if ( $dataType != "time" )
fetch_all( $conn, $tbname );
else
{
$sql = "SELECT * FROM $tbname";
$stmt = sqlsrv_query( $conn, $sql );
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC );
foreach ( $row as $key => $value )
{
//var_dump( $row );
$t = $value->format( 'H:i:s' );
print "$key: $t\n";
}
}
}
//DropTable( $conn, $tbname );
DropTable( $conn, $tbname );
}
sqlsrv_free_stmt( $stmt );
sqlsrv_close( $conn );
?>
--EXPECT--
Testing date:
Testing date:
****Encrypted default type is compatible with encrypted date****
c_det:
date: 0001-01-01 00:00:00.000000
@ -50,7 +62,7 @@ c_rand:
timezone_type: 3
timezone: UTC
Testing datetime:
Testing datetime:
****Encrypted default type is compatible with encrypted datetime****
c_det:
date: 1753-01-01 00:00:00.000000
@ -61,7 +73,7 @@ c_rand:
timezone_type: 3
timezone: UTC
Testing datetime2:
Testing datetime2:
****Encrypted default type is compatible with encrypted datetime2****
c_det:
date: 0001-01-01 00:00:00.000000
@ -72,7 +84,7 @@ c_rand:
timezone_type: 3
timezone: UTC
Testing smalldatetime:
Testing smalldatetime:
****Encrypted default type is compatible with encrypted smalldatetime****
c_det:
date: 1900-01-01 00:00:00.000000
@ -83,18 +95,12 @@ c_rand:
timezone_type: 3
timezone: UTC
Testing time:
Testing time:
****Encrypted default type is compatible with encrypted time****
c_det:
date: 2017-09-12 00:00:00.000000
timezone_type: 3
timezone: UTC
c_rand:
date: 2017-09-12 23:59:59.1000000
timezone_type: 3
timezone: UTC
c_det: 00:00:00
c_rand: 23:59:59
Testing datetimeoffset:
Testing datetimeoffset:
****Encrypted default type is compatible with encrypted datetimeoffset****
c_det:
date: 0001-01-01 00:00:00.000000

View file

@ -70,8 +70,8 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing smallmoney:
Testing smallmoney:
Test successfully.
Testing money:
Testing money:
Test successfully.

View file

@ -38,47 +38,47 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing bit:
Testing bit:
****Encrypted default type is compatible with encrypted bit****
c_det: 1
c_rand: 0
Testing tinyint:
Testing tinyint:
****Encrypted default type is compatible with encrypted tinyint****
c_det: 0
c_rand: 255
Testing smallint:
Testing smallint:
****Encrypted default type is compatible with encrypted smallint****
c_det: -32767
c_rand: 32767
Testing int:
Testing int:
****Encrypted default type is compatible with encrypted int****
c_det: -2147483647
c_rand: 2147483647
Testing bigint:
Testing bigint:
****Encrypted default type is compatible with encrypted bigint****
c_det: -922337203685479936
c_rand: 922337203685479936
Testing decimal(18,5):
Testing decimal(18,5):
****Encrypted default type is compatible with encrypted decimal(18,5)****
c_det: -9223372036854.80000
c_rand: 9223372036854.80000
Testing numeric(10,5):
Testing numeric(10,5):
****Encrypted default type is compatible with encrypted numeric(10,5)****
c_det: -21474.83647
c_rand: 21474.83647
Testing float:
Testing float:
****Encrypted default type is compatible with encrypted float****
c_det: -9223372036.8548
c_rand: 9223372036.8548
Testing real:
Testing real:
****Encrypted default type is compatible with encrypted real****
c_det: -2147.4829101562
c_rand: 2147.4829101562

View file

@ -70,8 +70,8 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing smallmoney:
Testing smallmoney:
Test successfully.
Testing money:
Testing money:
Test successfully.

View file

@ -104,29 +104,29 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing bit:
Testing bit:
Test successfully.
Testing tinyint:
Testing tinyint:
Test successfully.
Testing smallint:
Testing smallint:
Test successfully.
Testing int:
Testing int:
Test successfully.
Testing bigint:
Testing bigint:
Test successfully.
Testing decimal(18,5):
Testing decimal(18,5):
Test successfully.
Testing numeric(10,5):
Testing numeric(10,5):
Test successfully.
Testing float:
Testing float:
Test successfully.
Testing real:
Testing real:
Test successfully.

View file

@ -84,14 +84,14 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing char(5):
Testing char(5):
Test successfully.
Testing varchar(max):
Testing varchar(max):
Test successfully.
Testing nchar(5):
Testing nchar(5):
Test successfully.
Testing nvarchar(max):
Testing nvarchar(max):
Test successfully.

View file

@ -39,22 +39,22 @@ sqlsrv_close( $conn );
?>
--EXPECT--
Testing char(5):
Testing char(5):
****Encrypted default type is compatible with encrypted char(5)****
c_det: -leng
c_rand: th, n
Testing varchar(max):
Testing varchar(max):
****Encrypted default type is compatible with encrypted varchar(max)****
c_det: Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.
c_rand: Each non-null varchar(max) or nvarchar(max) column requires 24 bytes of additional fixed allocation which counts against the 8,060 byte row limit during a sort operation.
Testing nchar(5):
Testing nchar(5):
****Encrypted default type is compatible with encrypted nchar(5)****
c_det: -leng
c_rand: th Un
Testing nvarchar(max):
Testing nvarchar(max):
****Encrypted default type is compatible with encrypted nvarchar(max)****
c_det: When prefixing a string constant with the letter N, the implicit conversion will result in a Unicode string if the constant to convert does not exceed the max length for a Unicode string data type (4,000).
c_rand: Otherwise, the implicit conversion will result in a Unicode large-value (max).

View file

@ -144,22 +144,22 @@ sqlsrv_free_stmt( $stmt );
sqlsrv_close( $conn );
?>
--EXPECT--
--EXPECTREGEX--
intOut: 2147483647
smallintOut: 32767
tinyintOut: 255
bitOut: 1
bigintOut: 9.2233720368548E+17
decimalOut: 9223372036854.8
numericOut: 21474.83647
floatOut: 9223372036.8548
realOut: 2147.4829101562
bigintOut: 9.2233720368548E\+17
decimalOut: 9223372036854\.8
numericOut: 21474\.83647
floatOut: 9223372036\.8548
realOut: 2147\.4829101562
dateOut: 9999-12-31
datetimeOut: 9999-12-31 23:59:59.997
datetime2Out: 9999-12-31 23:59:59.9999999
datetimeoffsetOut: 9999-12-31 23:59:59.9999999 +14:00
timeOut: 23:59:59.9999999
charOut: th, n
varcharOut: This large row size can cause errors (such as error 512) during some normal operations, such as a clustered index key update, or sorts of the full column set, which users cannot anticipate until performing an operation.
datetimeOut: (9999-12-31 23:59:59\.997|Dec 31 9999 11:59PM)
datetime2Out: 9999-12-31 23:59:59\.9999999
datetimeoffsetOut: 9999-12-31 23:59:59\.9999999 \+14:00
timeOut: 23:59:59\.9999999
charOut: th\, n
varcharOut: This large row size can cause errors \(such as error 512\) during some normal operations\, such as a clustered index key update\, or sorts of the full column set\, which users cannot anticipate until performing an operation\.
ncharOut: th Un
nvarcharOut: When prefixing a string constant with the letter N, the implicit conversion will result in a Unicode string if the constant to convert does not exceed the max length for a Unicode string data type (4,000).
nvarcharOut: When prefixing a string constant with the letter N\, the implicit conversion will result in a Unicode string if the constant to convert does not exceed the max length for a Unicode string data type \(4,000\)\.