fixed some scripts and added more tests
This commit is contained in:
parent
9334bb3c84
commit
3e285ec07b
|
@ -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}
|
||||
|
|
|
@ -49,8 +49,12 @@ def readAndPrint(inputStr, file, path):
|
|||
def TestFilename(line):
|
||||
terminateChar = os.sep
|
||||
currentPos = 0
|
||||
firstpos = len(line) * -1
|
||||
while True:
|
||||
currentPos = currentPos - 1
|
||||
# if passed the first pos, stop
|
||||
if currentPos < firstpos
|
||||
break
|
||||
line[currentPos]
|
||||
if line[currentPos] == terminateChar:
|
||||
break
|
||||
|
|
290
test/sqlsrv/sqlsrv_2008_dataTypes.phpt
Normal file
290
test/sqlsrv/sqlsrv_2008_dataTypes.phpt
Normal file
|
@ -0,0 +1,290 @@
|
|||
--TEST--
|
||||
new SQL Server 2008 date types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
date_default_timezone_set( 'America/Los_Angeles' );
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_OFF );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
// For testing in Azure, can not switch databases
|
||||
$conn = Connect(array( 'ReturnDatesAsStrings' => true ));
|
||||
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
print_r( sqlsrv_client_info( $conn ));
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('2008_date_types', 'U') IS NOT NULL DROP TABLE [2008_date_types]" );
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE [2008_date_types] (id int, [c1_date] date, [c2_time] time, [c3_datetimeoffset] datetimeoffset, [c4_datetime2] datetime2)" );
|
||||
if( $stmt === false ) {
|
||||
FatalError("Create table failed");
|
||||
}
|
||||
|
||||
// insert new date time types as strings (this works now)
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO [2008_date_types] (id, [c1_date], [c2_time], [c3_datetimeoffset], [c4_datetime2])" .
|
||||
" VALUES (?, ?, ?, ?, ?)",
|
||||
array( rand(0,99999),
|
||||
array( strftime('%Y-%m-%d'), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'), SQLSRV_SQLTYPE_DATE ),
|
||||
array( strftime( '%H:%M:%S' ), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING( 'utf-8' ), SQLSRV_SQLTYPE_TIME ),
|
||||
array( date_format( date_create(), 'Y-m-d H:i:s.u P'), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'), SQLSRV_SQLTYPE_DATETIMEOFFSET ),
|
||||
array( date_format( date_create(), 'Y-m-d H:i:s.u'), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'), SQLSRV_SQLTYPE_DATETIME2 )));
|
||||
if( $stmt === false ) {
|
||||
|
||||
FatalError("Insert 1 failed");
|
||||
}
|
||||
// insert new date time types as DateTime objects (this works now)
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO [2008_date_types] (id, [c1_date], [c2_time], [c3_datetimeoffset], [c4_datetime2])" .
|
||||
" VALUES (?, ?, ?, ?, ?)",
|
||||
array( rand(0,99999),
|
||||
array( date_create(), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_DATETIME, SQLSRV_SQLTYPE_DATE ),
|
||||
array( date_create(), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_DATETIME, SQLSRV_SQLTYPE_TIME ),
|
||||
array( date_create(), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_DATETIME, SQLSRV_SQLTYPE_DATETIMEOFFSET ),
|
||||
array( date_create(), SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_DATETIME, SQLSRV_SQLTYPE_DATETIME2 )));
|
||||
if( $stmt === false ) {
|
||||
|
||||
FatalError("Insert 2 failed");
|
||||
}
|
||||
// insert new date time types as default DateTime objects with no type information (this works now)
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO [2008_date_types] (id, [c1_date], [c2_time], [c3_datetimeoffset], [c4_datetime2])" .
|
||||
" VALUES (?, ?, ?, ?, ?)",
|
||||
array( rand(0,99999), date_create(), date_create(), date_create(), date_create()));
|
||||
if( $stmt === false ) {
|
||||
FatalError("Insert 3 failed");
|
||||
}
|
||||
// insert new date time types as strings with no type information (this works)
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO [2008_date_types] (id, [c1_date], [c2_time], [c3_datetimeoffset], [c4_datetime2])" .
|
||||
" VALUES (?, ?, ?, ?, ?)",
|
||||
array( rand(0,99999), strftime('%Y-%m-%d'), strftime( '%H:%M:%S' ), date_format( date_create(), 'Y-m-d H:i:s.u P'), date_format( date_create(), 'Y-m-d H:i:s.u P')));
|
||||
if( $stmt === false ) {
|
||||
FatalError("Insert 4 failed");
|
||||
}
|
||||
|
||||
// retrieve date time fields as strings (this works)
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM [2008_date_types]" );
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
|
||||
for( $i = 0; $i < sqlsrv_num_fields( $stmt ); ++$i ) {
|
||||
$fld = sqlsrv_get_field( $stmt, $i, SQLSRV_PHPTYPE_STRING( SQLSRV_ENC_CHAR ));
|
||||
echo "field $i = $fld\n";
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve date time fields as default (should come back as DateTime objects) (this works now)
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM [2008_date_types]" );
|
||||
if( $stmt === false ) {
|
||||
FatalError("Select from table failed");
|
||||
}
|
||||
while( $row = sqlsrv_fetch_array( $stmt )) {
|
||||
var_dump( $row );
|
||||
}
|
||||
|
||||
// retrieve date itme fields as DateTime objects
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM [2008_date_types]" );
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
|
||||
for( $i = 1; $i < sqlsrv_num_fields( $stmt ); ++$i ) {
|
||||
$fld = sqlsrv_get_field( $stmt, $i, SQLSRV_PHPTYPE_DATETIME );
|
||||
$str = date_format( $fld, 'Y-m-d H:i:s.u P' );
|
||||
echo "field $i = $str\n";
|
||||
}
|
||||
}
|
||||
|
||||
print_r( sqlsrv_field_metadata( $stmt ));
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Array
|
||||
\(
|
||||
\[(DriverDllName|DriverName)\] => msodbcsql[0-9]{2}\.dll|libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]
|
||||
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
|
||||
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
|
||||
\[ExtensionVer\] => [0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)?
|
||||
\)
|
||||
field 0 = [0-9]{1,5}
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2}
|
||||
field 2 = [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 0 = [0-9]{1,5}
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2}
|
||||
field 2 = [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 0 = [0-9]{1,5}
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2}
|
||||
field 2 = [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 0 = [0-9]{1,5}
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2}
|
||||
field 2 = [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{7}
|
||||
array\(10\) {
|
||||
\[0\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\["id"\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\[1\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\["c1_date"\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\[2\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c2_time"\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\[3\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\["c3_datetimeoffset"\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\[4\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c4_datetime2"\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
}
|
||||
array\(10\) {
|
||||
\[0\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\["id"\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\[1\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\["c1_date"\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\[2\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c2_time"\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\[3\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\["c3_datetimeoffset"\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\[4\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c4_datetime2"\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
}
|
||||
array\(10\) {
|
||||
\[0\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\["id"\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\[1\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\["c1_date"\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\[2\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c2_time"\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\[3\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\["c3_datetimeoffset"\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\[4\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c4_datetime2"\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
}
|
||||
array\(10\) {
|
||||
\[0\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\["id"\]=>
|
||||
int\([0-9]{1,5}\)
|
||||
\[1\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\["c1_date"\]=>
|
||||
string\(10\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2}"
|
||||
\[2\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c2_time"\]=>
|
||||
string\(16\) "[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\[3\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\["c3_datetimeoffset"\]=>
|
||||
string\(34\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7} \-0[7-8]:00"
|
||||
\[4\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
\["c4_datetime2"\]=>
|
||||
string\(27\) "[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{7}"
|
||||
}
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 2 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 2 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 2 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 1 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 2 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 3 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
field 4 = [0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} \-0[7-8]:00
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[Name\] => id
|
||||
\[Type\] => 4
|
||||
\[Size\] =>
|
||||
\[Precision\] => 10
|
||||
\[Scale\] =>
|
||||
\[Nullable\] => 1
|
||||
\)
|
||||
|
||||
\[1\] => Array
|
||||
\(
|
||||
\[Name\] => c1_date
|
||||
\[Type\] => 91
|
||||
\[Size\] =>
|
||||
\[Precision\] => 10
|
||||
\[Scale\] => 0
|
||||
\[Nullable\] => 1
|
||||
\)
|
||||
|
||||
\[2\] => Array
|
||||
\(
|
||||
\[Name\] => c2_time
|
||||
\[Type\] => -154
|
||||
\[Size\] =>
|
||||
\[Precision\] => 16
|
||||
\[Scale\] => 7
|
||||
\[Nullable\] => 1
|
||||
\)
|
||||
|
||||
\[3\] => Array
|
||||
\(
|
||||
\[Name\] => c3_datetimeoffset
|
||||
\[Type\] => -155
|
||||
\[Size\] =>
|
||||
\[Precision\] => 34
|
||||
\[Scale\] => 7
|
||||
\[Nullable\] => 1
|
||||
\)
|
||||
|
||||
\[4\] => Array
|
||||
\(
|
||||
\[Name\] => c4_datetime2
|
||||
\[Type\] => 93
|
||||
\[Size\] =>
|
||||
\[Precision\] => 27
|
||||
\[Scale\] => 7
|
||||
\[Nullable\] => 1
|
||||
\)
|
||||
|
||||
\)
|
79
test/sqlsrv/sqlsrv_LOB.phpt
Normal file
79
test/sqlsrv/sqlsrv_LOB.phpt
Normal file
|
@ -0,0 +1,79 @@
|
|||
--TEST--
|
||||
LOB types as strings.
|
||||
--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( "Failed to connect." );
|
||||
}
|
||||
|
||||
sqlsrv_query($conn, "IF OBJECT_ID('PhpCustomerTable', 'U') IS NOT NULL DROP TABLE [PhpCustomerTable]" );
|
||||
sqlsrv_query($conn, "CREATE TABLE [PhpCustomerTable] ([Id] int NOT NULL Identity (100,2) PRIMARY KEY, [Field2] text, [Field3] image, [Field4] ntext, [Field5] varbinary(max), [Field6] varchar(max), [Field7] nvarchar(max))" );
|
||||
sqlsrv_query($conn, "INSERT [PhpCustomerTable] ([Field2], [Field3], [Field4], [Field5], [Field6], [Field7]) VALUES ('This is field 2.', 0x010203, 'This is field 4.', 0x040506, 'This is field 6.', 'This is field 7.' )" );
|
||||
$stmt = sqlsrv_query($conn, "SELECT * FROM [PhpCustomerTable]");
|
||||
sqlsrv_fetch( $stmt );
|
||||
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get text field' );
|
||||
else {
|
||||
echo "$v<br/>\n";
|
||||
}
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get text field' );
|
||||
|
||||
echo "$v<br/>\n";
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
die( 'Failed to get image field]' );
|
||||
echo "$v<br/>\n";
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get ntext field' );
|
||||
|
||||
echo "$v<br/>\n";
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 4, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get varbinary(max) field' );
|
||||
|
||||
echo "$v<br/>\n";
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 5, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get varchar(max) field' );
|
||||
|
||||
echo "$v<br/>\n";
|
||||
|
||||
$v = sqlsrv_get_field( $stmt, 6, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$v)
|
||||
print( 'Failed to get nvarchar(max) field' );
|
||||
|
||||
echo "$v<br/>\n";
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
echo "Test successful."
|
||||
?>
|
||||
--EXPECT--
|
||||
100<br/>
|
||||
This is field 2.<br/>
|
||||
010203<br/>
|
||||
This is field 4.<br/>
|
||||
040506<br/>
|
||||
This is field 6.<br/>
|
||||
This is field 7.<br/>
|
||||
Test successful.
|
251
test/sqlsrv/sqlsrv_bind_output_param.phpt
Normal file
251
test/sqlsrv/sqlsrv_bind_output_param.phpt
Normal file
|
@ -0,0 +1,251 @@
|
|||
--TEST--
|
||||
PHP - test bind output parameters with various data types
|
||||
--DESCRIPTION--
|
||||
This test verifys binding output paramter for data types below except null, DateTime, or stream types which cannot be used as output parameters
|
||||
1: int
|
||||
2: tinyint
|
||||
3: smallint
|
||||
4: bigint
|
||||
5: bit
|
||||
6: float
|
||||
7: real
|
||||
8: decimal(28,4)
|
||||
9: numeric(32,4)
|
||||
10: money
|
||||
11: smallmoney
|
||||
12: char(512)
|
||||
13: varchar(512)
|
||||
14: varchar(max)
|
||||
15: nchar(512)
|
||||
16: nvarchar(512)
|
||||
17: nvarchar(max)
|
||||
18: text
|
||||
19: ntext
|
||||
20: binary(512)
|
||||
21: varbinary(512)
|
||||
22: varbinary(max)
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'MsCommon.inc';
|
||||
|
||||
/**
|
||||
* main function called by repro to set up the test, iterate through the given datatypes and test the output param.
|
||||
* @param $minType first dataType
|
||||
* @param $maxType last dataType
|
||||
*/
|
||||
function main($minType, $maxType)
|
||||
{
|
||||
$testName = "BindParam - OutputParam";
|
||||
$tableName = "test_Datatypes_Output";
|
||||
$columnNames = array( "c1","c2" );
|
||||
StartTest($testName);
|
||||
|
||||
Setup();
|
||||
$conn = Connect();
|
||||
|
||||
for ($k = $minType; $k <= $maxType; $k++)
|
||||
{
|
||||
if ($k == 18 || $k == 19)
|
||||
{
|
||||
// skip text and ntext types; not supported as output params
|
||||
continue;
|
||||
}
|
||||
$sqlType = GetSqlType($k);
|
||||
// for each data type create a table with two columns, 1: dataType id 2: data type
|
||||
$dataType = "[$columnNames[0]] int, [$columnNames[1]] $sqlType";
|
||||
CreateTableEx($conn, $tableName, $dataType);
|
||||
|
||||
// data to populate the table, false since we don't want to initialize a variable using this data.
|
||||
$data = GetData($k, false);
|
||||
|
||||
TraceData($sqlType, $data);
|
||||
$dataValues = array($k, $data);
|
||||
|
||||
InsertRowNoOption( $conn, $tableName, $columnNames, $dataValues );
|
||||
|
||||
ExecProc($conn, $tableName, $columnNames, $k, $data, $sqlType);
|
||||
}
|
||||
|
||||
DropTable($conn, $tableName, $k);
|
||||
|
||||
sqlsrv_close($conn);
|
||||
|
||||
EndTest($testName);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates and executes store procedure for the given data type.
|
||||
* @param $conn
|
||||
* @param $tableName
|
||||
* @param $columnNames and array containig the column names
|
||||
* @param $k datatype id
|
||||
* @param $data is used to get the SQLSRV_PHPTYPE_*
|
||||
* @param $sqlType the same datatype used to create the table with
|
||||
*/
|
||||
function ExecProc($conn, $tableName, $columnNames, $k, $data, $sqlType)
|
||||
{
|
||||
$phpDriverType = GetDriverType($k, strlen($data));
|
||||
|
||||
$spArgs = "@p1 int, @p2 $sqlType OUTPUT";
|
||||
|
||||
$spCode = "SET @p2 = ( SELECT c2 FROM $tableName WHERE c1 = @p1 )";
|
||||
|
||||
$procName = "testBindOutSp";
|
||||
CreateProc( $conn, $procName, $spArgs, $spCode );
|
||||
|
||||
$callArgs = "?, ?";
|
||||
//get data to initialize $callResult variable, this variable should be different than inserted data in the table
|
||||
$initData = GetData( $k , true);
|
||||
$callResult = $initData;
|
||||
|
||||
$params = array( array( $k, SQLSRV_PARAM_IN ),
|
||||
array( &$callResult, SQLSRV_PARAM_OUT, null, $phpDriverType ));
|
||||
|
||||
CallProc($conn, $procName, $callArgs, $params);
|
||||
// check if it is updated
|
||||
if( $callResult === $initData ){
|
||||
die("the result should be different");
|
||||
}
|
||||
DropProc($conn, $procName);
|
||||
}
|
||||
|
||||
/**
|
||||
* insert the data in the given table and columns without any option for data.
|
||||
* @param $conn
|
||||
* @param $tableName
|
||||
* @param $columnNames array containig the column names
|
||||
* @param $dataValues array of values to be insetred in the table
|
||||
*/
|
||||
function InsertRowNoOption( $conn, $tableName, $columnNames, $dataValues )
|
||||
{
|
||||
$tsql = "INSERT INTO [$tableName] ($columnNames[0], $columnNames[1]) VALUES (?, ?)";
|
||||
$stmt = sqlsrv_query( $conn, $tsql, $dataValues );
|
||||
if( false === $stmt ){
|
||||
print_r( sqlsrv_errors() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a data value by its datatype id
|
||||
* @param $k data type id, this id of each datatype are the same as the one in the MsCommon.inc file
|
||||
* @param $initData boolean parameter, if true it means the returned data value is used to initialize a variable.
|
||||
*/
|
||||
function GetData( $k , $initData)
|
||||
{
|
||||
if(false == $initData)
|
||||
{
|
||||
switch ($k)
|
||||
{
|
||||
case 1: // int
|
||||
return(123456789);
|
||||
|
||||
case 2: // tinyint
|
||||
return(234);
|
||||
|
||||
case 3: // smallint
|
||||
return(5678);
|
||||
|
||||
case 4: // bigint
|
||||
return(123456789987654321);
|
||||
|
||||
case 5: // bit
|
||||
return (1);
|
||||
|
||||
case 6: // float
|
||||
return (123.456);
|
||||
|
||||
case 7: // real
|
||||
return (789.012);
|
||||
|
||||
case 8: // decimal(28,4)
|
||||
case 9: // numeric(32,4)
|
||||
case 10: // money
|
||||
case 11: // smallmoney
|
||||
return(987.0123);
|
||||
|
||||
case 12: // char(512)
|
||||
case 13: // varchar(512)
|
||||
case 14: // varchar(max)
|
||||
case 15: // nchar(512)
|
||||
case 16: // nvarchar(512)
|
||||
case 17: // nvarchar(max)
|
||||
case 18: // text
|
||||
case 19: // ntext - deprecated
|
||||
return("HelloWorld");
|
||||
|
||||
case 20: // binary(512)
|
||||
case 21: // varbinary(512)
|
||||
case 22: // varbinary(max)
|
||||
return(0x0001e240); //123456
|
||||
default:
|
||||
return(null);
|
||||
} // switch
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($k)
|
||||
{
|
||||
case 1: // int
|
||||
case 2: // tinyint
|
||||
case 3: // smallint
|
||||
case 4: // bigint
|
||||
case 5: // bit
|
||||
return (0);
|
||||
|
||||
case 6: // float
|
||||
case 7: // real
|
||||
case 8: // decimal(28,4)
|
||||
case 9: // numeric(32,4)
|
||||
case 10: // money
|
||||
case 11: // smallmoney
|
||||
return(00.00);
|
||||
|
||||
case 12: // char(512)
|
||||
case 13: // varchar(512)
|
||||
case 14: // varchar(max)
|
||||
case 15: // nchar(512)
|
||||
case 16: // nvarchar(512)
|
||||
case 17: // nvarchar(max)
|
||||
case 18: // text
|
||||
case 19: // ntext
|
||||
return("default");
|
||||
|
||||
case 20: // binary(512)
|
||||
case 21: // varbinary(512)
|
||||
case 22: // varbinary(max)
|
||||
return(0x0);
|
||||
|
||||
default:
|
||||
return(null);
|
||||
} // switch
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Repro
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
function Repro()
|
||||
{
|
||||
try
|
||||
{
|
||||
main(1, 22);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
Repro();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
|
||||
Test "BindParam - OutputParam" completed successfully.
|
|
@ -1,46 +1,46 @@
|
|||
--TEST--
|
||||
Verify the Binary and Char encoding output when binding output string with SQLSTYPE option with different size.
|
||||
--DESCRIPTION--
|
||||
Tests different sizes of output string which may cause ODBC to return trunc error info.
|
||||
With unixODBC 2.3.4, when connection pooling is enabled, error information maybe returned differently
|
||||
than older versions (or with pooling disabled).
|
||||
The NVARCHAR(1) section would cause an ODBC call to return an errorinfo to the driver causing the statement to fail.
|
||||
With unixODBC 2.3.4 + pooling the statement executes without error.
|
||||
Verify the Binary and Char encoding output when binding output string with SQLSTYPE option with different size
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
|
||||
<?php
|
||||
require_once("MsCommon.inc");
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
$conn = Connect();
|
||||
if( $conn === false ) {
|
||||
if( $conn === false )
|
||||
{
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('BindStringTest', 'U') IS NOT NULL DROP TABLE BindStringTest" );
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('uspPerson', 'P') IS NOT NULL DROP PROCEDURE uspPerson");
|
||||
if( $stmt === false )
|
||||
{
|
||||
echo "Error in executing statement 1.\n";
|
||||
die( print_r( sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$bindtable = "#BindStringTest";
|
||||
$sproc = "#uspPerson";
|
||||
|
||||
// Create table
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE $bindtable (PersonID int, Name nvarchar(50))" );
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE BindStringTest (PersonID int, Name nvarchar(50))" );
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO $bindtable (PersonID, Name) VALUES (10, N'Miller')" );
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO BindStringTest (PersonID, Name) VALUES (10, N'Miller')" );
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO $bindtable (PersonID, Name) VALUES (11, N'JSmith')" );
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO BindStringTest (PersonID, Name) VALUES (11, N'JSmith')" );
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$tsql_createSP = "CREATE PROCEDURE $sproc
|
||||
$tsql_createSP = "CREATE PROCEDURE uspPerson
|
||||
@id int, @return nvarchar(50) OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SET @return = (SELECT Name FROM $bindtable WHERE PersonID = @id)
|
||||
SET @return = (SELECT Name FROM BindStringTest WHERE PersonID = @id)
|
||||
END";
|
||||
|
||||
$stmt = sqlsrv_query( $conn, $tsql_createSP);
|
||||
|
@ -50,7 +50,7 @@ if( $stmt === false )
|
|||
die( print_r( sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
$tsql_callSP = "{call $sproc( ? , ?)}";
|
||||
$tsql_callSP = "{call uspPerson( ? , ?)}";
|
||||
|
||||
|
||||
//***********************************************************************************************
|
||||
|
@ -157,7 +157,6 @@ $params = array(
|
|||
SQLSRV_SQLTYPE_NVARCHAR(1)
|
||||
));
|
||||
|
||||
// with unixODBC 2.3.4 connection pooling the statement may not fail.
|
||||
if( $stmt = sqlsrv_query($conn, $tsql_callSP, $params) === false)
|
||||
{
|
||||
echo "Statement should fail\n";
|
||||
|
@ -366,6 +365,9 @@ $actualValue = $return;
|
|||
$actualLength = strlen($return);
|
||||
compareResults ( $expectedLength, $expectedValue, $actualLength, $actualValue );
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE BindStringTest" );
|
||||
sqlsrv_query( $conn, "DROP PROCEDURE uspPerson");
|
||||
|
||||
sqlsrv_close($conn);
|
||||
|
||||
$status = true;
|
||||
|
|
243
test/sqlsrv/sqlsrv_buffered.phpt
Normal file
243
test/sqlsrv/sqlsrv_buffered.phpt
Normal file
|
@ -0,0 +1,243 @@
|
|||
--TEST--
|
||||
Read, Update, Insert from a SQLSRV stream with buffered query
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$query = "IF OBJECT_ID('PhpCustomerTable', 'U') IS NOT NULL DROP TABLE [PhpCustomerTable]";
|
||||
$stmt = sqlsrv_prepare( $conn, $query, array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
|
||||
$query = "CREATE TABLE [PhpCustomerTable] ([Id] int NOT NULL Identity (100,2) PRIMARY KEY, [Field2] text, [Field3] image, [Field4] ntext, [Field5] varbinary(max), [Field6] varchar(max), [Field7] nvarchar(max))";
|
||||
$stmt = sqlsrv_prepare( $conn, $query, array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
|
||||
$query = "INSERT [PhpCustomerTable] ([Field2], [Field3], [Field4], [Field5], [Field6], [Field7]) VALUES ('This is field 2.', 0x010203, 'This is field 4.', 0x040506, 'This is field 6.', 'This is field 7.' )";
|
||||
$stmt = sqlsrv_prepare( $conn, $query, array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
|
||||
$f2 = fopen('php://memory', 'a');
|
||||
fwrite($f2, 'Update field 2.');
|
||||
rewind($f2);
|
||||
$f3 = fopen('php://memory', 'a');
|
||||
fwrite($f3, 0x010204);
|
||||
rewind($f3);
|
||||
$f4 = fopen('php://memory', 'a');
|
||||
fwrite($f4, 'Update field 4.');
|
||||
rewind($f4);
|
||||
$f5 = fopen('php://memory', 'a');
|
||||
fwrite($f5, 0x040503);
|
||||
rewind($f5);
|
||||
$f6 = fopen('php://memory', 'a');
|
||||
fwrite($f6, 'Update field 6.');
|
||||
rewind($f6);
|
||||
$f7 = fopen('php://memory', 'a');
|
||||
fwrite($f7, 'Update field 7.');
|
||||
rewind($f7);
|
||||
|
||||
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field2]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f2, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_TEXT));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field3]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f3, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_IMAGE));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field4]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f4, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_NTEXT));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field5]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f5, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max')));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field6]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f6, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR('MAX')));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$query = "UPDATE [PhpCustomerTable] SET [Field7]=? WHERE [Field7]='This is field 7.'";
|
||||
$params = array(array(&$f7, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_NVARCHAR('MAX')));
|
||||
$stmt = sqlsrv_prepare( $conn, $query, $params, array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
|
||||
$stmt = sqlsrv_query($conn, "SELECT * FROM [PhpCustomerTable]", array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
|
||||
if(!$stmt)
|
||||
{
|
||||
echo "Statement could not be prepared.\n";
|
||||
die( print_r( sqlsrv_errors(),true));
|
||||
}
|
||||
sqlsrv_fetch( $stmt );
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get text field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$field = str_replace("\0","",$field);
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get text field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get image field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get ntext field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 4, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get varbinary(max) field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 5, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get varchar(max) field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 6, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
if(!$field)
|
||||
{
|
||||
print( "Failed to get nvarchar(max) field\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
print("$field\n");
|
||||
}
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE [PhpCustomerTable]" );
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
100
|
||||
Update field 2.
|
||||
3636303532
|
||||
Update field 4.
|
||||
323633343237
|
||||
Update field 6.
|
||||
Update field 7.
|
52
test/sqlsrv/sqlsrv_bug_boolean_cast.phpt
Normal file
52
test/sqlsrv/sqlsrv_bug_boolean_cast.phpt
Normal file
|
@ -0,0 +1,52 @@
|
|||
--TEST--
|
||||
Test reading boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that boolean parameters are read correctly and output
|
||||
1 or 0 as appropriate. The expected outputs consist of a true value as a bit,
|
||||
false as a bit, a true value cast to a bit, a true value as an int, true, false,
|
||||
and a true directly cast to a bit.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$tsql = <<<SQL
|
||||
DECLARE @bit_true bit = ?, @bit_false bit = ?, @bit_cast_true bit = CAST(? AS bit),
|
||||
@int_true int = ?
|
||||
SELECT 'bit_true'=@bit_true, 'bit_false'=@bit_false, 'bit_cast_true'=@bit_cast_true,
|
||||
'int_true'=@int_true, 'direct_true'=?, 'direct_false'=?,
|
||||
'direct_bit_cast_true'=CAST(? AS bit)
|
||||
SQL;
|
||||
$stmt = sqlsrv_query($conn,$tsql,[true,false,true,true,true,false,true]);
|
||||
$row = sqlsrv_fetch_object($stmt);
|
||||
|
||||
var_dump($row);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (7) {
|
||||
["bit_true"]=>
|
||||
int(1)
|
||||
["bit_false"]=>
|
||||
int(0)
|
||||
["bit_cast_true"]=>
|
||||
int(1)
|
||||
["int_true"]=>
|
||||
int(1)
|
||||
["direct_true"]=>
|
||||
int(1)
|
||||
["direct_false"]=>
|
||||
int(0)
|
||||
["direct_bit_cast_true"]=>
|
||||
int(1)
|
||||
}
|
52
test/sqlsrv/sqlsrv_bug_boolean_cast_in_bit.phpt
Normal file
52
test/sqlsrv/sqlsrv_bug_boolean_cast_in_bit.phpt
Normal file
|
@ -0,0 +1,52 @@
|
|||
--TEST--
|
||||
Test reading bit boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that bit boolean parameters are read correctly and output
|
||||
1 or 0 as appropriate. The expected outputs consist of a true value as a bit,
|
||||
false as a bit, a true value cast to a bit, a true value as an int, true, false,
|
||||
and a true directly cast to a bit.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$tsql = <<<SQL
|
||||
DECLARE @bit_true bit = ?, @bit_false bit = ?, @bit_cast_true bit = CAST(? AS bit),
|
||||
@int_true int = ?
|
||||
SELECT 'bit_true'=@bit_true, 'bit_false'=@bit_false, 'bit_cast_true'=@bit_cast_true,
|
||||
'int_true'=@int_true, 'direct_true'=?, 'direct_false'=?,
|
||||
'direct_bit_cast_true'=CAST(? AS bit)
|
||||
SQL;
|
||||
$stmt = sqlsrv_query($conn,$tsql,[1,0,1,1,1,0,1]);
|
||||
$row = sqlsrv_fetch_object($stmt);
|
||||
|
||||
var_dump($row);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (7) {
|
||||
["bit_true"]=>
|
||||
int(1)
|
||||
["bit_false"]=>
|
||||
int(0)
|
||||
["bit_cast_true"]=>
|
||||
int(1)
|
||||
["int_true"]=>
|
||||
int(1)
|
||||
["direct_true"]=>
|
||||
int(1)
|
||||
["direct_false"]=>
|
||||
int(0)
|
||||
["direct_bit_cast_true"]=>
|
||||
int(1)
|
||||
}
|
52
test/sqlsrv/sqlsrv_bug_boolean_cast_in_bool.phpt
Normal file
52
test/sqlsrv/sqlsrv_bug_boolean_cast_in_bool.phpt
Normal file
|
@ -0,0 +1,52 @@
|
|||
--TEST--
|
||||
Test reading boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that boolean parameters are read correctly and output
|
||||
1 or 0 as appropriate. The expected outputs consist of a true value as a bit,
|
||||
false as a bit, a true value cast to a bit, a true value as an int, true, false,
|
||||
and a true directly cast to a bit.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$tsql = <<<SQL
|
||||
DECLARE @bit_true bit = ?, @bit_false bit = ?, @bit_cast_true bit = CAST(? AS bit),
|
||||
@int_true int = ?
|
||||
SELECT 'bit_true'=@bit_true, 'bit_false'=@bit_false, 'bit_cast_true'=@bit_cast_true,
|
||||
'int_true'=@int_true, 'direct_true'=?, 'direct_false'=?,
|
||||
'direct_bit_cast_true'=CAST(? AS bit)
|
||||
SQL;
|
||||
$stmt = sqlsrv_query($conn,$tsql,[true,false,true,true,true,false,true]);
|
||||
$row = sqlsrv_fetch_object($stmt);
|
||||
|
||||
var_dump($row);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#1 (7) {
|
||||
["bit_true"]=>
|
||||
int(1)
|
||||
["bit_false"]=>
|
||||
int(0)
|
||||
["bit_cast_true"]=>
|
||||
int(1)
|
||||
["int_true"]=>
|
||||
int(1)
|
||||
["direct_true"]=>
|
||||
int(1)
|
||||
["direct_false"]=>
|
||||
int(0)
|
||||
["direct_bit_cast_true"]=>
|
||||
int(1)
|
||||
}
|
60
test/sqlsrv/sqlsrv_bug_boolean_cast_inout_bit.phpt
Normal file
60
test/sqlsrv/sqlsrv_bug_boolean_cast_inout_bit.phpt
Normal file
|
@ -0,0 +1,60 @@
|
|||
--TEST--
|
||||
Test inout bit boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that inout bit boolean parameters are read and set correctly and output
|
||||
1 or 0 as appropriate. The expected outputs consist of a true value as a bit,
|
||||
false as a bit, a true value cast to a bit, a true value as an int.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "IF OBJECT_ID('testBoolean', 'P') IS NOT NULL DROP PROCEDURE testBoolean");
|
||||
|
||||
$createSP = <<<SQL
|
||||
CREATE PROCEDURE testBoolean
|
||||
@bit_true bit OUTPUT, @bit_false bit OUTPUT, @bit_cast_true bit OUTPUT, @int_true bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @bit_true = ~ @bit_true;
|
||||
SET @bit_false = ~ @bit_false;
|
||||
SET @bit_cast_true = CAST(~ @bit_cast_true AS bit);
|
||||
SET @int_true = ~ @int_true;
|
||||
END
|
||||
SQL;
|
||||
|
||||
$stmt = sqlsrv_query($conn, $createSP);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$callSP = "{call testBoolean(?, ?, ?, ?)}";
|
||||
|
||||
$bit_true = 0;
|
||||
$bit_false = 1;
|
||||
$bit_cast_true = 0;
|
||||
$int_true = 0;
|
||||
$params = array(array(&$bit_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$bit_false, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$bit_cast_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$int_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT));
|
||||
|
||||
$stmt = sqlsrv_query($conn, $callSP, $params);
|
||||
|
||||
var_dump($bit_true);
|
||||
var_dump($bit_false);
|
||||
var_dump($bit_cast_true);
|
||||
var_dump($int_true);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(0)
|
||||
int(1)
|
||||
int(1)
|
60
test/sqlsrv/sqlsrv_bug_boolean_cast_inout_bool.phpt
Normal file
60
test/sqlsrv/sqlsrv_bug_boolean_cast_inout_bool.phpt
Normal file
|
@ -0,0 +1,60 @@
|
|||
--TEST--
|
||||
Test inout boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that inout boolean parameters are read and set correctly and output
|
||||
true or false as appropriate. The expected outputs consist of a true value as a bool,
|
||||
false as a bool, a true value cast to a bool, a true value as an bool.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "IF OBJECT_ID('testBoolean', 'P') IS NOT NULL DROP PROCEDURE testBoolean");
|
||||
|
||||
$createSP = <<<SQL
|
||||
CREATE PROCEDURE testBoolean
|
||||
@bit_true bit OUTPUT, @bit_false bit OUTPUT, @bit_cast_true bit OUTPUT, @int_true bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @bit_true = ~ @bit_true;
|
||||
SET @bit_false = ~ @bit_false;
|
||||
SET @bit_cast_true = CAST(~ @bit_cast_true AS bit);
|
||||
SET @int_true = ~ @int_true;
|
||||
END
|
||||
SQL;
|
||||
|
||||
$stmt = sqlsrv_query($conn, $createSP);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$callSP = "{call testBoolean(?, ?, ?, ?)}";
|
||||
|
||||
$bit_true = false;
|
||||
$bit_false = true;
|
||||
$bit_cast_true = false;
|
||||
$int_true = false;
|
||||
$params = array(array(&$bit_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$bit_false, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$bit_cast_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT), array(&$int_true, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT));
|
||||
|
||||
$stmt = sqlsrv_query($conn, $callSP, $params);
|
||||
|
||||
var_dump($bit_true);
|
||||
var_dump($bit_false);
|
||||
var_dump($bit_cast_true);
|
||||
var_dump($int_true);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
62
test/sqlsrv/sqlsrv_bug_boolean_cast_out_bit.phpt
Normal file
62
test/sqlsrv/sqlsrv_bug_boolean_cast_out_bit.phpt
Normal file
|
@ -0,0 +1,62 @@
|
|||
--TEST--
|
||||
Test output bit boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that output bit boolean parameters are read and set correctly and output
|
||||
1 or 0 as appropriate. The expected outputs consist of a true value as a bit,
|
||||
false as a bit, a true value cast to a bit, a true value as an int.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Fails on PHP 7, producing 1's and 2's instead of 0's and 1's. */
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "IF OBJECT_ID('testBoolean', 'P') IS NOT NULL DROP PROCEDURE testBoolean");
|
||||
|
||||
$createSP = <<<SQL
|
||||
CREATE PROCEDURE testBoolean
|
||||
@bit_true bit OUTPUT, @bit_false bit OUTPUT, @bit_cast_true bit OUTPUT, @int_true bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @bit_true = 1;
|
||||
SET @bit_false = 0;
|
||||
SET @bit_cast_true = CAST(1 AS bit);
|
||||
SET @int_true = 1;
|
||||
END
|
||||
SQL;
|
||||
|
||||
$stmt = sqlsrv_query($conn, $createSP);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$callSP = "{call testBoolean(?, ?, ?, ?)}";
|
||||
|
||||
$bit_true = 0;
|
||||
$bit_false = 0;
|
||||
$bit_cast_true = 0;
|
||||
$int_true = 0;
|
||||
$params = array(array(&$bit_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$bit_false, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$bit_cast_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$int_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT));
|
||||
|
||||
$stmt = sqlsrv_query($conn, $callSP, $params);
|
||||
|
||||
var_dump($bit_true);
|
||||
var_dump($bit_false);
|
||||
var_dump($bit_cast_true);
|
||||
var_dump($int_true);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(0)
|
||||
int(1)
|
||||
int(1)
|
62
test/sqlsrv/sqlsrv_bug_boolean_cast_out_bool.phpt
Normal file
62
test/sqlsrv/sqlsrv_bug_boolean_cast_out_bool.phpt
Normal file
|
@ -0,0 +1,62 @@
|
|||
--TEST--
|
||||
Test output boolean parameters and casts to boolean types.
|
||||
--DESCRIPTION--
|
||||
This test verifies that output boolean parameters are read and set correctly and output
|
||||
true or false as appropriate. The expected outputs consist of a true value as a bool,
|
||||
false as a bool, a true value cast to a bool, a true value as an bool.
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Fails on PHP 7, producing 1's and 2's instead of 0's and 1's. */
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "IF OBJECT_ID('testBoolean', 'P') IS NOT NULL DROP PROCEDURE testBoolean");
|
||||
|
||||
$createSP = <<<SQL
|
||||
CREATE PROCEDURE testBoolean
|
||||
@bit_true bit OUTPUT, @bit_false bit OUTPUT, @bit_cast_true bit OUTPUT, @int_true bit OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @bit_true = 'true';
|
||||
SET @bit_false = 'false';
|
||||
SET @bit_cast_true = CAST('true' AS bit);
|
||||
SET @int_true = 'true';
|
||||
END
|
||||
SQL;
|
||||
|
||||
$stmt = sqlsrv_query($conn, $createSP);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$callSP = "{call testBoolean(?, ?, ?, ?)}";
|
||||
|
||||
$bit_true = false;
|
||||
$bit_false = false;
|
||||
$bit_cast_true = false;
|
||||
$int_true = false;
|
||||
$params = array(array(&$bit_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$bit_false, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$bit_cast_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT), array(&$int_true, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT));
|
||||
|
||||
$stmt = sqlsrv_query($conn, $callSP, $params);
|
||||
|
||||
var_dump($bit_true);
|
||||
var_dump($bit_false);
|
||||
var_dump($bit_cast_true);
|
||||
var_dump($int_true);
|
||||
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
31
test/sqlsrv/sqlsrv_clientinfo.phpt
Normal file
31
test/sqlsrv/sqlsrv_clientinfo.phpt
Normal file
|
@ -0,0 +1,31 @@
|
|||
--TEST--
|
||||
Verify sqlsrv_client_info
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_OFF );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$client_info = sqlsrv_client_info( $conn );
|
||||
var_dump( $client_info );
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
array\(4\) {
|
||||
\[\"(DriverDllName|DriverName)\"\]=>
|
||||
(string\(15\) \"msodbcsql1[1-9].dll\"|string\(24\) \"libmsodbcsql-[1-9]{2}.0.so.1.0\")
|
||||
\[\"DriverODBCVer\"\]=>
|
||||
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
|
||||
\[\"DriverVer\"\]=>
|
||||
string\(10\) \"[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}\"
|
||||
\[\"ExtensionVer\"\]=>
|
||||
string\([0-9]+\) \"[0-9]\.[0-9]\.[0-9](\-((rc)|(preview))(\.[0-9]+)?)?(\+[0-9]+)?\"
|
||||
}
|
53
test/sqlsrv/sqlsrv_close.phpt
Normal file
53
test/sqlsrv/sqlsrv_close.phpt
Normal file
File diff suppressed because one or more lines are too long
37
test/sqlsrv/sqlsrv_commit.phpt
Normal file
37
test/sqlsrv/sqlsrv_commit.phpt
Normal file
|
@ -0,0 +1,37 @@
|
|||
--TEST--
|
||||
Test sqlsrv_commit method.
|
||||
--SKIPIF--
|
||||
<?php require_once ('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError("Could not connect");
|
||||
}
|
||||
|
||||
$stmt1 = sqlsrv_query( $conn, "IF OBJECT_ID('Products', 'U') IS NOT NULL DROP TABLE Products" );
|
||||
$stmt1 = sqlsrv_query( $conn, "CREATE TABLE Products (ProductID int PRIMARY KEY, ProductName nvarchar(40), CategoryID int, UnitPrice money)" );
|
||||
if( $stmt1 === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
sqlsrv_free_stmt($stmt1);
|
||||
|
||||
$stmt2 = sqlsrv_query( $conn, "INSERT INTO Products (ProductID, ProductName, CategoryID, UnitPrice) VALUES (1, 'TestProduct2', 2, '13.55')" );
|
||||
$stmt3 = sqlsrv_query( $conn, "SELECT * FROM Products WHERE CategoryID = 2" );
|
||||
|
||||
if ( $stmt2 && $stmt3 )
|
||||
{
|
||||
sqlsrv_commit( $conn );
|
||||
echo "Commit successful";
|
||||
}
|
||||
|
||||
$stmt1 = sqlsrv_query( $conn, "DROP TABLE Products" );
|
||||
sqlsrv_free_stmt($stmt1);
|
||||
sqlsrv_free_stmt($stmt2);
|
||||
sqlsrv_free_stmt($stmt3);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Commit successful
|
170
test/sqlsrv/sqlsrv_configure.phpt
Normal file
170
test/sqlsrv/sqlsrv_configure.phpt
Normal file
|
@ -0,0 +1,170 @@
|
|||
--TEST--
|
||||
sqlsrv_configure.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
// test negative cases first
|
||||
// must have two parameters
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors" );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(1) should have failed." );
|
||||
}
|
||||
|
||||
// warnings_return_as_errors the only supported option
|
||||
$result = sqlsrv_configure( "blahblahblah", 1 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(2) should have failed." );
|
||||
}
|
||||
else {
|
||||
print_r( sqlsrv_errors() );
|
||||
}
|
||||
|
||||
$result = sqlsrv_get_config( 'blahblahblah' );
|
||||
if( !$result && !sqlsrv_errors() ) {
|
||||
FatalError( "sqlsrv_get_config should have failed." );
|
||||
}
|
||||
else {
|
||||
print_r( sqlsrv_errors() );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", True );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(3) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", False );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(4) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", 1 );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(5) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", 0 );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(6) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", null );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(7) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", "1" );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(8) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", "0" );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(9) should have passed" );
|
||||
}
|
||||
|
||||
// test values for LogSystem and LogSeverity
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ALL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(10) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", 0 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(11) should not have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ERROR );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(12) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_WARNING );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(13) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_NOTICE );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(14) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", 1000 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(15) should not have passed." );
|
||||
}
|
||||
|
||||
sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_ALL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(16) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_OFF );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(17) should not have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_INIT );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(18) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_CONN );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(19) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_STMT );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(20) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_UTIL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(21) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", 1000 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(22) should not have passed." );
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Warning: sqlsrv_configure\(\) expects exactly 2 parameters, 1 given in .+(\/|\\)sqlsrv_configure\.php on line [0-9]+
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -14
|
||||
\[code\] => -14
|
||||
\[2\] => An invalid parameter was passed to sqlsrv_configure.
|
||||
\[message\] => An invalid parameter was passed to sqlsrv_configure.
|
||||
\)
|
||||
|
||||
\)
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -14
|
||||
\[code\] => -14
|
||||
\[2\] => An invalid parameter was passed to sqlsrv_get_config.
|
||||
\[message\] => An invalid parameter was passed to sqlsrv_get_config.
|
||||
\)
|
||||
|
||||
\)
|
||||
sqlsrv.LogSubsystems = -1
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSubsystems = 8
|
||||
sqlsrv_configure: entering
|
151
test/sqlsrv/sqlsrv_configure_logs_only.phpt
Normal file
151
test/sqlsrv/sqlsrv_configure_logs_only.phpt
Normal file
|
@ -0,0 +1,151 @@
|
|||
--TEST--
|
||||
sqlsrv_configure to test logs.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", True );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(3) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", False );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(4) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", 1 );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(5) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", 0 );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(6) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", null );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(7) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", "1" );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == false ) {
|
||||
FatalError( "sqlsrv_configure(8) should have passed" );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "WarningsReturnAsErrors", "0" );
|
||||
if( !$result || sqlsrv_get_config( "WarningsReturnAsErrors" ) == true ) {
|
||||
FatalError( "sqlsrv_configure(9) should have passed" );
|
||||
}
|
||||
|
||||
// test values for LogSystem and LogSeverity
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ALL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(10) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", 0 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(11) should not have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ERROR );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(12) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_WARNING );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(13) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_NOTICE );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(14) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSeverity", 1000 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(15) should not have passed." );
|
||||
}
|
||||
|
||||
sqlsrv_configure( "LogSeverity", SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_ALL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(16) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_OFF );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(17) should not have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_INIT );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(18) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_CONN );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(19) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_STMT );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(20) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", SQLSRV_LOG_SYSTEM_UTIL );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_configure(21) should have passed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_configure( "LogSubsystems", 1000 );
|
||||
if( $result ) {
|
||||
FatalError( "sqlsrv_configure(22) should not have passed." );
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
sqlsrv.LogSubsystems = -1
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = On
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = Off
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = On
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = Off
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = Off
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = On
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.WarningsReturnAsErrors = Off
|
||||
sqlsrv_get_config: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSeverity = -1
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSeverity = 4
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSeverity = -1
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSubsystems = -1
|
||||
sqlsrv_configure: entering
|
||||
sqlsrv.LogSubsystems = 8
|
||||
sqlsrv_configure: entering
|
165
test/sqlsrv/sqlsrv_connStr.phpt
Normal file
165
test/sqlsrv/sqlsrv_connStr.phpt
Normal file
|
@ -0,0 +1,165 @@
|
|||
--TEST--
|
||||
UTF-8 connection strings
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
//require( 'MsSetup.inc' );
|
||||
//require ('connect.inc');
|
||||
|
||||
function connect($options=array()) {
|
||||
require 'MsSetup.inc';
|
||||
if (!isset($options['UID']) && !isset($options['uid'])) {
|
||||
$options['uid'] = $uid;
|
||||
}
|
||||
if (!isset($options['pwd']) && !isset($options['PWD'])) {
|
||||
$options['pwd'] = $pwd;
|
||||
}
|
||||
if (!isset($options['Database'])) {
|
||||
$options['database'] = $databaseName;
|
||||
}
|
||||
return sqlsrv_connect($server, $options);
|
||||
}
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
// test an invalid encoding
|
||||
$c = connect(array( 'CharacterSet' => 'jibberish' ));
|
||||
if( $c !== false ) {
|
||||
FatalError( "Should have errored on an invalid encoding." );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
$c = Connect(array( 'CharacterSet' => SQLSRV_ENC_BINARY ));
|
||||
if( $c !== false ) {
|
||||
FatalError( "Should have errored on an invalid encoding." );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
$c = Connect(array( 'CharacterSet' => SQLSRV_ENC_CHAR ));
|
||||
if( $c === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
sqlsrv_close( $c );
|
||||
|
||||
// test an invalid server name in UTF-8
|
||||
$server_invalid = pack( "H*", "ffc0" );
|
||||
$c = sqlsrv_connect( $server_invalid, array( 'Database' => 'test', 'CharacterSet' => 'utf-8' ));
|
||||
if( $c !== false ) {
|
||||
FatalError( "sqlsrv_connect(1) should have failed" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
// APP has a UTF-8 name
|
||||
$c = Connect(array(
|
||||
'App' => pack( 'H*', 'c59ec6a1d0bcc49720c59bc3a4e1839dd180c580e1bb8120ce86c59ac488c4a8c4b02dc5a5e284aec397c5a7' ),
|
||||
'CharacterSet' => 'utf-8' ));
|
||||
if( $c === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$c = Connect(array(
|
||||
'UID' => pack( 'H*', 'c59ec6a1d0bcc49720c59bc3a4e1839dd180c580e1bb8120ce86c59ac488c4a8c4b02dc5a5e284aec397c5a7' ),
|
||||
'PWD' => pack( 'H*', 'c59ec6a1d0bcc49720c59bc3a4e1839dd180c580e1bb8120ce86c59ac488c4a8c4b02dc5a5e284aec397c5a7' ),
|
||||
'CharacterSet' => 'utf-8' ));
|
||||
if( $c !== false ) {
|
||||
FatalError( "sqlsrv_connect(3) should have failed" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
// invalid UTF-8 in the pwd
|
||||
$c = Connect(array(
|
||||
'UID' => pack( 'H*', 'c59ec6a1d0bcc49720c59bc3a4e1839dd180c580e1bb8120ce86c59ac488c4a8c4b02dc5a5e284aec397c5a7' ),
|
||||
'PWD' => pack( 'H*', 'c59ec6c0d0bcc49720c59bc3a4e1839dd180c580e1bb8120ce86c59ac488c4a8c4b02dc5a5e284aec397c5a7' ),
|
||||
'CharacterSet' => 'utf-8' ));
|
||||
if( $c !== false ) {
|
||||
FatalError( "sqlsrv_connect(4) should have failed" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
echo "Test succeeded.\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -48
|
||||
[code] => -48
|
||||
[2] => The encoding 'jibberish' is not a supported encoding for the CharacterSet connection option.
|
||||
[message] => The encoding 'jibberish' is not a supported encoding for the CharacterSet connection option.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -48
|
||||
[code] => -48
|
||||
[2] => The encoding 'binary' is not a supported encoding for the CharacterSet connection option.
|
||||
[message] => The encoding 'binary' is not a supported encoding for the CharacterSet connection option.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -47
|
||||
[code] => -47
|
||||
[2] => An error occurred translating the connection string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.
|
||||
|
||||
[message] => An error occurred translating the connection string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => 28000
|
||||
[SQLSTATE] => 28000
|
||||
[1] => 18456
|
||||
[code] => 18456
|
||||
[2] => %SLogin failed for user '%s'.
|
||||
[message] => %SLogin failed for user '%s'.
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[0] => 28000
|
||||
[SQLSTATE] => 28000
|
||||
[1] => 18456
|
||||
[code] => 18456
|
||||
[2] => %SLogin failed for user '%s'.
|
||||
[message] => %SLogin failed for user '%s'.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -47
|
||||
[code] => -47
|
||||
[2] => An error occurred translating the connection string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.
|
||||
|
||||
[message] => An error occurred translating the connection string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
Test succeeded.
|
36
test/sqlsrv/sqlsrv_connect.phpt
Normal file
36
test/sqlsrv/sqlsrv_connect.phpt
Normal file
|
@ -0,0 +1,36 @@
|
|||
--TEST--
|
||||
functions return FALSE for errors.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsSetup.inc' );
|
||||
|
||||
$conn = sqlsrv_connect( "_!@)(#" );
|
||||
if( $conn !== false ) {
|
||||
FatalError( "sqlsrv_connect should have returned false." );
|
||||
}
|
||||
|
||||
$conn = sqlsrv_connect( "_!@#$", array( "Driver" => "Danica Patrick" ));
|
||||
if( $conn !== false ) {
|
||||
FatalError( "sqlsrv_connect should have returned false." );
|
||||
}
|
||||
|
||||
$conn = sqlsrv_connect( $server, array( "uid" => $uid , "pwd" => $pwd ) );
|
||||
|
||||
if( $conn === false ) {
|
||||
FatalError( "sqlsrv_connect should have connected." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM some_bogus_table" );
|
||||
if( $stmt !== false ) {
|
||||
FatalError( "sqlsrv_query should have returned false." );
|
||||
}
|
||||
|
||||
echo "Test successful.\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Test successful.
|
68
test/sqlsrv/sqlsrv_data_to_str.phpt
Normal file
68
test/sqlsrv/sqlsrv_data_to_str.phpt
Normal file
|
@ -0,0 +1,68 @@
|
|||
--TEST--
|
||||
large types to strings of 1MB size.
|
||||
--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 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_connect failed." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM [test_streamable_types]" );
|
||||
if( $stmt == false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_query failed." );
|
||||
}
|
||||
|
||||
sqlsrv_fetch( $stmt );
|
||||
$str = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(1) failed." );
|
||||
}
|
||||
|
||||
$str = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024*2 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(2) failed." );
|
||||
}
|
||||
|
||||
$str = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(3) failed." );
|
||||
}
|
||||
|
||||
$str = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(4) failed." );
|
||||
}
|
||||
|
||||
$str = sqlsrv_get_field( $stmt, 4, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024*2 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(5) failed." );
|
||||
}
|
||||
|
||||
$str = sqlsrv_get_field( $stmt, 5, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY) );
|
||||
if( $str === false || strlen( $str ) != 1024*1024 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field(6) failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
echo "Test successful.\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Test successful.
|
190
test/sqlsrv/sqlsrv_errors.phpt
Normal file
190
test/sqlsrv/sqlsrv_errors.phpt
Normal file
|
@ -0,0 +1,190 @@
|
|||
--TEST--
|
||||
make sure errors are cleared for each new API call
|
||||
--DESCRIPTION--
|
||||
make sure errors are cleared for each new API call
|
||||
invalid parameters are reported via sqlsrv_errors, and
|
||||
sqlsrv_close returns true even if an error happens.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = sqlsrv_connect( "InvalidServerName", array( "Database" => "test" ));
|
||||
$result = sqlsrv_close($conn);
|
||||
$errors = sqlsrv_errors();
|
||||
if( $result !== false ) {
|
||||
die( "sqlsrv_close succeeded despite an invalid server name." );
|
||||
}
|
||||
print_r( $errors );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_create failed." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 2;
|
||||
$f3 = 13.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$result = sqlsrv_free_stmt( $stmt );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_free_stmt( $stmt );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_free_stmt( null );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_free_stmt( $conn );
|
||||
if( $result !== false ) {
|
||||
die( "sqlsrv_free_stmt shouldn't have freed the connection resource" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
$result = sqlsrv_free_stmt( 1 );
|
||||
if( $result !== false ) {
|
||||
die( "sqlsrv_free_stmt shouldn't have freed a 1" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
$result = sqlsrv_close( $conn );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_close( $conn );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_close( null );
|
||||
if( $result === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_close( 1 );
|
||||
if( $result !== false ) {
|
||||
die( "sqlsrv_close shouldn't have freed a 1" );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
echo "Test successful.\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: sqlsrv_close() expects parameter 1 to be resource, boolean given in %Ssqlsrv_errors.php on line %x
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -14
|
||||
[code] => -14
|
||||
[2] => An invalid parameter was passed to sqlsrv_close.
|
||||
[message] => An invalid parameter was passed to sqlsrv_close.
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
Warning: sqlsrv_free_stmt(): supplied resource is not a valid ss_sqlsrv_stmt resource in %Ssqlsrv_errors.php on line %x
|
||||
|
||||
Warning: sqlsrv_free_stmt() expects parameter 1 to be resource, null given in %Ssqlsrv_errors.php on line %x
|
||||
|
||||
Warning: sqlsrv_free_stmt(): supplied resource is not a valid ss_sqlsrv_stmt resource in %Ssqlsrv_errors.php on line %x
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -14
|
||||
[code] => -14
|
||||
[2] => An invalid parameter was passed to sqlsrv_free_stmt.
|
||||
[message] => An invalid parameter was passed to sqlsrv_free_stmt.
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
Warning: sqlsrv_free_stmt() expects parameter 1 to be resource, integer given in %Ssqlsrv_errors.php on line %x
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -14
|
||||
[code] => -14
|
||||
[2] => An invalid parameter was passed to sqlsrv_free_stmt.
|
||||
[message] => An invalid parameter was passed to sqlsrv_free_stmt.
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
Warning: sqlsrv_close(): supplied resource is not a valid ss_sqlsrv_conn resource in %Ssqlsrv_errors.php on line %x
|
||||
|
||||
Warning: sqlsrv_close() expects parameter 1 to be resource, null given in %Ssqlsrv_errors.php on line %x
|
||||
|
||||
Warning: sqlsrv_close() expects parameter 1 to be resource, integer given in %Ssqlsrv_errors.php on line %x
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -14
|
||||
[code] => -14
|
||||
[2] => An invalid parameter was passed to sqlsrv_close.
|
||||
[message] => An invalid parameter was passed to sqlsrv_close.
|
||||
)
|
||||
|
||||
)
|
||||
Test successful.
|
49
test/sqlsrv/sqlsrv_fetch_array_unicode_col_name.phpt
Normal file
49
test/sqlsrv/sqlsrv_fetch_array_unicode_col_name.phpt
Normal file
|
@ -0,0 +1,49 @@
|
|||
--TEST--
|
||||
Test for Fetch array with Unicode column names
|
||||
--SKIPIF--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
include 'MsCommon.inc';
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
include 'MsSetup.inc';
|
||||
Setup();
|
||||
$conn = ConnectUTF8();
|
||||
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
|
||||
// Column name
|
||||
$colName = "C1"; // WORKS
|
||||
$colName = "C1ÐÐ"; // FETCH RETURNS AN EMPTY OUTPUT
|
||||
// $colName = "星"; // FETCH RETURNS AN EMPTY OUTPUT
|
||||
|
||||
// Create table
|
||||
$sql = "CREATE TABLE $tableName ($colName VARCHAR(10))";
|
||||
sqlsrv_query($conn, $sql) ?: die( print_r(sqlsrv_errors(), true));
|
||||
|
||||
// Insert data
|
||||
$sql = "INSERT INTO ".$tableName." VALUES ('Paris')";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
|
||||
// Fetch data
|
||||
$query = "SELECT * FROM $tableName";
|
||||
$stmt = sqlsrv_query($conn, $query) ?: die( print_r(sqlsrv_errors(), true));
|
||||
|
||||
// Fetch
|
||||
$row = sqlsrv_fetch_array($stmt);
|
||||
echo $row[$colName]."\n";
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
// Close connection
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
sqlsrv_close($conn);
|
||||
print "Done";
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
Paris
|
||||
Done
|
314
test/sqlsrv/sqlsrv_fetch_object.phpt
Normal file
314
test/sqlsrv/sqlsrv_fetch_object.phpt
Normal file
|
@ -0,0 +1,314 @@
|
|||
--TEST--
|
||||
Test for fetch_object
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function __construct( $a, $b )
|
||||
{
|
||||
echo "Creating a foo with params $a & $b\n";
|
||||
}
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
}
|
||||
|
||||
class foo_noargs
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
} // end class foo_noargs
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( $conn === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 )); //,
|
||||
//~ array( SQLSRV_SQLTYPE_INTEGER, SQLSRV_SQLTYPE_CHAR(10), SQLSRV_SQLTYPE_DOUBLE, SQLSRV_SQLTYPE_VARBINARY(4000)));
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 2;
|
||||
$f3 = 13.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 3;
|
||||
$f3 = 14.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 4;
|
||||
$f3 = 15.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 5;
|
||||
$f3 = 16.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
|
||||
echo "Fetch a stdClass object (1)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo_noargs object (2)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo object (with constructor args) (3)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo", array( 2, 1 ) );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Just create a normal foo in the script\n";
|
||||
$next_obj = new foo( 1, 2 );
|
||||
print_r( $next_obj );
|
||||
|
||||
// this case prints out warnings for 7.0.x but not passing enough argument
|
||||
// results in a fatal error for 7.1.x
|
||||
echo "With no constructor arguments (4)\n";
|
||||
try {
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
catch (Error $e)
|
||||
{
|
||||
echo "Caught error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
// the case with args to an object that doesn't take them
|
||||
echo "Non args constructor with args (5)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs", array( 1, 2 ));
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// the end of result set case
|
||||
echo "At the end of the result set (6)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// past the end of result set case
|
||||
echo "Past the end of the result set (7)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Fetch a stdClass object \(1\)
|
||||
stdClass Object
|
||||
\(
|
||||
\[id\] => 1
|
||||
\[double\] => 12
|
||||
\[name\] => testtestte
|
||||
\[stuff\] => This is some text meant to test binding parameters to streams
|
||||
\)
|
||||
Fetch a foo_noargs object \(2\)
|
||||
Doing foo\. -2 2 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 2
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[double\] => 13
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
Fetch a foo object \(with constructor args\) \(3\)
|
||||
Creating a foo with params 2 & 1
|
||||
Doing foo\. -2 3 This is some more text meant to test binding parameters to streams
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo:private\] => 3
|
||||
\[id_foo:foo:private\] => 4
|
||||
\[double\] => 14
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
Just create a normal foo in the script
|
||||
Creating a foo with params 1 \& 2
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => stuff
|
||||
\[id:foo:private\] => -1
|
||||
\[id_foo:foo:private\] => -2
|
||||
\)
|
||||
With no constructor arguments \(4\)
|
||||
(Caught error: Too few arguments to function foo::__construct\(\), 0 passed and exactly 2 expected|
|
||||
Warning: Missing argument 1 for foo::__construct\(\).+sqlsrv_fetch_object\.php.+Warning: Missing argument 2 for foo::__construct\(\).+sqlsrv_fetch_object\.php.+Notice: Undefined variable: a in.+sqlsrv_fetch_object\.php.+Notice: Undefined variable: b in.+sqlsrv_fetch_object\.php.+Creating a foo with params \&.+Doing foo\. -2 4 This is some more text meant to test binding parameters to streams.+foo Object.+\(.+\[stuff\] => This is some more text meant to test binding parameters to streams.+\[id:foo:private\] => 4.+\[id_foo:foo:private\] => 4.+\[double\] => 15.+\[name\] => testtestte.+\))
|
||||
Non args constructor with args \(5\)
|
||||
Doing foo. -2 5 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 5
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[double\] => 16
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
At the end of the result set \(6\)
|
||||
Done fetching objects\.
|
||||
Past the end of the result set \(7\)
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -22
|
||||
\[code\] => -22
|
||||
\[2\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\[message\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\)
|
||||
|
||||
\)
|
320
test/sqlsrv/sqlsrv_fetch_object_2.phpt
Normal file
320
test/sqlsrv/sqlsrv_fetch_object_2.phpt
Normal file
|
@ -0,0 +1,320 @@
|
|||
--TEST--
|
||||
Test for fetch_object
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function __construct( $a, $b )
|
||||
{
|
||||
echo "Creating a foo with params $a & $b\n";
|
||||
}
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
}
|
||||
|
||||
class foo_noargs
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
} // end class foo_noargs
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( $conn === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 )); //,
|
||||
//~ array( SQLSRV_SQLTYPE_INTEGER, SQLSRV_SQLTYPE_CHAR(10), SQLSRV_SQLTYPE_DOUBLE, SQLSRV_SQLTYPE_VARBINARY(4000)));
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 2;
|
||||
$f3 = 13.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt2 = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
$success = sqlsrv_execute( $stmt2 );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt2 )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt2 );
|
||||
sqlsrv_free_stmt( $stmt2 );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 3;
|
||||
$f3 = 14.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt3 = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
$success = sqlsrv_execute( $stmt3 );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt3 )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt3 );
|
||||
sqlsrv_free_stmt( $stmt3 );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 4;
|
||||
$f3 = 15.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt4 = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
$success = sqlsrv_execute( $stmt4 );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt4 )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt4 );
|
||||
sqlsrv_free_stmt( $stmt4 );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 5;
|
||||
$f3 = 16.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt5 = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
$success = sqlsrv_execute( $stmt5 );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt5 )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt5 );
|
||||
sqlsrv_free_stmt( $stmt5 );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
|
||||
echo "Fetch a stdClass object (1)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo_noargs object (2)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo object (with constructor args) (3)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo", array( 2, 1 ) );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Just create a normal foo in the script\n";
|
||||
$next_obj = new foo( 1, 2 );
|
||||
print_r( $next_obj );
|
||||
|
||||
// this case prints out warnings for 7.0.x but not passing enough argument
|
||||
// results in a fatal error for 7.1.x
|
||||
echo "With no constructor arguments (4)\n";
|
||||
try {
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
catch (Error $e)
|
||||
{
|
||||
echo "Caught error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
// the case with args to an object that doesn't take them
|
||||
echo "Non args constructor with args (5)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs", array( 1, 2 ));
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// the end of result set case
|
||||
echo "At the end of the result set (6)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// past the end of result set case
|
||||
echo "Past the end of the result set (7)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
|
||||
--EXPECTREGEX--
|
||||
Fetch a stdClass object \(1\)
|
||||
stdClass Object
|
||||
\(
|
||||
\[id\] => 1
|
||||
\[double\] => 12
|
||||
\[name\] => testtestte
|
||||
\[stuff\] => This is some text meant to test binding parameters to streams
|
||||
\)
|
||||
Fetch a foo_noargs object \(2\)
|
||||
Doing foo\. -2 2 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 2
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[double\] => 13
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
Fetch a foo object \(with constructor args\) \(3\)
|
||||
Creating a foo with params 2 & 1
|
||||
Doing foo\. -2 3 This is some more text meant to test binding parameters to streams
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo:private\] => 3
|
||||
\[id_foo:foo:private\] => 4
|
||||
\[double\] => 14
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
Just create a normal foo in the script
|
||||
Creating a foo with params 1 \& 2
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => stuff
|
||||
\[id:foo:private\] => -1
|
||||
\[id_foo:foo:private\] => -2
|
||||
\)
|
||||
With no constructor arguments \(4\)
|
||||
(Caught error: Too few arguments to function foo::__construct\(\), 0 passed and exactly 2 expected|
|
||||
Warning: Missing argument 1 for foo::__construct\(\).+sqlsrv_fetch_object_2\.php.+Warning: Missing argument 2 for foo::__construct\(\).+sqlsrv_fetch_object_2\.php.+Notice: Undefined variable: a in.+sqlsrv_fetch_object_2\.php.+Notice: Undefined variable: b in.+sqlsrv_fetch_object_2\.php.+Creating a foo with params \&.+Doing foo\. -2 4 This is some more text meant to test binding parameters to streams.+foo Object.+\(.+\[stuff\] => This is some more text meant to test binding parameters to streams.+\[id:foo:private\] => 4.+\[id_foo:foo:private\] => 4.+\[double\] => 15.+\[name\] => testtestte.+\))
|
||||
Non args constructor with args \(5\)
|
||||
Doing foo. -2 5 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 5
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[double\] => 16
|
||||
\[name\] => testtestte
|
||||
\)
|
||||
At the end of the result set \(6\)
|
||||
Done fetching objects\.
|
||||
Past the end of the result set \(7\)
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -22
|
||||
\[code\] => -22
|
||||
\[2\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\[message\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\)
|
||||
|
||||
\)
|
311
test/sqlsrv/sqlsrv_fetch_object_unicode_col_name1.phpt
Normal file
311
test/sqlsrv/sqlsrv_fetch_object_unicode_col_name1.phpt
Normal file
|
@ -0,0 +1,311 @@
|
|||
--TEST--
|
||||
Test for fetch_object with Unicode column name
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function __construct( $a, $b )
|
||||
{
|
||||
echo "Creating a foo with params $a & $b\n";
|
||||
}
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
}
|
||||
|
||||
class foo_noargs
|
||||
{
|
||||
public $stuff = "stuff";
|
||||
|
||||
private $id = -1;
|
||||
|
||||
private $id_foo = -2;
|
||||
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo. $this->id_foo $this->id $this->stuff\n";
|
||||
$this->id_foo = 4;
|
||||
}
|
||||
} // end class foo_noargs
|
||||
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
//sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
//sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
|
||||
|
||||
include 'MsCommon.inc';
|
||||
|
||||
include 'MsSetup.inc';
|
||||
|
||||
$conn = ConnectUTF8();
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, 吉安而來 char(10), [此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é] float, stuff varchar(max))" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, 吉安而來, [此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 )); //,
|
||||
//~ array( SQLSRV_SQLTYPE_INTEGER, SQLSRV_SQLTYPE_CHAR(10), SQLSRV_SQLTYPE_此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é, SQLSRV_SQLTYPE_VARBINARY(4000)));
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 2;
|
||||
$f3 = 13.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 3;
|
||||
$f3 = 14.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 4;
|
||||
$f3 = 15.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 5;
|
||||
$f3 = 16.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT id, [此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é], 吉安而來, stuff FROM test_params" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
|
||||
echo "Fetch a stdClass object (1)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo_noargs object (2)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Fetch a foo object (with constructor args) (3)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo", array( 2, 1 ) );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
|
||||
echo "Just create a normal foo in the script\n";
|
||||
$next_obj = new foo( 1, 2 );
|
||||
print_r( $next_obj );
|
||||
|
||||
// this case prints out warnings for 7.0.x but not passing enough argument
|
||||
// results in a fatal error for 7.1.x
|
||||
echo "With no constructor arguments (4)\n";
|
||||
try {
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
catch (Error $e)
|
||||
{
|
||||
echo "Caught error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
// the case with args to an object that doesn't take them
|
||||
echo "Non args constructor with args (5)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo_noargs", array( 1, 2 ));
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// the end of result set case
|
||||
echo "At the end of the result set (6)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
// past the end of result set case
|
||||
echo "Past the end of the result set (7)\n";
|
||||
$obj = sqlsrv_fetch_object( $stmt, "foo" );
|
||||
if( $obj === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
if( is_null( $obj )) {
|
||||
echo "Done fetching objects.\n";
|
||||
}
|
||||
else {
|
||||
$obj->do_foo();
|
||||
print_r( $obj );
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Fetch a stdClass object \(1\)
|
||||
stdClass Object
|
||||
\(
|
||||
\[id\] => 1
|
||||
\[此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é\] => 12
|
||||
\[吉安而來\] => testtestte
|
||||
\[stuff\] => This is some text meant to test binding parameters to streams
|
||||
\)
|
||||
Fetch a foo_noargs object \(2\)
|
||||
Doing foo\. -2 2 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 2
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é\] => 13
|
||||
\[吉安而來\] => testtestte
|
||||
\)
|
||||
Fetch a foo object \(with constructor args\) \(3\)
|
||||
Creating a foo with params 2 & 1
|
||||
Doing foo\. -2 3 This is some more text meant to test binding parameters to streams
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo:private\] => 3
|
||||
\[id_foo:foo:private\] => 4
|
||||
\[此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é\] => 14
|
||||
\[吉安而來\] => testtestte
|
||||
\)
|
||||
Just create a normal foo in the script
|
||||
Creating a foo with params 1 \& 2
|
||||
foo Object
|
||||
\(
|
||||
\[stuff\] => stuff
|
||||
\[id:foo:private\] => -1
|
||||
\[id_foo:foo:private\] => -2
|
||||
\)
|
||||
With no constructor arguments \(4\)
|
||||
(Caught error: Too few arguments to function foo::__construct\(\), 0 passed and exactly 2 expected|
|
||||
Warning: Missing argument 1 for foo::__construct\(\).+sqlsrv_fetch_object_unicode_col_name1\.php.+Warning: Missing argument 2 for foo::__construct\(\).+sqlsrv_fetch_object_unicode_col_name1\.php.+Notice: Undefined variable: a in.+sqlsrv_fetch_object_unicode_col_name1\.php.+Notice: Undefined variable: b in.+sqlsrv_fetch_object_unicode_col_name1\.php.+Creating a foo with params \&.+Doing foo\. -2 4 This is some more text meant to test binding parameters to streams.+foo Object.+\(.+\[stuff\] => This is some more text meant to test binding parameters to streams.+\[id:foo:private\] => 4.+\[id_foo:foo:private\] => 4.+\[此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é\] => 15.+\[吉安而來\] => testtestte.+\))
|
||||
Non args constructor with args \(5\)
|
||||
Doing foo. -2 5 This is some more text meant to test binding parameters to streams
|
||||
foo_noargs Object
|
||||
\(
|
||||
\[stuff\] => This is some more text meant to test binding parameters to streams
|
||||
\[id:foo_noargs:private\] => 5
|
||||
\[id_foo:foo_noargs:private\] => 4
|
||||
\[此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é\] => 16
|
||||
\[吉安而來\] => testtestte
|
||||
\)
|
||||
At the end of the result set \(6\)
|
||||
Done fetching objects\.
|
||||
Past the end of the result set \(7\)
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -22
|
||||
\[code\] => -22
|
||||
\[2\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\[message\] => There are no more rows in the active result set\. Since this result set is not scrollable\, no more data may be retrieved\.
|
||||
\)
|
||||
|
||||
\)
|
155
test/sqlsrv/sqlsrv_fetch_object_unicode_col_name2.phpt
Normal file
155
test/sqlsrv/sqlsrv_fetch_object_unicode_col_name2.phpt
Normal file
|
@ -0,0 +1,155 @@
|
|||
--TEST--
|
||||
sqlsrv_fetch_object() into a class with Unicode column name
|
||||
--SKIPIF--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Define the Product class. */
|
||||
class Product
|
||||
{
|
||||
public function __construct($ID,$UID)
|
||||
{
|
||||
$this->objID = $ID;
|
||||
$this->name = $UID;
|
||||
}
|
||||
public $objID;
|
||||
public $name;
|
||||
public $StockedQty;
|
||||
public $SafetyStockLevel;
|
||||
public $Code;
|
||||
private $UnitPrice;
|
||||
function getPrice()
|
||||
{
|
||||
return $this->UnitPrice." [CAD]";
|
||||
}
|
||||
|
||||
public function report_output()
|
||||
{
|
||||
echo "Object ID: ".$this->objID."\n";
|
||||
echo "Internal Name: ".$this->name."\n";
|
||||
echo "Product Name: ".$this->личное_имя."\n";
|
||||
echo "Stocked Qty: ".$this->StockedQty."\n";
|
||||
echo "Safety Stock Level: ".$this->SafetyStockLevel."\n";
|
||||
echo "Color: ".$this->Color."\n";
|
||||
echo "Country: ".$this->Code."\n";
|
||||
echo "Unit Price: ".$this->getPrice()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
class Sample extends Product
|
||||
{
|
||||
public function __construct($ID)
|
||||
{
|
||||
$this->objID = $ID;
|
||||
}
|
||||
|
||||
function getPrice()
|
||||
{
|
||||
return $this->UnitPrice ." [EUR]";
|
||||
}
|
||||
|
||||
public function report_output()
|
||||
{
|
||||
echo "ID: ".$this->objID."\n";
|
||||
echo "Name: ".$this->личное_имя."\n";
|
||||
echo "Unit Price: ".$this->getPrice()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include 'MsCommon.inc';
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
include 'MsSetup.inc';
|
||||
|
||||
$conn = ConnectUTF8();
|
||||
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
|
||||
|
||||
// Create table Purchasing
|
||||
$tableName1 = "Purchasing";
|
||||
$tableName2 = "Country";
|
||||
DropTable($conn, $tableName1);
|
||||
DropTable($conn, $tableName2);
|
||||
$sql = "create table $tableName1 (ID CHAR(4), личное_имя VARCHAR(128), SafetyStockLevel SMALLINT,
|
||||
StockedQty INT, UnitPrice FLOAT, DueDate datetime, Color VARCHAR(20))";
|
||||
sqlsrv_query($conn, $sql) ?: die( print_r( sqlsrv_errors(), true ));
|
||||
|
||||
// Insert data
|
||||
$sql = "INSERT INTO $tableName1 VALUES
|
||||
('P001','Pencil 2B','102','24','0.24','2016-02-01','Red'),
|
||||
('P002','Notepad','102','12','3.87', '2016-02-21',Null),
|
||||
('P001','Mirror 2\"','652','3','15.99', '2016-02-01',NULL),
|
||||
('P003','USB connector','1652','31','9.99','2016-02-01',NULL)";
|
||||
sqlsrv_query( $conn, $sql) ?: die( print_r( sqlsrv_errors(), true ));
|
||||
|
||||
// Create table Country
|
||||
$sql = "create table $tableName2 (SerialNumber CHAR(4), Code VARCHAR(2))";
|
||||
sqlsrv_query($conn, $sql) ?: die( print_r( sqlsrv_errors(), true ));
|
||||
|
||||
// Insert data
|
||||
$sql = "INSERT INTO $tableName2 VALUES ('P001','FR'),('P002','UK'),('P003','DE')";
|
||||
sqlsrv_query( $conn, $sql) ?: die( print_r( sqlsrv_errors(), true ));
|
||||
|
||||
/* Define the query. */
|
||||
$sql = "SELECT личное_имя, SafetyStockLevel, StockedQty, UnitPrice, Color, Code
|
||||
FROM $tableName1 AS Purchasing
|
||||
JOIN $tableName2 AS Country
|
||||
ON Purchasing.ID = Country.SerialNumber
|
||||
WHERE Purchasing.StockedQty < ?
|
||||
AND Purchasing.UnitPrice < ?
|
||||
AND Purchasing.DueDate= ?";
|
||||
|
||||
/* Set the parameter values. */
|
||||
$params = array(100, '10.5', '2016-02-01');
|
||||
|
||||
/* Execute the query. */
|
||||
$stmt = sqlsrv_query( $conn, $sql, $params, array("Scrollable"=>"static")); //, array("Scrollable"=>"buffered")
|
||||
if (!$stmt)
|
||||
{
|
||||
echo "Error in statement execution.\n";
|
||||
die( print_r( sqlsrv_errors(), true));
|
||||
}
|
||||
|
||||
// Iterate through the result set.
|
||||
// $product is an instance of the Product class.
|
||||
$i=0; $hasNext = TRUE;
|
||||
|
||||
while( $hasNext )
|
||||
{
|
||||
$sample = sqlsrv_fetch_object( $stmt, "Sample", array($i+1000),SQLSRV_SCROLL_ABSOLUTE,$i);
|
||||
|
||||
// DEBUG: uncomment to see the SQL_SERVER ERROR
|
||||
// if(!$sample) die( print_r( sqlsrv_errors(), true));
|
||||
|
||||
if(!$sample) {
|
||||
$hasNext = false;
|
||||
}
|
||||
else {
|
||||
$sample->report_output();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
// DROP database
|
||||
// $stmt = sqlsrv_query($conn,"DROP DATABASE ". $dbName);
|
||||
//echo $dbName;
|
||||
DropTable($conn, $tableName1);
|
||||
DropTable($conn, $tableName2);
|
||||
// Free statement and connection resources.s
|
||||
sqlsrv_free_stmt($stmt);
|
||||
sqlsrv_close($conn);
|
||||
|
||||
print "Done";
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
ID: 1000
|
||||
Name: Pencil 2B
|
||||
Unit Price: 0.24 [EUR]
|
||||
ID: 1001
|
||||
Name: USB connector
|
||||
Unit Price: 9.99 [EUR]
|
||||
Done
|
60
test/sqlsrv/sqlsrv_get_config.phpt
Normal file
60
test/sqlsrv/sqlsrv_get_config.phpt
Normal file
|
@ -0,0 +1,60 @@
|
|||
--TEST--
|
||||
Test sqlsrv_get_config method.
|
||||
--SKIPIF--
|
||||
<?php require 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure('WarningsReturnAsError', 0);
|
||||
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_ALL);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_CONN);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_INIT);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_STMT);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_UTIL);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
sqlsrv_configure('LogSubsystems', SQLSRV_LOG_SYSTEM_OFF);
|
||||
$sql_get = sqlsrv_get_config('LogSubsystems');
|
||||
echo "Get Config LogSubsystems " . $sql_get . "\n";
|
||||
|
||||
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_ALL);
|
||||
echo "Get Config LogSeverity " . $sql_get . "\n";
|
||||
$sql_get = sqlsrv_get_config('LogSeverity');
|
||||
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_ERROR);
|
||||
echo "Get Config LogSeverity " . $sql_get . "\n";
|
||||
$sql_get = sqlsrv_get_config('LogSeverity');
|
||||
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_ALL);
|
||||
echo "Get Config LogSeverity " . $sql_get . "\n";
|
||||
$sql_get = sqlsrv_get_config('LogSeverity');
|
||||
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_NOTICE);
|
||||
echo "Get Config LogSeverity " . $sql_get . "\n";
|
||||
$sql_get = sqlsrv_get_config('LogSeverity');
|
||||
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_WARNING);
|
||||
echo "Get Config LogSeverity " . $sql_get . "\n";
|
||||
$sql_get = sqlsrv_get_config('LogSeverity');
|
||||
|
||||
$sql_get = sqlsrv_get_config('ClientBufferMaxKBSize');
|
||||
echo "Get buffer size " . $sql_get . "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Get Config LogSubsystems -1
|
||||
Get Config LogSubsystems 2
|
||||
Get Config LogSubsystems 1
|
||||
Get Config LogSubsystems 4
|
||||
Get Config LogSubsystems 8
|
||||
Get Config LogSubsystems 0
|
||||
Get Config LogSeverity 0
|
||||
Get Config LogSeverity -1
|
||||
Get Config LogSeverity 1
|
||||
Get Config LogSeverity -1
|
||||
Get Config LogSeverity 4
|
||||
Get buffer size 10240
|
411
test/sqlsrv/sqlsrv_get_field.phpt
Normal file
411
test/sqlsrv/sqlsrv_get_field.phpt
Normal file
|
@ -0,0 +1,411 @@
|
|||
--TEST--
|
||||
integer, float, and datetime types vs various sql server types.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function get_fields( $stmt )
|
||||
{
|
||||
|
||||
// bigint
|
||||
$field = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// int
|
||||
$field = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// smallint
|
||||
$field = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// tinyint
|
||||
$field = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// bit
|
||||
$field = sqlsrv_get_field( $stmt, 4, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// decimal(38,0)
|
||||
$field = sqlsrv_get_field( $stmt, 5, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// datetime
|
||||
$field = sqlsrv_get_field( $stmt, 6, SQLSRV_PHPTYPE_DATETIME );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo $field->format( "m/d/Y h:i:s" );
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// money
|
||||
$field = sqlsrv_get_field( $stmt, 7, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// smallmoney
|
||||
$field = sqlsrv_get_field( $stmt, 8, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// float(53)
|
||||
$field = sqlsrv_get_field( $stmt, 9, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
// real (this doesn't get the max or min, but the closes representation to 0 without being 0)
|
||||
$field = sqlsrv_get_field( $stmt, 10, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
var_dump( sqlsrv_errors( SQLSRV_ERR_WARNINGS ) );
|
||||
echo "$field\n";
|
||||
}
|
||||
|
||||
echo "get_fields done.\n";
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
|
||||
date_default_timezone_set( 'UTC' );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_connect failed." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT bigint_type, int_type, smallint_type, tinyint_type, bit_type, decimal_type, datetime_type, money_type, smallmoney_type, float_type, real_type FROM [test_types]" );
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_query failed" );
|
||||
}
|
||||
|
||||
$success = sqlsrv_fetch( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_fetch failed" );
|
||||
}
|
||||
|
||||
// maximum values
|
||||
get_fields( $stmt );
|
||||
|
||||
$success = sqlsrv_fetch( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_fetch failed" );
|
||||
}
|
||||
|
||||
// minimum values
|
||||
get_fields( $stmt );
|
||||
|
||||
$success = sqlsrv_fetch( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_fetch failed" );
|
||||
}
|
||||
|
||||
// zero values
|
||||
get_fields( $stmt );
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT int_type, decimal_type, datetime_type, real_type FROM [test_types]" );
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_query failed" );
|
||||
}
|
||||
|
||||
$success = sqlsrv_fetch( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_fetch failed" );
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field failed" );
|
||||
}
|
||||
$field = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_INT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
die( "sqlsrv_get_field should have failed" );
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field failed" );
|
||||
}
|
||||
$field = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_FLOAT );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
die( "sqlsrv_get_field should have failed" );
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_DATETIME );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field failed" );
|
||||
}
|
||||
$field = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_DATETIME );
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
die( "sqlsrv_get_field should have failed" );
|
||||
}
|
||||
|
||||
$field = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_get_field failed" );
|
||||
}
|
||||
$field = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
if( $field === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
else {
|
||||
die( "sqlsrv_get_field should have failed" );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) \{
|
||||
\[0\]=>
|
||||
string\(5\) "22003"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "22003"
|
||||
\[1\]=>
|
||||
int\(0\)
|
||||
\["code"\]=>
|
||||
int\(0\)
|
||||
\[2\]=>
|
||||
string\(68\) "\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\]Numeric value out of range"
|
||||
\["message"\]=>
|
||||
string\(68\) "\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\]Numeric value out of range"
|
||||
\}
|
||||
\}
|
||||
NULL
|
||||
2147483647
|
||||
NULL
|
||||
32767
|
||||
NULL
|
||||
255
|
||||
NULL
|
||||
1
|
||||
NULL
|
||||
1\.0E\+37
|
||||
NULL
|
||||
12\/12\/1968 04\:20\:00
|
||||
NULL
|
||||
9\.2233720368548E\+14
|
||||
NULL
|
||||
214748.3647
|
||||
NULL
|
||||
1\.79E\+308
|
||||
NULL
|
||||
1.1799999457746E-38
|
||||
get_fields done.
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) {
|
||||
\[0\]=>
|
||||
string\(5\) "22003"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "22003"
|
||||
\[1\]=>
|
||||
int\(0\)
|
||||
\["code"\]=>
|
||||
int\(0\)
|
||||
\[2\]=>
|
||||
string\(68\) "\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\]Numeric value out of range"
|
||||
\["message"\]=>
|
||||
string\(68\) "\[Microsoft\]\[ODBC Driver 1[0-9] for SQL Server\]Numeric value out of range"
|
||||
\}
|
||||
\}
|
||||
NULL
|
||||
-2147483648
|
||||
NULL
|
||||
-32768
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
\-1\.0E\+37
|
||||
NULL
|
||||
12\/12\/1968 04\:20\:00
|
||||
NULL
|
||||
\-9\.2233720368548E\+14
|
||||
NULL
|
||||
-214748.3648
|
||||
NULL
|
||||
\-1\.79E\+308
|
||||
NULL
|
||||
-1.1799999457746E-38
|
||||
get_fields done.
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
12\/12\/1968 04\:20\:00
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
NULL
|
||||
0
|
||||
get_fields done.
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) \{
|
||||
\[0\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\[1\]=>
|
||||
int\(\-5\)
|
||||
\["code"\]=>
|
||||
int\(\-5\)
|
||||
\[2\]=>
|
||||
string\(25\) "Field 0 returned no data\."
|
||||
\["message"\]=>
|
||||
string\(25\) "Field 0 returned no data\."
|
||||
\}
|
||||
\}
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) \{
|
||||
\[0\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\[1\]=>
|
||||
int\(-5\)
|
||||
\["code"\]=>
|
||||
int\(-5\)
|
||||
\[2\]=>
|
||||
string\(25\) "Field 1 returned no data\."
|
||||
\["message"\]=>
|
||||
string\(25\) "Field 1 returned no data\."
|
||||
\}
|
||||
\}
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) {
|
||||
\[0\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\[1\]=>
|
||||
int\(\-5\)
|
||||
\["code"\]=>
|
||||
int\(\-5\)
|
||||
\[2\]=>
|
||||
string\(25\) "Field 2 returned no data\."
|
||||
\["message"\]=>
|
||||
string\(25\) "Field 2 returned no data\."
|
||||
\}
|
||||
\}
|
||||
array\(1\) \{
|
||||
\[0\]=>
|
||||
array\(6\) \{
|
||||
\[0\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\["SQLSTATE"\]=>
|
||||
string\(5\) "IMSSP"
|
||||
\[1\]=>
|
||||
int\(\-5\)
|
||||
\["code"\]=>
|
||||
int\(\-5\)
|
||||
\[2\]=>
|
||||
string\(25\) "Field 3 returned no data\."
|
||||
\["message"\]=>
|
||||
string\(25\) "Field 3 returned no data\."
|
||||
\}
|
||||
\}
|
84
test/sqlsrv/sqlsrv_input_param_unknown_encoding.phpt
Normal file
84
test/sqlsrv/sqlsrv_input_param_unknown_encoding.phpt
Normal file
|
@ -0,0 +1,84 @@
|
|||
--TEST--
|
||||
test input param with unknown encoding
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_time_limit(0);
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_OFF );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( $conn === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "IF OBJECT_ID('php_table_SERIL1_1', 'U') IS NOT NULL DROP TABLE [php_table_SERIL1_1]");
|
||||
if( $stmt !== false ) {
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query($conn, "CREATE TABLE [php_table_SERIL1_1] ([c1_int] int, [c2_varchar_max] varchar(max))");
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
$stmt = sqlsrv_query($conn, "INSERT INTO [php_table_SERIL1_1] (c1_int, c2_varchar_max) VALUES (?, ?)", array(1, array("Test Data", SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_UNKNOWN), null)));
|
||||
if( $stmt !== false ) {
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_query shouldn't have succeeded." );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
$stmt = sqlsrv_prepare($conn, "INSERT INTO [php_table_SERIL1_1] (c1_int, c2_varchar_max) VALUES (?, ?)", array(1, array("Test Data", SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_UNKNOWN), null)));
|
||||
if( $stmt === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
$result = sqlsrv_execute( $stmt );
|
||||
if( $result !== false ) {
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_execute shouldn't have succeeded." );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
|
||||
sqlsrv_query($conn, "DROP TABLE [php_table_SERIL1_1]");
|
||||
|
||||
sqlsrv_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Notice\: Use of undefined constant SQLSRV_ENC_UNKNOWN - assumed \'SQLSRV_ENC_UNKNOWN\' in .+(\/|\\)sqlsrv_input_param_unknown_encoding\.php on line 26
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -16
|
||||
\[code\] => -16
|
||||
\[2\] => An invalid PHP type for parameter 2 was specified\.
|
||||
\[message\] => An invalid PHP type for parameter 2 was specified\.
|
||||
\)
|
||||
|
||||
\)
|
||||
|
||||
Notice\: Use of undefined constant SQLSRV_ENC_UNKNOWN - assumed \'SQLSRV_ENC_UNKNOWN\' in .+(\/|\\)sqlsrv_input_param_unknown_encoding\.php on line 33
|
||||
Array
|
||||
\(
|
||||
\[0\] => Array
|
||||
\(
|
||||
\[0\] => IMSSP
|
||||
\[SQLSTATE\] => IMSSP
|
||||
\[1\] => -16
|
||||
\[code\] => -16
|
||||
\[2\] => An invalid PHP type for parameter 2 was specified\.
|
||||
\[message\] => An invalid PHP type for parameter 2 was specified\.
|
||||
\)
|
||||
|
||||
\)
|
||||
|
149
test/sqlsrv/sqlsrv_metadata.phpt
Normal file
149
test/sqlsrv/sqlsrv_metadata.phpt
Normal file
|
@ -0,0 +1,149 @@
|
|||
--TEST--
|
||||
field metadata for all types.
|
||||
--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)
|
||||
{
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM test_types" );
|
||||
|
||||
$metadata = sqlsrv_field_metadata( $stmt );
|
||||
|
||||
print_r( $metadata );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[Name] => bigint_type
|
||||
[Type] => -5
|
||||
[Size] =>
|
||||
[Precision] => 19
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[Name] => int_type
|
||||
[Type] => 4
|
||||
[Size] =>
|
||||
[Precision] => 10
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[Name] => smallint_type
|
||||
[Type] => 5
|
||||
[Size] =>
|
||||
[Precision] => 5
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[Name] => tinyint_type
|
||||
[Type] => -6
|
||||
[Size] =>
|
||||
[Precision] => 3
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[4] => Array
|
||||
(
|
||||
[Name] => bit_type
|
||||
[Type] => -7
|
||||
[Size] =>
|
||||
[Precision] => 1
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[5] => Array
|
||||
(
|
||||
[Name] => decimal_type
|
||||
[Type] => 3
|
||||
[Size] =>
|
||||
[Precision] => 38
|
||||
[Scale] => 0
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[6] => Array
|
||||
(
|
||||
[Name] => money_type
|
||||
[Type] => 3
|
||||
[Size] =>
|
||||
[Precision] => 19
|
||||
[Scale] => 4
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[7] => Array
|
||||
(
|
||||
[Name] => smallmoney_type
|
||||
[Type] => 3
|
||||
[Size] =>
|
||||
[Precision] => 10
|
||||
[Scale] => 4
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[8] => Array
|
||||
(
|
||||
[Name] => float_type
|
||||
[Type] => 6
|
||||
[Size] =>
|
||||
[Precision] => 53
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[9] => Array
|
||||
(
|
||||
[Name] => real_type
|
||||
[Type] => 7
|
||||
[Size] =>
|
||||
[Precision] => 24
|
||||
[Scale] =>
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[10] => Array
|
||||
(
|
||||
[Name] => datetime_type
|
||||
[Type] => 93
|
||||
[Size] =>
|
||||
[Precision] => 23
|
||||
[Scale] => 3
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
[11] => Array
|
||||
(
|
||||
[Name] => smalldatetime_type
|
||||
[Type] => 93
|
||||
[Size] =>
|
||||
[Precision] => 16
|
||||
[Scale] => 0
|
||||
[Nullable] => 1
|
||||
)
|
||||
|
||||
)
|
27
test/sqlsrv/sqlsrv_metadata_unicode_col_name1.phpt
Normal file
27
test/sqlsrv/sqlsrv_metadata_unicode_col_name1.phpt
Normal file
|
@ -0,0 +1,27 @@
|
|||
--TEST--
|
||||
PHP - Retrieve Unicode column name using sqlsrv_fetch_metadata
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'MsCommon.inc';
|
||||
$tableName = "UnicodeColNameTest";
|
||||
$columnName = "此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é";
|
||||
|
||||
include 'MsSetup.inc';
|
||||
$conn = ConnectUTF8();
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
$stmt = sqlsrv_query($conn, "CREATE TABLE [$tableName] ([$columnName] varchar(5))");
|
||||
$stmt = sqlsrv_query($conn, "SELECT * from [$tableName]");
|
||||
$meta = sqlsrv_field_metadata( $stmt );
|
||||
echo $meta[0]["Name"];
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
sqlsrv_close($conn);
|
||||
?>
|
||||
--EXPECT--
|
||||
此是後話Κοντάוְאַתָּה第十四章BiałopioБунтевсемужирафиtest是أي بزمام الإنذارהნომინავიiałopioБунтевсемужирафиtest父親回衙 汗流如雨 吉安而來. 關雎 誨€¥É§é
|
57
test/sqlsrv/sqlsrv_metadata_unicode_col_name2.phpt
Normal file
57
test/sqlsrv/sqlsrv_metadata_unicode_col_name2.phpt
Normal file
|
@ -0,0 +1,57 @@
|
|||
--TEST--
|
||||
Unicode column names
|
||||
--SKIPIF--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
include 'MsCommon.inc';
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
include 'MsSetup.inc';
|
||||
Setup();
|
||||
$conn = ConnectUTF8();
|
||||
|
||||
$tableName = "UnicodeColNameTest";
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
|
||||
// Column names array
|
||||
$colName = ["P_".'银河系', str_repeat( "金星", 2), "CÐÐÆØ"];
|
||||
|
||||
// Create table
|
||||
$stmt = sqlsrv_query($conn, "create table ".$tableName
|
||||
." ($colName[0] VARCHAR(10), $colName[1] VARCHAR(20), $colName[2] INT)");
|
||||
if( $stmt === false ) { die( print_r( sqlsrv_errors(), true )); }
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
// Insert data
|
||||
$sql = "INSERT INTO ".$tableName." VALUES ('Nick', 'Lee', 30)";
|
||||
$stmt = sqlsrv_query( $conn, $sql);
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
|
||||
// Insert data
|
||||
$sql = "INSERT INTO ".$tableName." VALUES ('Nhoj', 'Eoduard', -3),('Vi Lo', N'N/A', 1987)";
|
||||
$stmt = sqlsrv_query($conn, $sql);
|
||||
sqlsrv_free_stmt($stmt);
|
||||
|
||||
// Prepare the statement
|
||||
$query = "SELECT * FROM ".$tableName;
|
||||
$stmt = sqlsrv_prepare($conn, $query);
|
||||
|
||||
// Get field metadata
|
||||
foreach( sqlsrv_field_metadata( $stmt) as $fieldMetadata) {
|
||||
$res = $fieldMetadata;
|
||||
var_dump($res['Name']);
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt);
|
||||
sqlsrv_close($conn);
|
||||
print "Done";
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
string(11) "P_银河系"
|
||||
string(12) "金星金星"
|
||||
string(9) "CÐÐÆØ"
|
||||
Done
|
103
test/sqlsrv/sqlsrv_num_fields.phpt
Normal file
103
test/sqlsrv/sqlsrv_num_fields.phpt
Normal file
|
@ -0,0 +1,103 @@
|
|||
--TEST--
|
||||
sqlsrv_num_fields and output params without sqlsrv_next_result.
|
||||
--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( "Failed to connect." );
|
||||
}
|
||||
|
||||
// test num_fields on a statement that doesn't generate a result set.
|
||||
$stmt = sqlsrv_prepare( $conn, "USE 'tempdb'" );
|
||||
sqlsrv_execute( $stmt );
|
||||
$field_count = sqlsrv_num_fields( $stmt );
|
||||
if( $field_count === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
echo "$field_count\n";
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
// test sqlsrv_num_fields immediately after a prepare
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
$field_count = sqlsrv_num_fields( $stmt );
|
||||
if( $field_count === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
echo "$field_count\n";
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
FatalError( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
// test num_fields on a valid statement that produces a result set.
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
$success = sqlsrv_fetch( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
$field_count = sqlsrv_num_fields( $stmt );
|
||||
if( $field_count === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
echo "$field_count\n";
|
||||
|
||||
$v1 = 1;
|
||||
$v2 = 2;
|
||||
$v3 = -1; // must initialize output parameters to something similar to what they are projected to receive
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "{call test_out( ?, ?, ? )}", array( &$v1, &$v2, array( &$v3, SQLSRV_PARAM_OUT )));
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
// while( sqlsrv_next_result( $stmt ) != null );
|
||||
// this should return 3, but shorthand output parameters are disabled for now.
|
||||
echo "$v3\n";
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
0
|
||||
4
|
||||
3
|
47
test/sqlsrv/sqlsrv_num_rows.phpt
Normal file
47
test/sqlsrv/sqlsrv_num_rows.phpt
Normal file
|
@ -0,0 +1,47 @@
|
|||
--TEST--
|
||||
Test sqlsrv_num_rows method.
|
||||
--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( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('utf16invalid', 'U') IS NOT NULL DROP TABLE utf16invalid" );
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE utf16invalid (id int identity, c1 nvarchar(100))");
|
||||
if( $stmt === false )
|
||||
{
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO utf16invalid (c1) VALUES ('TEST')");
|
||||
if( $stmt === false )
|
||||
{
|
||||
die( print_r( sqlsrv_errors()));
|
||||
}
|
||||
$stmt = sqlsrv_query( $conn, "SELECT * FROM utf16invalid", array(), array("Scrollable" => SQLSRV_CURSOR_KEYSET ));
|
||||
$row_nums = sqlsrv_num_rows($stmt);
|
||||
|
||||
echo $row_nums;
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "DROP TABLE utf16invalid" );
|
||||
if( $stmt === false)
|
||||
{
|
||||
die( print_r( sqlsrv_errors()));
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
1
|
137
test/sqlsrv/sqlsrv_prepare.phpt
Normal file
137
test/sqlsrv/sqlsrv_prepare.phpt
Normal file
|
@ -0,0 +1,137 @@
|
|||
--TEST--
|
||||
binding parameters, including output parameters, using the simplified syntax.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if ( !$conn )
|
||||
{
|
||||
FatalError( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
sqlsrv_execute( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, "testtestte", &$f3, &$f4 ));
|
||||
if( !$stmt ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_prepare failed." );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$f1 = 2;
|
||||
$f3 = 13.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20more%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
$id = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
echo "$id\n";
|
||||
$double = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
echo "$double\n";
|
||||
$name = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR) );
|
||||
echo "$name\n";
|
||||
$stream = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY) );
|
||||
while( !feof( $stream )) {
|
||||
$str = fread( $stream, 10000 );
|
||||
echo $str;
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$v1 = 1;
|
||||
$v2 = 2;
|
||||
$v3 = -1; // must initialize output parameters to something similar to what they are projected to receive
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "{call test_out( ?, ?, ? )}", array( &$v1, &$v2, array( &$v3, SQLSRV_PARAM_OUT )));
|
||||
|
||||
// Turning off WarningsReturnAsErrors, because of the print at the end of test_out proc,
|
||||
// which causes a warning. Warning contains the result of print.
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
$ret = sqlsrv_execute( $stmt );
|
||||
if ( $ret === false )
|
||||
{
|
||||
print_r( sqlsrv_errors());
|
||||
}
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 1 );
|
||||
while( sqlsrv_next_result( $stmt ) != null );
|
||||
// this should return 3, but shorthand output parameters are disabled for now.
|
||||
echo "$v3\n";
|
||||
|
||||
$v1 = 2;
|
||||
|
||||
// Turning off WarningsReturnAsErrors, because of the print at the end of test_out proc,
|
||||
// which causes a warning. Warning contains the result of print.
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
$ret = sqlsrv_execute( $stmt );
|
||||
if ( $ret === false )
|
||||
{
|
||||
print_r( sqlsrv_errors());
|
||||
}
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 1 );
|
||||
while( sqlsrv_next_result( $stmt ) != null );
|
||||
|
||||
// this should return 4, but shorthand output parameters are disabled for now.
|
||||
echo "$v3\n";
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECTF--
|
||||
1
|
||||
12.0
|
||||
testtestte
|
||||
This is some text meant to test binding parameters to streams
|
||||
2
|
||||
13.0
|
||||
testtestte
|
||||
This is some more text meant to test binding parameters to streams
|
||||
3
|
||||
4
|
50
test/sqlsrv/sqlsrv_prepareAndExecute.phpt
Normal file
50
test/sqlsrv/sqlsrv_prepareAndExecute.phpt
Normal file
|
@ -0,0 +1,50 @@
|
|||
--TEST--
|
||||
preparing a statement and executing it more than once.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if (!$conn)
|
||||
{
|
||||
FatalError( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "sp_who" );
|
||||
if( !$stmt ) {
|
||||
FatalError( "prepare failed" );
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
FatalError( "first execute failed" );
|
||||
}
|
||||
|
||||
echo "first execute succeeded<br/>\n";
|
||||
while( $row = sqlsrv_fetch( $stmt )) {
|
||||
}
|
||||
if( $row === false ) {
|
||||
die( print_r( sqlsrv_errors(), true ));
|
||||
}
|
||||
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
FatalError( "second execute failed" );
|
||||
}
|
||||
|
||||
echo "second execute succeeded<br/>\n";
|
||||
while( $row = sqlsrv_fetch_array( $stmt )) {
|
||||
// var_dump( $row );
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECTF--
|
||||
first execute succeeded<br/>
|
||||
second execute succeeded<br/>
|
||||
|
74
test/sqlsrv/sqlsrv_query.phpt
Normal file
74
test/sqlsrv/sqlsrv_query.phpt
Normal file
|
@ -0,0 +1,74 @@
|
|||
--TEST--
|
||||
sqlsrv_query test. Performs same tasks as 0006.phpt, using sqlsrv_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 ) {
|
||||
FatalError( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
if( !$stmt ) {
|
||||
$errors = sqlsrv_errors();
|
||||
if( $errors[0]["SQLSTATE"] != "42S02" ) {
|
||||
var_dump( $errors );
|
||||
die( "sqlsrv_query(3) failed." );
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(max))" );
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_query(4) failed." );
|
||||
}
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)",
|
||||
array( $f1, $f2, $f3, $f4 ));
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_query(5) failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_query(6) failed." );
|
||||
}
|
||||
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
$id = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$id <br/>";
|
||||
$double = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$double <br/>";
|
||||
$name = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$name <br/>";
|
||||
$stream = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
|
||||
while( !feof( $stream )) {
|
||||
$str = fread( $stream, 4000 );
|
||||
echo $str;
|
||||
}
|
||||
echo "<br/>";
|
||||
}
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
1 <br/>12.0 <br/>testtestte <br/>This is some text meant to test binding parameters to streams<br/>%A
|
1002
test/sqlsrv/sqlsrv_readStream.phpt
Normal file
1002
test/sqlsrv/sqlsrv_readStream.phpt
Normal file
|
@ -0,0 +1,1002 @@
|
|||
--TEST--
|
||||
Read varchar(max) fields from a stream
|
||||
--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( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "SELECT review1 FROM cd_info" );
|
||||
|
||||
sqlsrv_execute( $stmt );
|
||||
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
$strlen = 0;
|
||||
$stream = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STREAM("binary"));
|
||||
while( !feof( $stream )) {
|
||||
$str = fread( $stream, 80 );
|
||||
$strlen += strlen( $str );
|
||||
echo "$str\n";
|
||||
}
|
||||
echo "length = $strlen\n\n";
|
||||
}
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECT--
|
||||
Source: Amazon.com - As it turned out, Led Zeppelins infamous 1969 debut album w
|
||||
as indicative of the decade to come--one that, fittingly, this band helped defin
|
||||
e with its decadently exaggerated, bowdlerized blues-rock. In shrieker Robert Pl
|
||||
ant, ex-Yardbird Jimmy Page found a vocalist who could match his guitar pyrotech
|
||||
nics, and the band pounded out its music with swaggering ferocity and Richter-sc
|
||||
ale-worthy volume. Pumping up blues classics such as Otis Rushs I Cant Quit You
|
||||
Baby and Howlin Wolfs How Many More Times into near-cartoon parodies, the band a
|
||||
lso hinted at things to come with the manic Communication Breakdown and the lumb
|
||||
ering set stopper Dazed and Confused. <I>--Billy Altman</I>
|
||||
length = 699
|
||||
|
||||
Source: Amazon.com essential recording - Most critics complain <I>Back in Black<
|
||||
/I>, the album AC/DC recorded after the death of their original lead screamer Bo
|
||||
n Scott, is ridiculously juvenile, obvious, snickering, bludgeoning, derivative,
|
||||
single-minded about sex and booze, a big cartoon. All true, of course, and--on
|
||||
rock n ragers like What Do You Do For Money Honey, You Shook Me All Night Long,
|
||||
and the title track--all great. As Scotts replacement Brian Johnson reminds us,
|
||||
loud and crunchy, no-holds-barred rock and roll aint noise pollution...it makes
|
||||
good, good sense. Never trust anyone who refuses to drink domestic beer, laugh a
|
||||
t the Three Stooges, or crank <I>Back in Black</I>. <i>--David Cantwell</i>
|
||||
length = 715
|
||||
|
||||
Source: Amazon.com - At the time of its release, <I>One Hot Minute</I> was viewe
|
||||
d as the beginning of a new direction for the Red Hot Chili Peppers. Guitarist J
|
||||
ohn Frusciante had departed and former Janes Addiction guitarist Dave Navarro jo
|
||||
ined the ranks after some false starts with short-lived replacements. Band chemi
|
||||
stry here isnt quite up to past standards. Navarro stretches out throughout the
|
||||
album, imbuing tunes with a heavy dose of hard rock and psychedelia and providin
|
||||
g a stark contrast from Frusciantes dexterous noodling. Tracks such as Warped an
|
||||
d Aeroplane display a band prone to exploring a less frenetic hard rock, while S
|
||||
hallow Be Thy Game sounds like the old band. Frusciante eventually returned to t
|
||||
he fold, so this 1995 collection now stands as a curious intermission for the Pe
|
||||
ppers. <I>--Rob OConnor</I>
|
||||
length = 827
|
||||
|
||||
|
||||
length = 0
|
||||
|
||||
|
||||
length = 0
|
||||
|
||||
Source: Amazon.com essential recording - The Chili Peppers finally hit their str
|
||||
ide with <I>Mothers Milk</I>, for the first time making their breakneck mix of f
|
||||
unk, rap, and metal smooth enough to attract the masses, while keeping it raw en
|
||||
ough not to alienate old fans. Theyve straddled that edge ever since. It didnt
|
||||
hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Ground
|
||||
to introduce the album. That single though, and the rest of <I>Mothers Milk</I>
|
||||
(including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from
|
||||
Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was al
|
||||
so guitarist John Frusciantes debut with the group and he shines, especially on
|
||||
Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording
|
||||
- The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the f
|
||||
irst time making their breakneck mix of funk, rap, and metal smooth enough to at
|
||||
tract the masses, while keeping it raw enough not to alienate old fans. Theyve s
|
||||
traddled that edge ever since. It didnt hurt that they offered a pretty mainstr
|
||||
eam cover of Stevie Wonders Higher Ground to introduce the album. That single th
|
||||
ough, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy
|
||||
Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to
|
||||
Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut wit
|
||||
h the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</
|
||||
I>Source: Amazon.com essential recording - The Chili Peppers finally hit their s
|
||||
tride with <I>Mothers Milk</I>, for the first time making their breakneck mix of
|
||||
funk, rap, and metal smooth enough to attract the masses, while keeping it raw
|
||||
enough not to alienate old fans. Theyve straddled that edge ever since. It didn
|
||||
t hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Grou
|
||||
nd to introduce the album. That single though, and the rest of <I>Mothers Milk</
|
||||
I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--fro
|
||||
m Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was
|
||||
also guitarist John Frusciantes debut with the group and he shines, especially o
|
||||
n Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recordin
|
||||
g - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the
|
||||
first time making their breakneck mix of funk, rap, and metal smooth enough to
|
||||
attract the masses, while keeping it raw enough not to alienate old fans. Theyve
|
||||
straddled that edge ever since. It didnt hurt that they offered a pretty mains
|
||||
tream cover of Stevie Wonders Higher Ground to introduce the album. That single
|
||||
though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the ran
|
||||
dy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals t
|
||||
o Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut w
|
||||
ith the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby
|
||||
</I>Source: Amazon.com essential recording - The Chili Peppers finally hit their
|
||||
stride with <I>Mothers Milk</I>, for the first time making their breakneck mix
|
||||
of funk, rap, and metal smooth enough to attract the masses, while keeping it ra
|
||||
w enough not to alienate old fans. Theyve straddled that edge ever since. It di
|
||||
dnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Gr
|
||||
ound to introduce the album. That single though, and the rest of <I>Mothers Milk
|
||||
</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--f
|
||||
rom Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> wa
|
||||
s also guitarist John Frusciantes debut with the group and he shines, especially
|
||||
on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential record
|
||||
ing - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for t
|
||||
he first time making their breakneck mix of funk, rap, and metal smooth enough t
|
||||
o attract the masses, while keeping it raw enough not to alienate old fans. They
|
||||
ve straddled that edge ever since. It didnt hurt that they offered a pretty mai
|
||||
nstream cover of Stevie Wonders Higher Ground to introduce the album. That singl
|
||||
e though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the r
|
||||
andy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals
|
||||
to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut
|
||||
with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ru
|
||||
by</I>Source: Amazon.com essential recording - The Chili Peppers finally hit the
|
||||
ir stride with <I>Mothers Milk</I>, for the first time making their breakneck mi
|
||||
x of funk, rap, and metal smooth enough to attract the masses, while keeping it
|
||||
raw enough not to alienate old fans. Theyve straddled that edge ever since. It
|
||||
didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher
|
||||
Ground to introduce the album. That single though, and the rest of <I>Mothers Mi
|
||||
lk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper-
|
||||
-from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I>
|
||||
was also guitarist John Frusciantes debut with the group and he shines, especial
|
||||
ly on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential reco
|
||||
rding - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for
|
||||
the first time making their breakneck mix of funk, rap, and metal smooth enough
|
||||
to attract the masses, while keeping it raw enough not to alienate old fans. Th
|
||||
eyve straddled that edge ever since. It didnt hurt that they offered a pretty m
|
||||
ainstream cover of Stevie Wonders Higher Ground to introduce the album. That sin
|
||||
gle though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the
|
||||
randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face voca
|
||||
ls to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes deb
|
||||
ut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael
|
||||
Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit t
|
||||
heir stride with <I>Mothers Milk</I>, for the first time making their breakneck
|
||||
mix of funk, rap, and metal smooth enough to attract the masses, while keeping i
|
||||
t raw enough not to alienate old fans. Theyve straddled that edge ever since. I
|
||||
t didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Highe
|
||||
r Ground to introduce the album. That single though, and the rest of <I>Mothers
|
||||
Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Peppe
|
||||
r--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I
|
||||
> was also guitarist John Frusciantes debut with the group and he shines, especi
|
||||
ally on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential re
|
||||
cording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, f
|
||||
or the first time making their breakneck mix of funk, rap, and metal smooth enou
|
||||
gh to attract the masses, while keeping it raw enough not to alienate old fans.
|
||||
Theyve straddled that edge ever since. It didnt hurt that they offered a pretty
|
||||
mainstream cover of Stevie Wonders Higher Ground to introduce the album. That s
|
||||
ingle though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and t
|
||||
he randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vo
|
||||
cals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes d
|
||||
ebut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michae
|
||||
l Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit
|
||||
their stride with <I>Mothers Milk</I>, for the first time making their breaknec
|
||||
k mix of funk, rap, and metal smooth enough to attract the masses, while keeping
|
||||
it raw enough not to alienate old fans. Theyve straddled that edge ever since.
|
||||
It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Hig
|
||||
her Ground to introduce the album. That single though, and the rest of <I>Mother
|
||||
s Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pep
|
||||
per--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk<
|
||||
/I> was also guitarist John Frusciantes debut with the group and he shines, espe
|
||||
cially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential
|
||||
recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>,
|
||||
for the first time making their breakneck mix of funk, rap, and metal smooth en
|
||||
ough to attract the masses, while keeping it raw enough not to alienate old fans
|
||||
. Theyve straddled that edge ever since. It didnt hurt that they offered a pret
|
||||
ty mainstream cover of Stevie Wonders Higher Ground to introduce the album. That
|
||||
single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and
|
||||
the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face
|
||||
vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes
|
||||
debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Mich
|
||||
ael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally h
|
||||
it their stride with <I>Mothers Milk</I>, for the first time making their breakn
|
||||
eck mix of funk, rap, and metal smooth enough to attract the masses, while keepi
|
||||
ng it raw enough not to alienate old fans. Theyve straddled that edge ever since
|
||||
. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders H
|
||||
igher Ground to introduce the album. That single though, and the rest of <I>Moth
|
||||
ers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure P
|
||||
epper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Mil
|
||||
k</I> was also guitarist John Frusciantes debut with the group and he shines, es
|
||||
pecially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essentia
|
||||
l recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I
|
||||
>, for the first time making their breakneck mix of funk, rap, and metal smooth
|
||||
enough to attract the masses, while keeping it raw enough not to alienate old fa
|
||||
ns. Theyve straddled that edge ever since. It didnt hurt that they offered a pr
|
||||
etty mainstream cover of Stevie Wonders Higher Ground to introduce the album. Th
|
||||
at single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down a
|
||||
nd the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-fac
|
||||
e vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciant
|
||||
es debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Mi
|
||||
chael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally
|
||||
hit their stride with <I>Mothers Milk</I>, for the first time making their brea
|
||||
kneck mix of funk, rap, and metal smooth enough to attract the masses, while kee
|
||||
ping it raw enough not to alienate old fans. Theyve straddled that edge ever sin
|
||||
ce. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders
|
||||
Higher Ground to introduce the album. That single though, and the rest of <I>Mo
|
||||
thers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure
|
||||
Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>M
|
||||
ilk</I> was also guitarist John Frusciantes debut with the group and he shines,
|
||||
especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essent
|
||||
ial recording - The Chili Peppers finally hit their stride with <I>Mothers Milk<
|
||||
/I>, for the first time making their breakneck mix of funk, rap, and metal smoot
|
||||
h enough to attract the masses, while keeping it raw enough not to alienate old
|
||||
fans. Theyve straddled that edge ever since. It didnt hurt that they offered a
|
||||
pretty mainstream cover of Stevie Wonders Higher Ground to introduce the album.
|
||||
That single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down
|
||||
and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-f
|
||||
ace vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Fruscia
|
||||
ntes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--
|
||||
Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers final
|
||||
ly hit their stride with <I>Mothers Milk</I>, for the first time making their br
|
||||
eakneck mix of funk, rap, and metal smooth enough to attract the masses, while k
|
||||
eeping it raw enough not to alienate old fans. Theyve straddled that edge ever s
|
||||
ince. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonde
|
||||
rs Higher Ground to introduce the album. That single though, and the rest of <I>
|
||||
Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pu
|
||||
re Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I
|
||||
>Milk</I> was also guitarist John Frusciantes debut with the group and he shines
|
||||
, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com esse
|
||||
ntial recording - The Chili Peppers finally hit their stride with <I>Mothers Mil
|
||||
k</I>, for the first time making their breakneck mix of funk, rap, and metal smo
|
||||
oth enough to attract the masses, while keeping it raw enough not to alienate ol
|
||||
d fans. Theyve straddled that edge ever since. It didnt hurt that they offered
|
||||
a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the album
|
||||
. That single though, and the rest of <I>Mothers Milk</I> (including Knock Me Do
|
||||
wn and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your
|
||||
-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusc
|
||||
iantes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>
|
||||
--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers fin
|
||||
ally hit their stride with <I>Mothers Milk</I>, for the first time making their
|
||||
breakneck mix of funk, rap, and metal smooth enough to attract the masses, while
|
||||
keeping it raw enough not to alienate old fans. Theyve straddled that edge ever
|
||||
since. It didnt hurt that they offered a pretty mainstream cover of Stevie Won
|
||||
ders Higher Ground to introduce the album. That single though, and the rest of <
|
||||
I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is
|
||||
pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass.
|
||||
<I>Milk</I> was also guitarist John Frusciantes debut with the group and he shin
|
||||
es, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com es
|
||||
sential recording - The Chili Peppers finally hit their stride with <I>Mothers M
|
||||
ilk</I>, for the first time making their breakneck mix of funk, rap, and metal s
|
||||
mooth enough to attract the masses, while keeping it raw enough not to alienate
|
||||
old fans. Theyve straddled that edge ever since. It didnt hurt that they offere
|
||||
d a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the alb
|
||||
um. That single though, and the rest of <I>Mothers Milk</I> (including Knock Me
|
||||
Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-yo
|
||||
ur-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Fru
|
||||
sciantes debut with the group and he shines, especially on Jimi Hendrixs Fire. <
|
||||
I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers f
|
||||
inally hit their stride with <I>Mothers Milk</I>, for the first time making thei
|
||||
r breakneck mix of funk, rap, and metal smooth enough to attract the masses, whi
|
||||
le keeping it raw enough not to alienate old fans. Theyve straddled that edge ev
|
||||
er since. It didnt hurt that they offered a pretty mainstream cover of Stevie W
|
||||
onders Higher Ground to introduce the album. That single though, and the rest of
|
||||
<I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) i
|
||||
s pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass
|
||||
. <I>Milk</I> was also guitarist John Frusciantes debut with the group and he sh
|
||||
ines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com
|
||||
essential recording - The Chili Peppers finally hit their stride with <I>Mothers
|
||||
Milk</I>, for the first time making their breakneck mix of funk, rap, and metal
|
||||
smooth enough to attract the masses, while keeping it raw enough not to alienat
|
||||
e old fans. Theyve straddled that edge ever since. It didnt hurt that they offe
|
||||
red a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the a
|
||||
lbum. That single though, and the rest of <I>Mothers Milk</I> (including Knock M
|
||||
e Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-
|
||||
your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John F
|
||||
rusciantes debut with the group and he shines, especially on Jimi Hendrixs Fire.
|
||||
<I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers
|
||||
finally hit their stride with <I>Mothers Milk</I>, for the first time making th
|
||||
eir breakneck mix of funk, rap, and metal smooth enough to attract the masses, w
|
||||
hile keeping it raw enough not to alienate old fans. Theyve straddled that edge
|
||||
ever since. It didnt hurt that they offered a pretty mainstream cover of Stevie
|
||||
Wonders Higher Ground to introduce the album. That single though, and the rest
|
||||
of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid)
|
||||
is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering ba
|
||||
ss. <I>Milk</I> was also guitarist John Frusciantes debut with the group and he
|
||||
shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.co
|
||||
m essential recording - The Chili Peppers finally hit their stride with <I>Mothe
|
||||
rs Milk</I>, for the first time making their breakneck mix of funk, rap, and met
|
||||
al smooth enough to attract the masses, while keeping it raw enough not to alien
|
||||
ate old fans. Theyve straddled that edge ever since. It didnt hurt that they of
|
||||
fered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the
|
||||
album. That single though, and the rest of <I>Mothers Milk</I> (including Knock
|
||||
Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss i
|
||||
n-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John
|
||||
Frusciantes debut with the group and he shines, especially on Jimi Hendrixs Fir
|
||||
e. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppe
|
||||
rs finally hit their stride with <I>Mothers Milk</I>, for the first time making
|
||||
their breakneck mix of funk, rap, and metal smooth enough to attract the masses,
|
||||
while keeping it raw enough not to alienate old fans. Theyve straddled that edg
|
||||
e ever since. It didnt hurt that they offered a pretty mainstream cover of Stev
|
||||
ie Wonders Higher Ground to introduce the album. That single though, and the res
|
||||
t of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Mai
|
||||
d) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering
|
||||
bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group and h
|
||||
e shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.
|
||||
com essential recording - The Chili Peppers finally hit their stride with <I>Mot
|
||||
hers Milk</I>, for the first time making their breakneck mix of funk, rap, and m
|
||||
etal smooth enough to attract the masses, while keeping it raw enough not to ali
|
||||
enate old fans. Theyve straddled that edge ever since. It didnt hurt that they
|
||||
offered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce t
|
||||
he album. That single though, and the rest of <I>Mothers Milk</I> (including Kno
|
||||
ck Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss
|
||||
in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist Jo
|
||||
hn Frusciantes debut with the group and he shines, especially on Jimi Hendrixs F
|
||||
ire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Pep
|
||||
pers finally hit their stride with <I>Mothers Milk</I>, for the first time makin
|
||||
g their breakneck mix of funk, rap, and metal smooth enough to attract the masse
|
||||
s, while keeping it raw enough not to alienate old fans. Theyve straddled that e
|
||||
dge ever since. It didnt hurt that they offered a pretty mainstream cover of St
|
||||
evie Wonders Higher Ground to introduce the album. That single though, and the r
|
||||
est of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican M
|
||||
aid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chatterin
|
||||
g bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group and
|
||||
he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazo
|
||||
n.com essential recording - The Chili Peppers finally hit their stride with <I>M
|
||||
others Milk</I>, for the first time making their breakneck mix of funk, rap, and
|
||||
metal smooth enough to attract the masses, while keeping it raw enough not to a
|
||||
lienate old fans. Theyve straddled that edge ever since. It didnt hurt that the
|
||||
y offered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce
|
||||
the album. That single though, and the rest of <I>Mothers Milk</I> (including K
|
||||
nock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiedi
|
||||
ss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist
|
||||
John Frusciantes debut with the group and he shines, especially on Jimi Hendrixs
|
||||
Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili P
|
||||
eppers finally hit their stride with <I>Mothers Milk</I>, for the first time mak
|
||||
ing their breakneck mix of funk, rap, and metal smooth enough to attract the mas
|
||||
ses, while keeping it raw enough not to alienate old fans. Theyve straddled that
|
||||
edge ever since. It didnt hurt that they offered a pretty mainstream cover of
|
||||
Stevie Wonders Higher Ground to introduce the album. That single though, and the
|
||||
rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican
|
||||
Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chatter
|
||||
ing bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group a
|
||||
nd he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Ama
|
||||
zon.com essential recording - The Chili Peppers finally hit their stride with <I
|
||||
>Mothers Milk</I>, for the first time making their breakneck mix of funk, rap, a
|
||||
nd metal smooth enough to attract the masses, while keeping it raw enough not to
|
||||
alienate old fans. Theyve straddled that edge ever since. It didnt hurt that t
|
||||
hey offered a pretty mainstream cover of Stevie Wonders Higher Ground to introdu
|
||||
ce the album. That single though, and the rest of <I>Mothers Milk</I> (including
|
||||
Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kie
|
||||
diss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitaris
|
||||
t John Frusciantes debut with the group and he shines, especially on Jimi Hendri
|
||||
xs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili
|
||||
Peppers finally hit their stride with <I>Mothers Milk</I>, for the first time m
|
||||
aking their breakneck mix of funk, rap, and metal smooth enough to attract the m
|
||||
asses, while keeping it raw enough not to alienate old fans. Theyve straddled th
|
||||
at edge ever since. It didnt hurt that they offered a pretty mainstream cover o
|
||||
f Stevie Wonders Higher Ground to introduce the album. That single though, and t
|
||||
he rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexic
|
||||
an Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chatt
|
||||
ering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group
|
||||
and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: A
|
||||
mazon.com essential recording - The Chili Peppers finally hit their stride with
|
||||
<I>Mothers Milk</I>, for the first time making their breakneck mix of funk, rap,
|
||||
and metal smooth enough to attract the masses, while keeping it raw enough not
|
||||
to alienate old fans. Theyve straddled that edge ever since. It didnt hurt that
|
||||
they offered a pretty mainstream cover of Stevie Wonders Higher Ground to intro
|
||||
duce the album. That single though, and the rest of <I>Mothers Milk</I> (includi
|
||||
ng Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony K
|
||||
iediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitar
|
||||
ist John Frusciantes debut with the group and he shines, especially on Jimi Hend
|
||||
rixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chi
|
||||
li Peppers finally hit their stride with <I>Mothers Milk</I>, for the first time
|
||||
making their breakneck mix of funk, rap, and metal smooth enough to attract the
|
||||
masses, while keeping it raw enough not to alienate old fans. Theyve straddled
|
||||
that edge ever since. It didnt hurt that they offered a pretty mainstream cover
|
||||
of Stevie Wonders Higher Ground to introduce the album. That single though, and
|
||||
the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mex
|
||||
ican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas cha
|
||||
ttering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the gro
|
||||
up and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source:
|
||||
Amazon.com essential recording - The Chili Peppers finally hit their stride wit
|
||||
h <I>Mothers Milk</I>, for the first time making their breakneck mix of funk, ra
|
||||
p, and metal smooth enough to attract the masses, while keeping it raw enough no
|
||||
t to alienate old fans. Theyve straddled that edge ever since. It didnt hurt th
|
||||
at they offered a pretty mainstream cover of Stevie Wonders Higher Ground to int
|
||||
roduce the album. That single though, and the rest of <I>Mothers Milk</I> (inclu
|
||||
ding Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony
|
||||
Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guit
|
||||
arist John Frusciantes debut with the group and he shines, especially on Jimi He
|
||||
ndrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The C
|
||||
hili Peppers finally hit their stride with <I>Mothers Milk</I>, for the first ti
|
||||
me making their breakneck mix of funk, rap, and metal smooth enough to attract t
|
||||
he masses, while keeping it raw enough not to alienate old fans. Theyve straddle
|
||||
d that edge ever since. It didnt hurt that they offered a pretty mainstream cov
|
||||
er of Stevie Wonders Higher Ground to introduce the album. That single though, a
|
||||
nd the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy M
|
||||
exican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas c
|
||||
hattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the g
|
||||
roup and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Sourc
|
||||
e: Amazon.com essential recording - The Chili Peppers finally hit their stride w
|
||||
ith <I>Mothers Milk</I>, for the first time making their breakneck mix of funk,
|
||||
rap, and metal smooth enough to attract the masses, while keeping it raw enough
|
||||
not to alienate old fans. Theyve straddled that edge ever since. It didnt hurt
|
||||
that they offered a pretty mainstream cover of Stevie Wonders Higher Ground to i
|
||||
ntroduce the album. That single though, and the rest of <I>Mothers Milk</I> (inc
|
||||
luding Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Antho
|
||||
ny Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also gu
|
||||
itarist John Frusciantes debut with the group and he shines, especially on Jimi
|
||||
Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The
|
||||
Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the first
|
||||
time making their breakneck mix of funk, rap, and metal smooth enough to attract
|
||||
the masses, while keeping it raw enough not to alienate old fans. Theyve stradd
|
||||
led that edge ever since. It didnt hurt that they offered a pretty mainstream c
|
||||
over of Stevie Wonders Higher Ground to introduce the album. That single though,
|
||||
and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy
|
||||
Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas
|
||||
chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the
|
||||
group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Sou
|
||||
rce: Amazon.com essential recording - The Chili Peppers finally hit their stride
|
||||
with <I>Mothers Milk</I>, for the first time making their breakneck mix of funk
|
||||
, rap, and metal smooth enough to attract the masses, while keeping it raw enoug
|
||||
h not to alienate old fans. Theyve straddled that edge ever since. It didnt hur
|
||||
t that they offered a pretty mainstream cover of Stevie Wonders Higher Ground to
|
||||
introduce the album. That single though, and the rest of <I>Mothers Milk</I> (i
|
||||
ncluding Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Ant
|
||||
hony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also
|
||||
guitarist John Frusciantes debut with the group and he shines, especially on Jim
|
||||
i Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - T
|
||||
he Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the firs
|
||||
t time making their breakneck mix of funk, rap, and metal smooth enough to attra
|
||||
ct the masses, while keeping it raw enough not to alienate old fans. Theyve stra
|
||||
ddled that edge ever since. It didnt hurt that they offered a pretty mainstream
|
||||
cover of Stevie Wonders Higher Ground to introduce the album. That single thoug
|
||||
h, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Se
|
||||
xy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fle
|
||||
as chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with t
|
||||
he group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>S
|
||||
ource: Amazon.com essential recording - The Chili Peppers finally hit their stri
|
||||
de with <I>Mothers Milk</I>, for the first time making their breakneck mix of fu
|
||||
nk, rap, and metal smooth enough to attract the masses, while keeping it raw eno
|
||||
ugh not to alienate old fans. Theyve straddled that edge ever since. It didnt h
|
||||
urt that they offered a pretty mainstream cover of Stevie Wonders Higher Ground
|
||||
to introduce the album. That single though, and the rest of <I>Mothers Milk</I>
|
||||
(including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from A
|
||||
nthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was als
|
||||
o guitarist John Frusciantes debut with the group and he shines, especially on J
|
||||
imi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording -
|
||||
The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the fi
|
||||
rst time making their breakneck mix of funk, rap, and metal smooth enough to att
|
||||
ract the masses, while keeping it raw enough not to alienate old fans. Theyve st
|
||||
raddled that edge ever since. It didnt hurt that they offered a pretty mainstre
|
||||
am cover of Stevie Wonders Higher Ground to introduce the album. That single tho
|
||||
ugh, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy
|
||||
Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to F
|
||||
leas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with
|
||||
the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I
|
||||
>Source: Amazon.com essential recording - The Chili Peppers finally hit their st
|
||||
ride with <I>Mothers Milk</I>, for the first time making their breakneck mix of
|
||||
funk, rap, and metal smooth enough to attract the masses, while keeping it raw e
|
||||
nough not to alienate old fans. Theyve straddled that edge ever since. It didnt
|
||||
hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Groun
|
||||
d to introduce the album. That single though, and the rest of <I>Mothers Milk</I
|
||||
> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from
|
||||
Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was a
|
||||
lso guitarist John Frusciantes debut with the group and he shines, especially on
|
||||
Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording
|
||||
- The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the
|
||||
first time making their breakneck mix of funk, rap, and metal smooth enough to a
|
||||
ttract the masses, while keeping it raw enough not to alienate old fans. Theyve
|
||||
straddled that edge ever since. It didnt hurt that they offered a pretty mainst
|
||||
ream cover of Stevie Wonders Higher Ground to introduce the album. That single t
|
||||
hough, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the rand
|
||||
y Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to
|
||||
Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut wi
|
||||
th the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby<
|
||||
/I>Source: Amazon.com essential recording - The Chili Peppers finally hit their
|
||||
stride with <I>Mothers Milk</I>, for the first time making their breakneck mix o
|
||||
f funk, rap, and metal smooth enough to attract the masses, while keeping it raw
|
||||
enough not to alienate old fans. Theyve straddled that edge ever since. It did
|
||||
nt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Gro
|
||||
und to introduce the album. That single though, and the rest of <I>Mothers Milk<
|
||||
/I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--fr
|
||||
om Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was
|
||||
also guitarist John Frusciantes debut with the group and he shines, especially
|
||||
on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recordi
|
||||
ng - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for th
|
||||
e first time making their breakneck mix of funk, rap, and metal smooth enough to
|
||||
attract the masses, while keeping it raw enough not to alienate old fans. Theyv
|
||||
e straddled that edge ever since. It didnt hurt that they offered a pretty main
|
||||
stream cover of Stevie Wonders Higher Ground to introduce the album. That single
|
||||
though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the ra
|
||||
ndy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals
|
||||
to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut
|
||||
with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Rub
|
||||
y</I>Source: Amazon.com essential recording - The Chili Peppers finally hit thei
|
||||
r stride with <I>Mothers Milk</I>, for the first time making their breakneck mix
|
||||
of funk, rap, and metal smooth enough to attract the masses, while keeping it r
|
||||
aw enough not to alienate old fans. Theyve straddled that edge ever since. It d
|
||||
idnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher G
|
||||
round to introduce the album. That single though, and the rest of <I>Mothers Mil
|
||||
k</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--
|
||||
from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> w
|
||||
as also guitarist John Frusciantes debut with the group and he shines, especiall
|
||||
y on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recor
|
||||
ding - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for
|
||||
the first time making their breakneck mix of funk, rap, and metal smooth enough
|
||||
to attract the masses, while keeping it raw enough not to alienate old fans. The
|
||||
yve straddled that edge ever since. It didnt hurt that they offered a pretty ma
|
||||
instream cover of Stevie Wonders Higher Ground to introduce the album. That sing
|
||||
le though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the
|
||||
randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocal
|
||||
s to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debu
|
||||
t with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael R
|
||||
uby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit th
|
||||
eir stride with <I>Mothers Milk</I>, for the first time making their breakneck m
|
||||
ix of funk, rap, and metal smooth enough to attract the masses, while keeping it
|
||||
raw enough not to alienate old fans. Theyve straddled that edge ever since. It
|
||||
didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher
|
||||
Ground to introduce the album. That single though, and the rest of <I>Mothers M
|
||||
ilk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper
|
||||
--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I>
|
||||
was also guitarist John Frusciantes debut with the group and he shines, especia
|
||||
lly on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential rec
|
||||
ording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, fo
|
||||
r the first time making their breakneck mix of funk, rap, and metal smooth enoug
|
||||
h to attract the masses, while keeping it raw enough not to alienate old fans. T
|
||||
heyve straddled that edge ever since. It didnt hurt that they offered a pretty
|
||||
mainstream cover of Stevie Wonders Higher Ground to introduce the album. That si
|
||||
ngle though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and th
|
||||
e randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face voc
|
||||
als to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes de
|
||||
but with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael
|
||||
Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit
|
||||
their stride with <I>Mothers Milk</I>, for the first time making their breakneck
|
||||
mix of funk, rap, and metal smooth enough to attract the masses, while keeping
|
||||
it raw enough not to alienate old fans. Theyve straddled that edge ever since.
|
||||
It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders High
|
||||
er Ground to introduce the album. That single though, and the rest of <I>Mothers
|
||||
Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepp
|
||||
er--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</
|
||||
I> was also guitarist John Frusciantes debut with the group and he shines, espec
|
||||
ially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential r
|
||||
ecording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>,
|
||||
for the first time making their breakneck mix of funk, rap, and metal smooth eno
|
||||
ugh to attract the masses, while keeping it raw enough not to alienate old fans.
|
||||
Theyve straddled that edge ever since. It didnt hurt that they offered a prett
|
||||
y mainstream cover of Stevie Wonders Higher Ground to introduce the album. That
|
||||
single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and
|
||||
the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face v
|
||||
ocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes
|
||||
debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Micha
|
||||
el Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hi
|
||||
t their stride with <I>Mothers Milk</I>, for the first time making their breakne
|
||||
ck mix of funk, rap, and metal smooth enough to attract the masses, while keepin
|
||||
g it raw enough not to alienate old fans. Theyve straddled that edge ever since.
|
||||
It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Hi
|
||||
gher Ground to introduce the album. That single though, and the rest of <I>Mothe
|
||||
rs Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pe
|
||||
pper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk
|
||||
</I> was also guitarist John Frusciantes debut with the group and he shines, esp
|
||||
ecially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential
|
||||
recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>
|
||||
, for the first time making their breakneck mix of funk, rap, and metal smooth e
|
||||
nough to attract the masses, while keeping it raw enough not to alienate old fan
|
||||
s. Theyve straddled that edge ever since. It didnt hurt that they offered a pre
|
||||
tty mainstream cover of Stevie Wonders Higher Ground to introduce the album. Tha
|
||||
t single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down an
|
||||
d the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face
|
||||
vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciante
|
||||
s debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Mic
|
||||
hael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally
|
||||
hit their stride with <I>Mothers Milk</I>, for the first time making their break
|
||||
neck mix of funk, rap, and metal smooth enough to attract the masses, while keep
|
||||
ing it raw enough not to alienate old fans. Theyve straddled that edge ever sinc
|
||||
e. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders
|
||||
Higher Ground to introduce the album. That single though, and the rest of <I>Mot
|
||||
hers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure
|
||||
Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Mi
|
||||
lk</I> was also guitarist John Frusciantes debut with the group and he shines, e
|
||||
specially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essenti
|
||||
al recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</
|
||||
I>, for the first time making their breakneck mix of funk, rap, and metal smooth
|
||||
enough to attract the masses, while keeping it raw enough not to alienate old f
|
||||
ans. Theyve straddled that edge ever since. It didnt hurt that they offered a p
|
||||
retty mainstream cover of Stevie Wonders Higher Ground to introduce the album. T
|
||||
hat single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down
|
||||
and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-fa
|
||||
ce vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Fruscian
|
||||
tes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--M
|
||||
ichael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finall
|
||||
y hit their stride with <I>Mothers Milk</I>, for the first time making their bre
|
||||
akneck mix of funk, rap, and metal smooth enough to attract the masses, while ke
|
||||
eping it raw enough not to alienate old fans. Theyve straddled that edge ever si
|
||||
nce. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonder
|
||||
s Higher Ground to introduce the album. That single though, and the rest of <I>M
|
||||
others Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pur
|
||||
e Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>
|
||||
Milk</I> was also guitarist John Frusciantes debut with the group and he shines,
|
||||
especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essen
|
||||
tial recording - The Chili Peppers finally hit their stride with <I>Mothers Milk
|
||||
</I>, for the first time making their breakneck mix of funk, rap, and metal smoo
|
||||
th enough to attract the masses, while keeping it raw enough not to alienate old
|
||||
fans. Theyve straddled that edge ever since. It didnt hurt that they offered a
|
||||
pretty mainstream cover of Stevie Wonders Higher Ground to introduce the album.
|
||||
That single though, and the rest of <I>Mothers Milk</I> (including Knock Me Dow
|
||||
n and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-
|
||||
face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusci
|
||||
antes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>-
|
||||
-Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers fina
|
||||
lly hit their stride with <I>Mothers Milk</I>, for the first time making their b
|
||||
reakneck mix of funk, rap, and metal smooth enough to attract the masses, while
|
||||
keeping it raw enough not to alienate old fans. Theyve straddled that edge ever
|
||||
since. It didnt hurt that they offered a pretty mainstream cover of Stevie Wond
|
||||
ers Higher Ground to introduce the album. That single though, and the rest of <I
|
||||
>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is p
|
||||
ure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <
|
||||
I>Milk</I> was also guitarist John Frusciantes debut with the group and he shine
|
||||
s, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com ess
|
||||
ential recording - The Chili Peppers finally hit their stride with <I>Mothers Mi
|
||||
lk</I>, for the first time making their breakneck mix of funk, rap, and metal sm
|
||||
ooth enough to attract the masses, while keeping it raw enough not to alienate o
|
||||
ld fans. Theyve straddled that edge ever since. It didnt hurt that they offered
|
||||
a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the albu
|
||||
m. That single though, and the rest of <I>Mothers Milk</I> (including Knock Me D
|
||||
own and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-you
|
||||
r-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frus
|
||||
ciantes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I
|
||||
>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers fi
|
||||
nally hit their stride with <I>Mothers Milk</I>, for the first time making their
|
||||
breakneck mix of funk, rap, and metal smooth enough to attract the masses, whil
|
||||
e keeping it raw enough not to alienate old fans. Theyve straddled that edge eve
|
||||
r since. It didnt hurt that they offered a pretty mainstream cover of Stevie Wo
|
||||
nders Higher Ground to introduce the album. That single though, and the rest of
|
||||
<I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is
|
||||
pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass.
|
||||
<I>Milk</I> was also guitarist John Frusciantes debut with the group and he shi
|
||||
nes, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com e
|
||||
ssential recording - The Chili Peppers finally hit their stride with <I>Mothers
|
||||
Milk</I>, for the first time making their breakneck mix of funk, rap, and metal
|
||||
smooth enough to attract the masses, while keeping it raw enough not to alienate
|
||||
old fans. Theyve straddled that edge ever since. It didnt hurt that they offer
|
||||
ed a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the al
|
||||
bum. That single though, and the rest of <I>Mothers Milk</I> (including Knock Me
|
||||
Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-y
|
||||
our-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Fr
|
||||
usciantes debut with the group and he shines, especially on Jimi Hendrixs Fire.
|
||||
<I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers
|
||||
finally hit their stride with <I>Mothers Milk</I>, for the first time making the
|
||||
ir breakneck mix of funk, rap, and metal smooth enough to attract the masses, wh
|
||||
ile keeping it raw enough not to alienate old fans. Theyve straddled that edge e
|
||||
ver since. It didnt hurt that they offered a pretty mainstream cover of Stevie
|
||||
Wonders Higher Ground to introduce the album. That single though, and the rest o
|
||||
f <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid)
|
||||
is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bas
|
||||
s. <I>Milk</I> was also guitarist John Frusciantes debut with the group and he s
|
||||
hines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com
|
||||
essential recording - The Chili Peppers finally hit their stride with <I>Mother
|
||||
s Milk</I>, for the first time making their breakneck mix of funk, rap, and meta
|
||||
l smooth enough to attract the masses, while keeping it raw enough not to aliena
|
||||
te old fans. Theyve straddled that edge ever since. It didnt hurt that they off
|
||||
ered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce the
|
||||
album. That single though, and the rest of <I>Mothers Milk</I> (including Knock
|
||||
Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in
|
||||
-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John
|
||||
Frusciantes debut with the group and he shines, especially on Jimi Hendrixs Fire
|
||||
. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Pepper
|
||||
s finally hit their stride with <I>Mothers Milk</I>, for the first time making t
|
||||
heir breakneck mix of funk, rap, and metal smooth enough to attract the masses,
|
||||
while keeping it raw enough not to alienate old fans. Theyve straddled that edge
|
||||
ever since. It didnt hurt that they offered a pretty mainstream cover of Stevi
|
||||
e Wonders Higher Ground to introduce the album. That single though, and the rest
|
||||
of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid
|
||||
) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering b
|
||||
ass. <I>Milk</I> was also guitarist John Frusciantes debut with the group and he
|
||||
shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.c
|
||||
om essential recording - The Chili Peppers finally hit their stride with <I>Moth
|
||||
ers Milk</I>, for the first time making their breakneck mix of funk, rap, and me
|
||||
tal smooth enough to attract the masses, while keeping it raw enough not to alie
|
||||
nate old fans. Theyve straddled that edge ever since. It didnt hurt that they o
|
||||
ffered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce th
|
||||
e album. That single though, and the rest of <I>Mothers Milk</I> (including Knoc
|
||||
k Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss
|
||||
in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist Joh
|
||||
n Frusciantes debut with the group and he shines, especially on Jimi Hendrixs Fi
|
||||
re. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Pepp
|
||||
ers finally hit their stride with <I>Mothers Milk</I>, for the first time making
|
||||
their breakneck mix of funk, rap, and metal smooth enough to attract the masses
|
||||
, while keeping it raw enough not to alienate old fans. Theyve straddled that ed
|
||||
ge ever since. It didnt hurt that they offered a pretty mainstream cover of Ste
|
||||
vie Wonders Higher Ground to introduce the album. That single though, and the re
|
||||
st of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican Ma
|
||||
id) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering
|
||||
bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group and
|
||||
he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon
|
||||
.com essential recording - The Chili Peppers finally hit their stride with <I>Mo
|
||||
thers Milk</I>, for the first time making their breakneck mix of funk, rap, and
|
||||
metal smooth enough to attract the masses, while keeping it raw enough not to al
|
||||
ienate old fans. Theyve straddled that edge ever since. It didnt hurt that they
|
||||
offered a pretty mainstream cover of Stevie Wonders Higher Ground to introduce
|
||||
the album. That single though, and the rest of <I>Mothers Milk</I> (including Kn
|
||||
ock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiedis
|
||||
s in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist J
|
||||
ohn Frusciantes debut with the group and he shines, especially on Jimi Hendrixs
|
||||
Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili Pe
|
||||
ppers finally hit their stride with <I>Mothers Milk</I>, for the first time maki
|
||||
ng their breakneck mix of funk, rap, and metal smooth enough to attract the mass
|
||||
es, while keeping it raw enough not to alienate old fans. Theyve straddled that
|
||||
edge ever since. It didnt hurt that they offered a pretty mainstream cover of S
|
||||
tevie Wonders Higher Ground to introduce the album. That single though, and the
|
||||
rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexican
|
||||
Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chatteri
|
||||
ng bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group an
|
||||
d he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amaz
|
||||
on.com essential recording - The Chili Peppers finally hit their stride with <I>
|
||||
Mothers Milk</I>, for the first time making their breakneck mix of funk, rap, an
|
||||
d metal smooth enough to attract the masses, while keeping it raw enough not to
|
||||
alienate old fans. Theyve straddled that edge ever since. It didnt hurt that th
|
||||
ey offered a pretty mainstream cover of Stevie Wonders Higher Ground to introduc
|
||||
e the album. That single though, and the rest of <I>Mothers Milk</I> (including
|
||||
Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kied
|
||||
iss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitarist
|
||||
John Frusciantes debut with the group and he shines, especially on Jimi Hendrix
|
||||
s Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chili
|
||||
Peppers finally hit their stride with <I>Mothers Milk</I>, for the first time ma
|
||||
king their breakneck mix of funk, rap, and metal smooth enough to attract the ma
|
||||
sses, while keeping it raw enough not to alienate old fans. Theyve straddled tha
|
||||
t edge ever since. It didnt hurt that they offered a pretty mainstream cover of
|
||||
Stevie Wonders Higher Ground to introduce the album. That single though, and th
|
||||
e rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexica
|
||||
n Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chatte
|
||||
ring bass. <I>Milk</I> was also guitarist John Frusciantes debut with the group
|
||||
and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Am
|
||||
azon.com essential recording - The Chili Peppers finally hit their stride with <
|
||||
I>Mothers Milk</I>, for the first time making their breakneck mix of funk, rap,
|
||||
and metal smooth enough to attract the masses, while keeping it raw enough not t
|
||||
o alienate old fans. Theyve straddled that edge ever since. It didnt hurt that
|
||||
they offered a pretty mainstream cover of Stevie Wonders Higher Ground to introd
|
||||
uce the album. That single though, and the rest of <I>Mothers Milk</I> (includin
|
||||
g Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Ki
|
||||
ediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guitari
|
||||
st John Frusciantes debut with the group and he shines, especially on Jimi Hendr
|
||||
ixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Chil
|
||||
i Peppers finally hit their stride with <I>Mothers Milk</I>, for the first time
|
||||
making their breakneck mix of funk, rap, and metal smooth enough to attract the
|
||||
masses, while keeping it raw enough not to alienate old fans. Theyve straddled t
|
||||
hat edge ever since. It didnt hurt that they offered a pretty mainstream cover
|
||||
of Stevie Wonders Higher Ground to introduce the album. That single though, and
|
||||
the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Mexi
|
||||
can Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas chat
|
||||
tering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the grou
|
||||
p and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source:
|
||||
Amazon.com essential recording - The Chili Peppers finally hit their stride with
|
||||
<I>Mothers Milk</I>, for the first time making their breakneck mix of funk, rap
|
||||
, and metal smooth enough to attract the masses, while keeping it raw enough not
|
||||
to alienate old fans. Theyve straddled that edge ever since. It didnt hurt tha
|
||||
t they offered a pretty mainstream cover of Stevie Wonders Higher Ground to intr
|
||||
oduce the album. That single though, and the rest of <I>Mothers Milk</I> (includ
|
||||
ing Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthony
|
||||
Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also guita
|
||||
rist John Frusciantes debut with the group and he shines, especially on Jimi Hen
|
||||
drixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The Ch
|
||||
ili Peppers finally hit their stride with <I>Mothers Milk</I>, for the first tim
|
||||
e making their breakneck mix of funk, rap, and metal smooth enough to attract th
|
||||
e masses, while keeping it raw enough not to alienate old fans. Theyve straddled
|
||||
that edge ever since. It didnt hurt that they offered a pretty mainstream cove
|
||||
r of Stevie Wonders Higher Ground to introduce the album. That single though, an
|
||||
d the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy Me
|
||||
xican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas ch
|
||||
attering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the gr
|
||||
oup and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source
|
||||
: Amazon.com essential recording - The Chili Peppers finally hit their stride wi
|
||||
th <I>Mothers Milk</I>, for the first time making their breakneck mix of funk, r
|
||||
ap, and metal smooth enough to attract the masses, while keeping it raw enough n
|
||||
ot to alienate old fans. Theyve straddled that edge ever since. It didnt hurt t
|
||||
hat they offered a pretty mainstream cover of Stevie Wonders Higher Ground to in
|
||||
troduce the album. That single though, and the rest of <I>Mothers Milk</I> (incl
|
||||
uding Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anthon
|
||||
y Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also gui
|
||||
tarist John Frusciantes debut with the group and he shines, especially on Jimi H
|
||||
endrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - The
|
||||
Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the first t
|
||||
ime making their breakneck mix of funk, rap, and metal smooth enough to attract
|
||||
the masses, while keeping it raw enough not to alienate old fans. Theyve straddl
|
||||
ed that edge ever since. It didnt hurt that they offered a pretty mainstream co
|
||||
ver of Stevie Wonders Higher Ground to introduce the album. That single though,
|
||||
and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sexy
|
||||
Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fleas
|
||||
chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with the
|
||||
group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Sour
|
||||
ce: Amazon.com essential recording - The Chili Peppers finally hit their stride
|
||||
with <I>Mothers Milk</I>, for the first time making their breakneck mix of funk,
|
||||
rap, and metal smooth enough to attract the masses, while keeping it raw enough
|
||||
not to alienate old fans. Theyve straddled that edge ever since. It didnt hurt
|
||||
that they offered a pretty mainstream cover of Stevie Wonders Higher Ground to
|
||||
introduce the album. That single though, and the rest of <I>Mothers Milk</I> (in
|
||||
cluding Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from Anth
|
||||
ony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also g
|
||||
uitarist John Frusciantes debut with the group and he shines, especially on Jimi
|
||||
Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording - Th
|
||||
e Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the first
|
||||
time making their breakneck mix of funk, rap, and metal smooth enough to attrac
|
||||
t the masses, while keeping it raw enough not to alienate old fans. Theyve strad
|
||||
dled that edge ever since. It didnt hurt that they offered a pretty mainstream
|
||||
cover of Stevie Wonders Higher Ground to introduce the album. That single though
|
||||
, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy Sex
|
||||
y Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Flea
|
||||
s chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with th
|
||||
e group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>So
|
||||
urce: Amazon.com essential recording - The Chili Peppers finally hit their strid
|
||||
e with <I>Mothers Milk</I>, for the first time making their breakneck mix of fun
|
||||
k, rap, and metal smooth enough to attract the masses, while keeping it raw enou
|
||||
gh not to alienate old fans. Theyve straddled that edge ever since. It didnt hu
|
||||
rt that they offered a pretty mainstream cover of Stevie Wonders Higher Ground t
|
||||
o introduce the album. That single though, and the rest of <I>Mothers Milk</I> (
|
||||
including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from An
|
||||
thony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was also
|
||||
guitarist John Frusciantes debut with the group and he shines, especially on Ji
|
||||
mi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording -
|
||||
The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the fir
|
||||
st time making their breakneck mix of funk, rap, and metal smooth enough to attr
|
||||
act the masses, while keeping it raw enough not to alienate old fans. Theyve str
|
||||
addled that edge ever since. It didnt hurt that they offered a pretty mainstrea
|
||||
m cover of Stevie Wonders Higher Ground to introduce the album. That single thou
|
||||
gh, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy S
|
||||
exy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to Fl
|
||||
eas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut with
|
||||
the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>
|
||||
Source: Amazon.com essential recording - The Chili Peppers finally hit their str
|
||||
ide with <I>Mothers Milk</I>, for the first time making their breakneck mix of f
|
||||
unk, rap, and metal smooth enough to attract the masses, while keeping it raw en
|
||||
ough not to alienate old fans. Theyve straddled that edge ever since. It didnt
|
||||
hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Ground
|
||||
to introduce the album. That single though, and the rest of <I>Mothers Milk</I>
|
||||
(including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--from
|
||||
Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was al
|
||||
so guitarist John Frusciantes debut with the group and he shines, especially on
|
||||
Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recording
|
||||
- The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the f
|
||||
irst time making their breakneck mix of funk, rap, and metal smooth enough to at
|
||||
tract the masses, while keeping it raw enough not to alienate old fans. Theyve s
|
||||
traddled that edge ever since. It didnt hurt that they offered a pretty mainstr
|
||||
eam cover of Stevie Wonders Higher Ground to introduce the album. That single th
|
||||
ough, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the randy
|
||||
Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals to
|
||||
Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut wit
|
||||
h the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby</
|
||||
I>Source: Amazon.com essential recording - The Chili Peppers finally hit their s
|
||||
tride with <I>Mothers Milk</I>, for the first time making their breakneck mix of
|
||||
funk, rap, and metal smooth enough to attract the masses, while keeping it raw
|
||||
enough not to alienate old fans. Theyve straddled that edge ever since. It didn
|
||||
t hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Grou
|
||||
nd to introduce the album. That single though, and the rest of <I>Mothers Milk</
|
||||
I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--fro
|
||||
m Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> was
|
||||
also guitarist John Frusciantes debut with the group and he shines, especially o
|
||||
n Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential recordin
|
||||
g - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for the
|
||||
first time making their breakneck mix of funk, rap, and metal smooth enough to
|
||||
attract the masses, while keeping it raw enough not to alienate old fans. Theyve
|
||||
straddled that edge ever since. It didnt hurt that they offered a pretty mains
|
||||
tream cover of Stevie Wonders Higher Ground to introduce the album. That single
|
||||
though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the ran
|
||||
dy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals t
|
||||
o Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut w
|
||||
ith the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ruby
|
||||
</I>Source: Amazon.com essential recording - The Chili Peppers finally hit their
|
||||
stride with <I>Mothers Milk</I>, for the first time making their breakneck mix
|
||||
of funk, rap, and metal smooth enough to attract the masses, while keeping it ra
|
||||
w enough not to alienate old fans. Theyve straddled that edge ever since. It di
|
||||
dnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher Gr
|
||||
ound to introduce the album. That single though, and the rest of <I>Mothers Milk
|
||||
</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper--f
|
||||
rom Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I> wa
|
||||
s also guitarist John Frusciantes debut with the group and he shines, especially
|
||||
on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential record
|
||||
ing - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for t
|
||||
he first time making their breakneck mix of funk, rap, and metal smooth enough t
|
||||
o attract the masses, while keeping it raw enough not to alienate old fans. They
|
||||
ve straddled that edge ever since. It didnt hurt that they offered a pretty mai
|
||||
nstream cover of Stevie Wonders Higher Ground to introduce the album. That singl
|
||||
e though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the r
|
||||
andy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vocals
|
||||
to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes debut
|
||||
with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael Ru
|
||||
by</I>Source: Amazon.com essential recording - The Chili Peppers finally hit the
|
||||
ir stride with <I>Mothers Milk</I>, for the first time making their breakneck mi
|
||||
x of funk, rap, and metal smooth enough to attract the masses, while keeping it
|
||||
raw enough not to alienate old fans. Theyve straddled that edge ever since. It
|
||||
didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Higher
|
||||
Ground to introduce the album. That single though, and the rest of <I>Mothers Mi
|
||||
lk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pepper-
|
||||
-from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I>
|
||||
was also guitarist John Frusciantes debut with the group and he shines, especial
|
||||
ly on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential reco
|
||||
rding - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, for
|
||||
the first time making their breakneck mix of funk, rap, and metal smooth enough
|
||||
to attract the masses, while keeping it raw enough not to alienate old fans. Th
|
||||
eyve straddled that edge ever since. It didnt hurt that they offered a pretty m
|
||||
ainstream cover of Stevie Wonders Higher Ground to introduce the album. That sin
|
||||
gle though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and the
|
||||
randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face voca
|
||||
ls to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes deb
|
||||
ut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michael
|
||||
Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit t
|
||||
heir stride with <I>Mothers Milk</I>, for the first time making their breakneck
|
||||
mix of funk, rap, and metal smooth enough to attract the masses, while keeping i
|
||||
t raw enough not to alienate old fans. Theyve straddled that edge ever since. I
|
||||
t didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Highe
|
||||
r Ground to introduce the album. That single though, and the rest of <I>Mothers
|
||||
Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Peppe
|
||||
r--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk</I
|
||||
> was also guitarist John Frusciantes debut with the group and he shines, especi
|
||||
ally on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential re
|
||||
cording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>, f
|
||||
or the first time making their breakneck mix of funk, rap, and metal smooth enou
|
||||
gh to attract the masses, while keeping it raw enough not to alienate old fans.
|
||||
Theyve straddled that edge ever since. It didnt hurt that they offered a pretty
|
||||
mainstream cover of Stevie Wonders Higher Ground to introduce the album. That s
|
||||
ingle though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and t
|
||||
he randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face vo
|
||||
cals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes d
|
||||
ebut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Michae
|
||||
l Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally hit
|
||||
their stride with <I>Mothers Milk</I>, for the first time making their breaknec
|
||||
k mix of funk, rap, and metal smooth enough to attract the masses, while keeping
|
||||
it raw enough not to alienate old fans. Theyve straddled that edge ever since.
|
||||
It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders Hig
|
||||
her Ground to introduce the album. That single though, and the rest of <I>Mother
|
||||
s Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure Pep
|
||||
per--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Milk<
|
||||
/I> was also guitarist John Frusciantes debut with the group and he shines, espe
|
||||
cially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essential
|
||||
recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I>,
|
||||
for the first time making their breakneck mix of funk, rap, and metal smooth en
|
||||
ough to attract the masses, while keeping it raw enough not to alienate old fans
|
||||
. Theyve straddled that edge ever since. It didnt hurt that they offered a pret
|
||||
ty mainstream cover of Stevie Wonders Higher Ground to introduce the album. That
|
||||
single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down and
|
||||
the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-face
|
||||
vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciantes
|
||||
debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Mich
|
||||
ael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally h
|
||||
it their stride with <I>Mothers Milk</I>, for the first time making their breakn
|
||||
eck mix of funk, rap, and metal smooth enough to attract the masses, while keepi
|
||||
ng it raw enough not to alienate old fans. Theyve straddled that edge ever since
|
||||
. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders H
|
||||
igher Ground to introduce the album. That single though, and the rest of <I>Moth
|
||||
ers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure P
|
||||
epper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>Mil
|
||||
k</I> was also guitarist John Frusciantes debut with the group and he shines, es
|
||||
pecially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essentia
|
||||
l recording - The Chili Peppers finally hit their stride with <I>Mothers Milk</I
|
||||
>, for the first time making their breakneck mix of funk, rap, and metal smooth
|
||||
enough to attract the masses, while keeping it raw enough not to alienate old fa
|
||||
ns. Theyve straddled that edge ever since. It didnt hurt that they offered a pr
|
||||
etty mainstream cover of Stevie Wonders Higher Ground to introduce the album. Th
|
||||
at single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down a
|
||||
nd the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-fac
|
||||
e vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Frusciant
|
||||
es debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--Mi
|
||||
chael Ruby</I>Source: Amazon.com essential recording - The Chili Peppers finally
|
||||
hit their stride with <I>Mothers Milk</I>, for the first time making their brea
|
||||
kneck mix of funk, rap, and metal smooth enough to attract the masses, while kee
|
||||
ping it raw enough not to alienate old fans. Theyve straddled that edge ever sin
|
||||
ce. It didnt hurt that they offered a pretty mainstream cover of Stevie Wonders
|
||||
Higher Ground to introduce the album. That single though, and the rest of <I>Mo
|
||||
thers Milk</I> (including Knock Me Down and the randy Sexy Mexican Maid) is pure
|
||||
Pepper--from Anthony Kiediss in-your-face vocals to Fleas chattering bass. <I>M
|
||||
ilk</I> was also guitarist John Frusciantes debut with the group and he shines,
|
||||
especially on Jimi Hendrixs Fire. <I>--Michael Ruby</I>Source: Amazon.com essent
|
||||
ial recording - The Chili Peppers finally hit their stride with <I>Mothers Milk<
|
||||
/I>, for the first time making their breakneck mix of funk, rap, and metal smoot
|
||||
h enough to attract the masses, while keeping it raw enough not to alienate old
|
||||
fans. Theyve straddled that edge ever since. It didnt hurt that they offered a
|
||||
pretty mainstream cover of Stevie Wonders Higher Ground to introduce the album.
|
||||
That single though, and the rest of <I>Mothers Milk</I> (including Knock Me Down
|
||||
and the randy Sexy Mexican Maid) is pure Pepper--from Anthony Kiediss in-your-f
|
||||
ace vocals to Fleas chattering bass. <I>Milk</I> was also guitarist John Fruscia
|
||||
ntes debut with the group and he shines, especially on Jimi Hendrixs Fire. <I>--
|
||||
Michael Ruby</I>
|
||||
length = 73056
|
||||
|
||||
Source: Amazon.com essential recording - What <I>Highway to Hell</I> has that <I
|
||||
>Back in Black</I> doesnt is Bon Scott, AC/DCs original lead singer who died jus
|
||||
t months after this album was released. Scott had a rusty, raspy, scream of a vo
|
||||
ice, like he might break into a coughing fit at any moment. In other words, on c
|
||||
runchy, hook-heavy metal classics like the title track, and on Get It Hot which
|
||||
is more roadhouse rock than metal, he had the perfect instrument for such wild-l
|
||||
iving anthems. Too perfect, it turned out. <i>--David Cantwell</i>
|
||||
length = 547
|
97
test/sqlsrv/sqlsrv_rowsAffected.phpt
Normal file
97
test/sqlsrv/sqlsrv_rowsAffected.phpt
Normal file
|
@ -0,0 +1,97 @@
|
|||
--TEST--
|
||||
sqlsrv_stmt_rows_affected.
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL );
|
||||
sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_OFF );
|
||||
|
||||
require( 'MsCommon.inc' );
|
||||
|
||||
$conn = Connect();
|
||||
if( !$conn ) {
|
||||
FatalError( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
$result = sqlsrv_execute( $stmt );
|
||||
if( !$result ) {
|
||||
$errors = sqlsrv_errors();
|
||||
if( $errors[0]["SQLSTATE"] != "42S02" ) {
|
||||
var_dump( $errors );
|
||||
die( "sqlsrv_execute(2) failed." );
|
||||
}
|
||||
}
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varchar(4000))" );
|
||||
$result = sqlsrv_execute( $stmt );
|
||||
if( !$result ) {
|
||||
FatalError( "sqlsrv_execute(3) failed." );
|
||||
}
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
$stmt = sqlsrv_prepare( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)", array( &$f1, &$f2, &$f3, &$f4 ));
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_prepare(4) failed." );
|
||||
}
|
||||
|
||||
for( $record = 1; $record <= 4; ++$record ) {
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
FatalError( "sqlsrv_execute($record) failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data failed." );
|
||||
}
|
||||
$row_count = sqlsrv_rows_affected( $stmt );
|
||||
if( $row_count != 1 ) {
|
||||
if( $row_count == -1 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
die( "sqlsrv_rows_returned $row_count instead of 1" );
|
||||
}
|
||||
echo "rows = $row_count<br/>\n";
|
||||
}
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$stmt = sqlsrv_prepare( $conn, "UPDATE test_params SET [double] = 13.0 FROM test_params WHERE [double] = 12.0" );
|
||||
if( !$stmt ) {
|
||||
FatalError( "sqlsrv_prepare(2) failed." );
|
||||
}
|
||||
$success = sqlsrv_execute( $stmt );
|
||||
if( !$success ) {
|
||||
FatalError( "sqlsrv_execute(5) failed." );
|
||||
}
|
||||
$row_count = sqlsrv_rows_affected( $stmt );
|
||||
if( $row_count != 4 ) {
|
||||
if( $row_count == -1 ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
}
|
||||
die( "sqlsrv_rows_returned $row_count instead of 1" );
|
||||
}
|
||||
echo "rows = $row_count<br/>\n";
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
rows = 1<br/>
|
||||
rows = 1<br/>
|
||||
rows = 1<br/>
|
||||
rows = 1<br/>
|
||||
rows = 4<br/>
|
||||
|
175
test/sqlsrv/sqlsrv_send_stream_data.phpt
Normal file
175
test/sqlsrv/sqlsrv_send_stream_data.phpt
Normal file
|
@ -0,0 +1,175 @@
|
|||
--TEST--
|
||||
binding streams using full syntax.
|
||||
--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 ) {
|
||||
FatalError( "Failed to connect." );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "IF OBJECT_ID('test_params', 'U') IS NOT NULL DROP TABLE test_params" );
|
||||
if( $stmt !== false ) {
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_query( $conn, "CREATE TABLE test_params (id tinyint, name char(10), [double] float, stuff varbinary(max))" );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
|
||||
$f1 = 1;
|
||||
$f2 = "testtestte";
|
||||
$f3 = 12.0;
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
|
||||
// use full details
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)",
|
||||
array(
|
||||
array( &$f1, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_INT, SQLSRV_SQLTYPE_TINYINT ),
|
||||
array( &$f2, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_CHAR(10)),
|
||||
array( &$f3, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_FLOAT, SQLSRV_SQLTYPE_FLOAT),
|
||||
array( &$f4, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max'))));
|
||||
if( $stmt === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_query(1) failed." );
|
||||
}
|
||||
while( $success = sqlsrv_send_stream_data( $stmt )) {
|
||||
}
|
||||
if( !is_null( $success )) {
|
||||
print_r( sqlsrv_errors() );
|
||||
sqlsrv_cancel( $stmt );
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_send_stream_data(1) failed." );
|
||||
}
|
||||
|
||||
fclose( $f4 );
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
// use nulls for php types
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)",
|
||||
array(
|
||||
array( &$f1, SQLSRV_PARAM_IN, null, SQLSRV_SQLTYPE_TINYINT ),
|
||||
array( &$f2, SQLSRV_PARAM_IN, null, SQLSRV_SQLTYPE_CHAR(10)),
|
||||
array( &$f3, SQLSRV_PARAM_IN, null, SQLSRV_SQLTYPE_FLOAT),
|
||||
array( &$f4, SQLSRV_PARAM_IN, null, SQLSRV_SQLTYPE_VARBINARY('max'))));
|
||||
if( $stmt !== false ) {
|
||||
die( "sqlsrv_query(2) should have failed." );
|
||||
}
|
||||
print_r( sqlsrv_errors() );
|
||||
print_r( "sqlsrv_query(2) failed.\n" );
|
||||
fclose( $f4 );
|
||||
|
||||
// try it with nothing but default values
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
// use nulls for php types
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)",
|
||||
array(
|
||||
array( &$f1, null, null, null ),
|
||||
array( &$f2, null, null, null ),
|
||||
array( &$f3, null, null, null ),
|
||||
array( &$f4, null, null, null )));
|
||||
if( $stmt === false ) {
|
||||
print_r( sqlsrv_errors() );
|
||||
print_r( "sqlsrv_query(3) failed.\n" );
|
||||
}
|
||||
else {
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
die( "sqlsrv_query(3) shouldn't have succeeded." );
|
||||
}
|
||||
|
||||
// print out the results for comparison
|
||||
$stmt = sqlsrv_query( $conn, "SELECT id, [double], name, stuff FROM test_params" );
|
||||
if( $stmt === false ) {
|
||||
var_dump( sqlsrv_errors() );
|
||||
die( "sqlsrv_execute failed." );
|
||||
}
|
||||
while( sqlsrv_fetch( $stmt )) {
|
||||
$id = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$id\n";
|
||||
$double = sqlsrv_get_field( $stmt, 1, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$double\n";
|
||||
$name = sqlsrv_get_field( $stmt, 2, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR));
|
||||
echo "$name\n";
|
||||
$stream = sqlsrv_get_field( $stmt, 3, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY));
|
||||
while( !feof( $stream )) {
|
||||
$str = fread( $stream, 10000 );
|
||||
echo $str;
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
sqlsrv_free_stmt( $stmt );
|
||||
fclose( $f4 );
|
||||
|
||||
// try it with nothing but default values
|
||||
$f4 = fopen( "data://text/plain,This%20is%20some%20text%20meant%20to%20test%20binding%20parameters%20to%20streams", "r" );
|
||||
// use nulls for php types
|
||||
$stmt = sqlsrv_query( $conn, "INSERT INTO test_params (id, name, [double], stuff) VALUES (?, ?, ?, ?)",
|
||||
array(
|
||||
array( &$f1, null, null, null ),
|
||||
array(),
|
||||
array( &$f3, null, null, null ),
|
||||
array( &$f4, null, null, null )));
|
||||
if( $stmt !== false ) {
|
||||
die( "sqlsrv_query should have failed." );
|
||||
}
|
||||
var_dump( sqlsrv_errors() );
|
||||
fclose( $f4 );
|
||||
|
||||
sqlsrv_query( $conn, "DROP TABLE test_params" );
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => 22018
|
||||
[SQLSTATE] => 22018
|
||||
[1] => 0
|
||||
[code] => 0
|
||||
[2] => %SInvalid character value for cast specification
|
||||
[message] => %SInvalid character value for cast specification
|
||||
)
|
||||
|
||||
)
|
||||
sqlsrv_query(2) failed.
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => 42000
|
||||
[SQLSTATE] => 42000
|
||||
[1] => 257
|
||||
[code] => 257
|
||||
[2] => %SImplicit conversion from data type varchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.
|
||||
[message] => %SImplicit conversion from data type varchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.
|
||||
)
|
||||
|
||||
)
|
||||
sqlsrv_query(3) failed.
|
||||
1
|
||||
12.0
|
||||
testtestte
|
||||
This is some text meant to test binding parameters to streams
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(6) {
|
||||
[0]=>
|
||||
string(5) "IMSSP"
|
||||
["SQLSTATE"]=>
|
||||
string(5) "IMSSP"
|
||||
[1]=>
|
||||
int(-9)
|
||||
["code"]=>
|
||||
int(-9)
|
||||
[2]=>
|
||||
string(59) "Parameter array 2 must have at least one value or variable."
|
||||
["message"]=>
|
||||
string(59) "Parameter array 2 must have at least one value or variable."
|
||||
}
|
||||
}
|
32
test/sqlsrv/sqlsrv_serverInfo.phpt
Normal file
32
test/sqlsrv/sqlsrv_serverInfo.phpt
Normal file
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
Verify sqlsrv_server_info
|
||||
--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( "Failed to connect." );
|
||||
}
|
||||
|
||||
$server_info = sqlsrv_server_info( $conn );
|
||||
var_dump( $server_info );
|
||||
|
||||
sqlsrv_close( $conn );
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
array\(3\) {
|
||||
\[\"CurrentDatabase\"\]=>
|
||||
string\([0-9]+\) \"[A-Za-z_0-9]+\"
|
||||
\[\"SQLServerVersion\"\]=>
|
||||
string\(10\) \"[0-9]{2}.[0-9]{2}.[0-9]{4}\"
|
||||
\[\"SQLServerName\"\]=>
|
||||
string\([0-9]+\) \"[-A-Za-z0-9_\\]+"
|
||||
}
|
104
test/sqlsrv/sqlsrv_stmt_option_invalid_key.phpt
Normal file
104
test/sqlsrv/sqlsrv_stmt_option_invalid_key.phpt
Normal file
|
@ -0,0 +1,104 @@
|
|||
--TEST--
|
||||
Testing statement option with integer and invalid string key
|
||||
--ENV--
|
||||
PHPT_EXEC=true
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'MsCommon.inc';
|
||||
include 'MsSetup.inc';
|
||||
$conn = Connect();
|
||||
CreateTable($conn, $tableName);
|
||||
|
||||
$query = "SELECT * FROM [$tableName]";
|
||||
//integer keys are invalid
|
||||
$option = array( 5 => 1 );
|
||||
$stmt = sqlsrv_query($conn, $query, null, $option);
|
||||
if ( !$stmt )
|
||||
{
|
||||
print_r (sqlsrv_errors());
|
||||
}
|
||||
|
||||
$stmt = null;
|
||||
$stmt = sqlsrv_prepare($conn, $query, null, $option);
|
||||
if ( !$stmt )
|
||||
{
|
||||
print_r (sqlsrv_errors());
|
||||
}
|
||||
|
||||
$stmt = null;
|
||||
//a key that is not supported by the driver
|
||||
$option = array( "invalid_string_key" => 1 );
|
||||
$stmt = sqlsrv_query($conn, $query, null, $option);
|
||||
if ( !$stmt )
|
||||
{
|
||||
print_r (sqlsrv_errors());
|
||||
}
|
||||
|
||||
$stmt = null;
|
||||
$stmt = sqlsrv_prepare($conn, $query, null, $option);
|
||||
if ( !$stmt )
|
||||
{
|
||||
print_r (sqlsrv_errors());
|
||||
}
|
||||
|
||||
|
||||
DropTable($conn, $tableName);
|
||||
sqlsrv_close($conn);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -32
|
||||
[code] => -32
|
||||
[2] => Option 5 is invalid.
|
||||
[message] => Option 5 is invalid.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -32
|
||||
[code] => -32
|
||||
[2] => Option 5 is invalid.
|
||||
[message] => Option 5 is invalid.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -32
|
||||
[code] => -32
|
||||
[2] => Option invalid_string_key is invalid.
|
||||
[message] => Option invalid_string_key is invalid.
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => IMSSP
|
||||
[SQLSTATE] => IMSSP
|
||||
[1] => -32
|
||||
[code] => -32
|
||||
[2] => Option invalid_string_key is invalid.
|
||||
[message] => Option invalid_string_key is invalid.
|
||||
)
|
||||
|
||||
)
|
|
@ -35,7 +35,7 @@ sqlsrv_close($conn);
|
|||
print "Done";
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
int(3701)
|
||||
--EXPECTREGEX--
|
||||
bool\(false\)
|
||||
int\((3701|911)\)
|
||||
Done
|
||||
|
|
|
@ -37,9 +37,9 @@ sqlsrv_close($conn);
|
|||
print "Done";
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
string(5) "42S02"
|
||||
int(3701)
|
||||
string(159) "[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Cannot drop the database 'uniqueDB01_银河系', because it does not exist or you do not have permission."
|
||||
--EXPECTREGEX--
|
||||
bool\(false\)
|
||||
string\(5\) "(42S02|08004)"
|
||||
int\((3701|911)\)
|
||||
string\([0-9]+\) "\[Microsoft\]\[ODBC Driver 13 for SQL Server\]\[SQL Server\](Cannot drop the database 'uniqueDB01_银河系', because it does not exist or you do not have permission\.|Database 'uniqueDB01_银河系' does not exist. Make sure that the name is entered correctly\.)"
|
||||
Done
|
||||
|
|
Loading…
Reference in a new issue