some tests with bug fixes
This commit is contained in:
parent
135545799a
commit
9334bb3c84
|
@ -174,7 +174,7 @@ test_script:
|
|||
|
||||
after_test:
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\test\
|
||||
- python output.py
|
||||
# python output.py
|
||||
- ps: $difffiles = Get-ChildItem sqlsrv\*.diff
|
||||
- ps: $outfiles = Get-ChildItem sqlsrv\*.out
|
||||
- ps: foreach($file in $difffiles){ls $file; more $file}
|
||||
|
|
101
test/sqlsrv/bind_param_null.phpt
Normal file
101
test/sqlsrv/bind_param_null.phpt
Normal file
|
@ -0,0 +1,101 @@
|
|||
--TEST--
|
||||
BindParam for NULL values.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
require ('sqlsrv_test_base.inc');
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
function bind_params_with_null($conn)
|
||||
{
|
||||
global $table1;
|
||||
$sql = " INSERT INTO " .$table1 . "
|
||||
([BigIntCol]
|
||||
,[BinaryCol]
|
||||
,[BitCol]
|
||||
,[CharCol]
|
||||
,[DateCol]
|
||||
,[DateTimeCol]
|
||||
,[DateTime2Col]
|
||||
,[DTOffsetCol]
|
||||
,[DecimalCol]
|
||||
,[FloatCol]
|
||||
,[ImageCol]
|
||||
,[IntCol]
|
||||
,[MoneyCol]
|
||||
,[NCharCol]
|
||||
,[NTextCol]
|
||||
,[NumCol]
|
||||
,[NVarCharCol]
|
||||
,[NVarCharMaxCol]
|
||||
,[RealCol]
|
||||
,[SmallDTCol]
|
||||
,[SmallIntCol]
|
||||
,[SmallMoneyCol]
|
||||
,[TextCol]
|
||||
,[TimeCol]
|
||||
,[TinyIntCol]
|
||||
,[Guidcol]
|
||||
,[VarbinaryCol]
|
||||
,[VarbinaryMaxCol]
|
||||
,[VarcharCol]
|
||||
,[VarcharMaxCol]
|
||||
,[XmlCol])
|
||||
VALUES (?,?,?,?,?,?,?,?,?,? /*10*/,?,?,?,?,?,?,?,?,?,? /*20*/, ?,?,?,?,?,?,?,?,?,?, ? /*31*/)";
|
||||
|
||||
$param = null;
|
||||
$params = array( $param,
|
||||
array( $param, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY)),
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param, /*10*/
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param, /*20*/
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
$param,
|
||||
array( $param, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY)),
|
||||
array( $param, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY)),
|
||||
$param,
|
||||
$param, /*30*/
|
||||
$param);
|
||||
|
||||
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||
|
||||
if($stmt === false ) {
|
||||
print_r( sqlsrv_errors() );
|
||||
die ("Statement creation failed");
|
||||
}
|
||||
}
|
||||
|
||||
$conn = Connect();
|
||||
create_table1($conn);
|
||||
bind_params_with_null($conn);
|
||||
echo "Test Succeeded";
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
Test Succeeded
|
46
test/sqlsrv/bug_611146.phpt
Normal file
46
test/sqlsrv/bug_611146.phpt
Normal file
|
@ -0,0 +1,46 @@
|
|||
--TEST--
|
||||
Bug: 611146: The parmeter index is off by 1 for certain parameter related error messages.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
require ('sqlsrv_test_base.inc');
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
function bind_params($conn)
|
||||
{
|
||||
$param1 = array();
|
||||
$param2 = 6;
|
||||
|
||||
$params = array($param1, $param2);
|
||||
$stmt = sqlsrv_query($conn, "Select 1 Where ? < ?", $params);
|
||||
|
||||
if($stmt === false ) {
|
||||
print_r(sqlsrv_errors());
|
||||
}
|
||||
}
|
||||
|
||||
$conn = Connect();
|
||||
bind_params($conn);
|
||||
echo "Test Succeeded";
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -9
|
||||
[code] => -9
|
||||
[2] => Parameter array 1 must have at least one value or variable.
|
||||
[message] => Parameter array 1 must have at least one value or variable.
|
||||
)
|
||||
|
||||
)
|
||||
Test Succeeded
|
24
test/sqlsrv/bug_close.phpt
Normal file
24
test/sqlsrv/bug_close.phpt
Normal file
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
crash in sqlsrv_close when followed by sqlsrv_query
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
$conn = Connect();
|
||||
|
||||
if (!$conn) {
|
||||
echo "connection failed:";
|
||||
echo "<pre>".print_r(sqlsrv_errors(),true)."</pre>";
|
||||
exit;
|
||||
}
|
||||
|
||||
//any query seems to trigger the bug
|
||||
$select = 'SELECT @@IDENTITY;';
|
||||
$stmt = sqlsrv_query($conn, $select);
|
||||
echo "Test successful".PHP_EOL;
|
||||
sqlsrv_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test successful
|
41
test/sqlsrv/bug_errors.phpt
Normal file
41
test/sqlsrv/bug_errors.phpt
Normal file
|
@ -0,0 +1,41 @@
|
|||
--TEST--
|
||||
for a condition that was causing a crash when calling sqlsrv_errors after an invalid query.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if (!$conn) {
|
||||
echo "connection failed:";
|
||||
echo "<pre>".print_r(sqlsrv_errors(),true)."</pre>";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!sqlsrv_query($conn,"INVALID QUERY")) {
|
||||
echo "invalid statement failed:<br>";
|
||||
echo "errors: <pre>".print_r(sqlsrv_errors(),true)."</pre><br>";
|
||||
echo "warnings: <pre>".print_r(sqlsrv_errors( SQLSRV_ERR_WARNINGS ),true)."</pre>";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
invalid statement failed:<br>errors: <pre>Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => 42000
|
||||
[SQLSTATE] => 42000
|
||||
[1] => 2812
|
||||
[code] => 2812
|
||||
[2] => %SCould not find stored procedure 'INVALID'.
|
||||
[message] => %SCould not find stored procedure 'INVALID'.
|
||||
)
|
||||
|
||||
)
|
||||
</pre><br>warnings: <pre></pre>
|
||||
|
37
test/sqlsrv/bugfix_dataCorruption.phpt
Normal file
37
test/sqlsrv/bugfix_dataCorruption.phpt
Normal file
|
@ -0,0 +1,37 @@
|
|||
--TEST--
|
||||
data corruption fix.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( $conn === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$tsql = "SELECT int_type FROM [test_types]";
|
||||
|
||||
$stmt1 = sqlsrv_query($conn, $tsql);
|
||||
if( $stmt1 === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$row = sqlsrv_fetch_array($stmt1);
|
||||
echo $row[0] . "\n";
|
||||
|
||||
$stmt2 = sqlsrv_query($conn, $tsql);
|
||||
if( $stmt2 === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
sqlsrv_fetch($stmt2);
|
||||
echo sqlsrv_get_field($stmt2, 0) . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
2147483647
|
||||
2147483647
|
||||
|
37
test/sqlsrv/datetime_inheritence.phpt
Normal file
37
test/sqlsrv/datetime_inheritence.phpt
Normal file
|
@ -0,0 +1,37 @@
|
|||
--TEST--
|
||||
DateTime Inheritence
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
require ('sqlsrv_test_base.inc');
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
class DateTime1 extends DateTime {
|
||||
}
|
||||
|
||||
class DateTime2 extends DateTime1 {
|
||||
}
|
||||
|
||||
class DateTimeExtended extends DateTime2 {
|
||||
}
|
||||
|
||||
$dt = new DateTimeExtended('2011-01-01');
|
||||
$dt->setTime(14,59,59);
|
||||
|
||||
$conn = Connect();
|
||||
|
||||
$stmt = sqlsrv_query($conn, "Select ?", array(array($dt)));
|
||||
$errors = sqlsrv_errors();
|
||||
print_r($errors);
|
||||
|
||||
echo "Test Succeeded";
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
|
||||
Test Succeeded
|
313
test/sqlsrv/fix_test_168256-2.phpt
Normal file
313
test/sqlsrv/fix_test_168256-2.phpt
Normal file
|
@ -0,0 +1,313 @@
|
|||
--TEST--
|
||||
Fix for 168256.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
$connectionInfo = array( "Database"=>"test");
|
||||
if( !($conn = Connect()))
|
||||
{
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$tsql = "SELECT OrderQty, UnitPrice FROM [168256]";
|
||||
|
||||
// default fetch_array (both)
|
||||
$stmt = sqlsrv_query( $conn, $tsql);
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
$row = sqlsrv_fetch_array( $stmt );
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
// fetch array with numeric indices
|
||||
$stmt = sqlsrv_query( $conn, $tsql);
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC );
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
// fetch array with name indices
|
||||
$stmt = sqlsrv_query( $conn, $tsql);
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC );
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
// fetch array with both indices
|
||||
$stmt = sqlsrv_query( $conn, $tsql);
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
$row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_BOTH );
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 2
|
||||
[OrderQty] => 2
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 6
|
||||
[OrderQty] => 6
|
||||
[1] => 5.7000
|
||||
[UnitPrice] => 5.7000
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[1] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 2
|
||||
[1] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[1] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 6
|
||||
[1] => 5.7000
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 3
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 2
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 3
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 1
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[OrderQty] => 6
|
||||
[UnitPrice] => 5.7000
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 2
|
||||
[OrderQty] => 2
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 6
|
||||
[OrderQty] => 6
|
||||
[1] => 5.7000
|
||||
[UnitPrice] => 5.7000
|
||||
)
|
100
test/sqlsrv/fix_test_168256.phpt
Normal file
100
test/sqlsrv/fix_test_168256.phpt
Normal file
|
@ -0,0 +1,100 @@
|
|||
--TEST--
|
||||
Fix for 168256.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
if( !($conn = Connect()))
|
||||
{
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$tsql = "SELECT OrderQty, UnitPrice FROM [168256]";
|
||||
$stmt = sqlsrv_query( $conn, $tsql);
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
for($i = 0; $i < 10; $i++){
|
||||
$row = sqlsrv_fetch_array( $stmt);
|
||||
print_r($row);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2024.9940
|
||||
[UnitPrice] => 2024.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 2
|
||||
[OrderQty] => 2
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 2039.9940
|
||||
[UnitPrice] => 2039.9940
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 3
|
||||
[OrderQty] => 3
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 1
|
||||
[OrderQty] => 1
|
||||
[1] => 28.8404
|
||||
[UnitPrice] => 28.8404
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => 6
|
||||
[OrderQty] => 6
|
||||
[1] => 5.7000
|
||||
[UnitPrice] => 5.7000
|
||||
)
|
46
test/sqlsrv/fix_test_182741.phpt
Normal file
46
test/sqlsrv/fix_test_182741.phpt
Normal file
|
@ -0,0 +1,46 @@
|
|||
--TEST--
|
||||
fix for 182741.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('182741', 'U') IS NOT NULL DROP TABLE [182741]" );
|
||||
if( $stmt !== false )
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE [182741] ([int_type] int, [text_type] text, [ntext_type] ntext, [image_type] image)");
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO [182741] ([int_type], [text_type], [ntext_type], [image_type]) VALUES(?, ?, ?, ?)",
|
||||
array( 1, array( "Test Data", SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR)),
|
||||
array( "Test Data", SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR)),
|
||||
array( "Test Data", SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY))));
|
||||
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE [182741]" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
echo "Test succeeded.";
|
||||
?>
|
||||
--EXPECT--
|
||||
Test succeeded.
|
Loading…
Reference in a new issue