SQL Server 2005 Driver for PHP October 2008 Cumulative Update.
Please see README.txt for information about changes made for this update.
This commit is contained in:
parent
ed20a39316
commit
c62bf03a62
24
README.TXT
24
README.TXT
|
@ -1,18 +1,24 @@
|
||||||
|
|
||||||
*Notes on compiling SQL Server 2005 Driver for PHP*
|
* Notes about changes to the SQL Server 2005 Driver for PHP October 2008 Cumulative Update (CU) *
|
||||||
|
|
||||||
Prerequisites: You must first be able to build PHP not including
|
For details about the changes included in this CU, please see our blog at
|
||||||
this extension. For help on doing so, see the official PHP website,
|
http://blogs.msdn.com/sqlphp or see the SQLServerDriverForPHP_Readme.htm
|
||||||
http://php.net.
|
file that is part of the download package.
|
||||||
|
|
||||||
To compile SQL Server 2005 Driver for PHP:
|
* Notes about compiling the SQL Server 2005 Driver for PHP October 2008 CU *
|
||||||
|
|
||||||
|
Prerequisites: You must first be able to build PHP without including
|
||||||
|
the SQL Server 2005 Driver for PHP extension. For help with doing this, see
|
||||||
|
the official PHP website, http://php.net.
|
||||||
|
|
||||||
|
To compile the SQL Server 2005 Driver for PHP:
|
||||||
|
|
||||||
1) Copy the source code into the ext\sqlsrv directory.
|
1) Copy the source code into the ext\sqlsrv directory.
|
||||||
|
|
||||||
2) run buildconf.bat
|
2) run buildconf.bat
|
||||||
|
|
||||||
3) run "cscript configure.js --enable-sqlsrv=shared <other options>" to
|
3) run "cscript configure.js --enable-sqlsrv=shared <other options>" to
|
||||||
generate the makefile. run "cscript configure.js --help" to see what other
|
generate the makefile. Run "cscript configure.js --help" to see what other
|
||||||
options are available. It is possible (and even probable) that other
|
options are available. It is possible (and even probable) that other
|
||||||
extensions will have to be disabled or enabled for the compile to succeed.
|
extensions will have to be disabled or enabled for the compile to succeed.
|
||||||
Search live.com for configurations that have worked for other people.
|
Search live.com for configurations that have worked for other people.
|
||||||
|
@ -32,3 +38,9 @@ using the Visual C++ 2005 Express and Visual C++ 2008 Standard compilers.
|
||||||
This software is released under the Microsoft Public License. A copy of
|
This software is released under the Microsoft Public License. A copy of
|
||||||
the license agreement may be found online at
|
the license agreement may be found online at
|
||||||
http://www.codeplex.com/SQL2K5PHP/license.
|
http://www.codeplex.com/SQL2K5PHP/license.
|
||||||
|
|
||||||
|
* Note about version.h *
|
||||||
|
|
||||||
|
The version numbers in version.h in the source do not match the version numbers
|
||||||
|
in the supported PHP extension and have not been updated for this CU in the
|
||||||
|
published source code.
|
||||||
|
|
29
conn.cpp
29
conn.cpp
|
@ -29,10 +29,6 @@ int current_log_subsystem = LOG_CONN;
|
||||||
|
|
||||||
// an arbitrary figure that should be large enough for most connection strings.
|
// an arbitrary figure that should be large enough for most connection strings.
|
||||||
const int DEFAULT_CONN_STR_LEN = 2048;
|
const int DEFAULT_CONN_STR_LEN = 2048;
|
||||||
// the largest packet size that can be sent with the default options that we use
|
|
||||||
// without causing a warning to happen at login time. If the warning did occur,
|
|
||||||
// it would cause an error when 'WarningsReturnAsErrors' is set to true.
|
|
||||||
const int DEFAULT_PACKET_SIZE = 32564;
|
|
||||||
// PHP streams generally return no more than 8k.
|
// PHP streams generally return no more than 8k.
|
||||||
const int PHP_STREAM_BUFFER_SIZE = 8192;
|
const int PHP_STREAM_BUFFER_SIZE = 8192;
|
||||||
// connection timeout string
|
// connection timeout string
|
||||||
|
@ -176,20 +172,15 @@ PHP_FUNCTION( sqlsrv_connect )
|
||||||
handle_warning( &SQLSRV_G( henv_context )->ctx, LOG_CONN, _FN_, NULL TSRMLS_CC );
|
handle_warning( &SQLSRV_G( henv_context )->ctx, LOG_CONN, _FN_, NULL TSRMLS_CC );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the packet size to ~32k
|
|
||||||
r = SQLSetConnectAttr( conn->ctx.handle, SQL_ATTR_PACKET_SIZE, reinterpret_cast<SQLPOINTER>( DEFAULT_PACKET_SIZE ), SQL_IS_UINTEGER );
|
|
||||||
CHECK_SQL_ERROR( r, conn, _FN_, NULL, SQLFreeHandle( conn->ctx.handle_type, conn->ctx.handle ); RETURN_FALSE; );
|
|
||||||
CHECK_SQL_WARNING( r ,conn, _FN_, NULL );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
r = build_connection_string_and_set_conn_attr( conn, server, options_z, conn_str TSRMLS_CC );
|
r = build_connection_string_and_set_conn_attr( conn, server, options_z, conn_str TSRMLS_CC );
|
||||||
CHECK_SQL_ERROR( r, SQLSRV_G( henv_context ), _FN_, NULL,
|
CHECK_SQL_ERROR( r, SQLSRV_G( henv_context ), _FN_, NULL,
|
||||||
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
||||||
conn_str.clear();
|
conn_str.clear();
|
||||||
SQLFreeHandle( conn->ctx.handle_type, conn->ctx.handle );
|
SQLFreeHandle( conn->ctx.handle_type, conn->ctx.handle );
|
||||||
conn->ctx.handle = NULL;
|
conn->ctx.handle = NULL;
|
||||||
RETURN_FALSE );
|
RETURN_FALSE );
|
||||||
}
|
}
|
||||||
catch( std::bad_alloc& ex ) {
|
catch( std::bad_alloc& ex ) {
|
||||||
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
||||||
|
@ -213,14 +204,14 @@ PHP_FUNCTION( sqlsrv_connect )
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLSRV_STATIC_ASSERT( sizeof( char ) == sizeof( SQLCHAR )); // make sure that cast below is valid
|
SQLSRV_STATIC_ASSERT( sizeof( char ) == sizeof( SQLCHAR )); // make sure that cast below is valid
|
||||||
r = SQLDriverConnect( conn->ctx.handle, NULL, reinterpret_cast<SQLCHAR*>( const_cast<char*>( conn_str.c_str() )),
|
r = SQLDriverConnect( conn->ctx.handle, NULL, reinterpret_cast<SQLCHAR*>( const_cast<char*>( conn_str.c_str() )),
|
||||||
static_cast<SQLSMALLINT>( conn_str.length() ), NULL,
|
static_cast<SQLSMALLINT>( conn_str.length() ), NULL,
|
||||||
0, &output_conn_size, SQL_DRIVER_NOPROMPT );
|
0, &output_conn_size, SQL_DRIVER_NOPROMPT );
|
||||||
// Would rather use std::fill here, but that gives a warning about not being able to inline
|
// Would rather use std::fill here, but that gives a warning about not being able to inline
|
||||||
// the iterator functions, so we use this instead.
|
// the iterator functions, so we use this instead.
|
||||||
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
memset( const_cast<char*>( conn_str.c_str()), 0, conn_str.size() );
|
||||||
conn_str.clear();
|
conn_str.clear();
|
||||||
|
|
||||||
CHECK_SQL_ERROR( r, conn, _FN_, NULL,
|
CHECK_SQL_ERROR( r, conn, _FN_, NULL,
|
||||||
SQLFreeHandle( conn->ctx.handle_type, conn->ctx.handle ); conn->ctx.handle = SQL_NULL_HANDLE; RETURN_FALSE );
|
SQLFreeHandle( conn->ctx.handle_type, conn->ctx.handle ); conn->ctx.handle = SQL_NULL_HANDLE; RETURN_FALSE );
|
||||||
|
|
38
stmt.cpp
38
stmt.cpp
|
@ -1006,9 +1006,9 @@ bool sqlsrv_stmt_common_execute( sqlsrv_stmt* stmt, const SQLCHAR* sql_string, i
|
||||||
column_size, decimal_digits TSRMLS_CC );
|
column_size, decimal_digits TSRMLS_CC );
|
||||||
// an error occurred, so return false
|
// an error occurred, so return false
|
||||||
if( param_z == NULL ) {
|
if( param_z == NULL ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise use the defaults
|
// otherwise use the defaults
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -1138,18 +1138,26 @@ bool sqlsrv_stmt_common_execute( sqlsrv_stmt* stmt, const SQLCHAR* sql_string, i
|
||||||
if( sql_string != NULL ) DIE( "sqlsrv_stmt_common_execute: sql_string must be NULL when direct = false");
|
if( sql_string != NULL ) DIE( "sqlsrv_stmt_common_execute: sql_string must be NULL when direct = false");
|
||||||
r = SQLExecute( stmt->ctx.handle );
|
r = SQLExecute( stmt->ctx.handle );
|
||||||
}
|
}
|
||||||
if( r != SQL_NEED_DATA ) {
|
|
||||||
|
// if stream parameters were bound
|
||||||
|
if( r == SQL_NEED_DATA ) {
|
||||||
|
|
||||||
|
// if they are to be sent at execute time, then send them now.
|
||||||
|
if( stmt->send_at_exec == true ) {
|
||||||
|
|
||||||
|
zval return_value;
|
||||||
|
while( send_stream_packet( stmt, &return_value, _FN_ TSRMLS_CC )) { }
|
||||||
|
if( Z_TYPE( return_value ) != IS_NULL ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if a result set was generated, check for errors. Otherwise, it completed successfully but no data was
|
||||||
|
// generated.
|
||||||
|
else if( r != SQL_NO_DATA ) {
|
||||||
CHECK_SQL_ERROR( r, stmt, _FN_, NULL, SQLFreeStmt( stmt->ctx.handle, SQL_RESET_PARAMS ); return false; );
|
CHECK_SQL_ERROR( r, stmt, _FN_, NULL, SQLFreeStmt( stmt->ctx.handle, SQL_RESET_PARAMS ); return false; );
|
||||||
CHECK_SQL_WARNING( r, stmt, _FN_, NULL );
|
CHECK_SQL_WARNING( r, stmt, _FN_, NULL );
|
||||||
}
|
}
|
||||||
else if( stmt->send_at_exec == true ) {
|
|
||||||
|
|
||||||
zval return_value;
|
|
||||||
while( send_stream_packet( stmt, &return_value, _FN_ TSRMLS_CC )) { }
|
|
||||||
if( Z_TYPE( return_value ) != IS_NULL ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// false means to not release the datetime buffers we just allocated.
|
// false means to not release the datetime buffers we just allocated.
|
||||||
stmt->new_result_set( false );
|
stmt->new_result_set( false );
|
||||||
|
@ -1315,7 +1323,7 @@ bool check_for_next_stream_parameter( __inout sqlsrv_stmt* stmt, __out zval* ret
|
||||||
stmt->current_parameter_read = 0;
|
stmt->current_parameter_read = 0;
|
||||||
}
|
}
|
||||||
// otherwise if it wasn't an error, we've exhausted the bound parameters, so return that we're done
|
// otherwise if it wasn't an error, we've exhausted the bound parameters, so return that we're done
|
||||||
else if( SQL_SUCCEEDED( r )) {
|
else if( SQL_SUCCEEDED( r ) || r == SQL_NO_DATA ) {
|
||||||
CHECK_SQL_WARNING( r, stmt, "sqlsrv_send_stream_data", NULL );
|
CHECK_SQL_WARNING( r, stmt, "sqlsrv_send_stream_data", NULL );
|
||||||
RETVAL_NULL();
|
RETVAL_NULL();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1969,8 +1977,8 @@ void get_field_as_string( sqlsrv_stmt const* s, SQLSMALLINT c_type, SQLUSMALLINT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CHECK_SQL_ERROR( r, s, _FN_, NULL, efree( field ); RETURN_FALSE; );
|
CHECK_SQL_ERROR( r, s, _FN_, NULL, efree( field ); RETURN_FALSE; );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( sql_display_size >= 1 && sql_display_size <= SQL_SERVER_2005_MAX_FIELD_SIZE ) {
|
else if( sql_display_size >= 1 && sql_display_size <= SQL_SERVER_2005_MAX_FIELD_SIZE ) {
|
||||||
// only allow binary retrievals for char and binary types. All others get a char type automatically.
|
// only allow binary retrievals for char and binary types. All others get a char type automatically.
|
||||||
|
|
|
@ -127,10 +127,10 @@ OACR_WARNING_DISABLE( UNANNOTATED_BUFFER, "STREAMS_DC is a Zend macro that evals
|
||||||
// return value. There is only one valid way to open a stream, using sqlsrv_get_field on
|
// return value. There is only one valid way to open a stream, using sqlsrv_get_field on
|
||||||
// certain field types. A sqlsrv stream may only be opened in read mode.
|
// certain field types. A sqlsrv stream may only be opened in read mode.
|
||||||
static php_stream* sqlsrv_stream_opener( php_stream_wrapper* wrapper,
|
static php_stream* sqlsrv_stream_opener( php_stream_wrapper* wrapper,
|
||||||
__in char*, __in char* mode,
|
__in char*, __in char* mode,
|
||||||
int options, __in char **,
|
int options, __in char **,
|
||||||
php_stream_context*
|
php_stream_context*
|
||||||
STREAMS_DC TSRMLS_DC )
|
STREAMS_DC TSRMLS_DC )
|
||||||
{
|
{
|
||||||
#if ZEND_DEBUG
|
#if ZEND_DEBUG
|
||||||
SQLSRV_UNUSED( __zend_orig_lineno );
|
SQLSRV_UNUSED( __zend_orig_lineno );
|
||||||
|
|
10
util.cpp
10
util.cpp
|
@ -592,13 +592,13 @@ bool handle_errors_and_warnings( sqlsrv_context const* ctx, zval** reported_chai
|
||||||
if( ignored_chain != NULL ) {
|
if( ignored_chain != NULL ) {
|
||||||
|
|
||||||
if( Z_TYPE_P( *ignored_chain ) == IS_NULL ) {
|
if( Z_TYPE_P( *ignored_chain ) == IS_NULL ) {
|
||||||
ignored_chain_was_null = true;
|
ignored_chain_was_null = true;
|
||||||
ignored_before = 0;
|
ignored_before = 0;
|
||||||
zr = array_init( *ignored_chain );
|
zr = array_init( *ignored_chain );
|
||||||
if( zr == FAILURE ) {
|
if( zr == FAILURE ) {
|
||||||
DIE( "Fatal error in handle_errors_and_warnings" );
|
DIE( "Fatal error in handle_errors_and_warnings" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
ignored_before = zend_hash_num_elements( Z_ARRVAL_PP( ignored_chain ));
|
ignored_before = zend_hash_num_elements( Z_ARRVAL_PP( ignored_chain ));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
// may be found online at http://www.codeplex.com/SQL2K5PHP/license.
|
// may be found online at http://www.codeplex.com/SQL2K5PHP/license.
|
||||||
//----------------------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#define VER_FILEVERSION_STR "1.0.0.0"
|
#define VER_FILEVERSION_STR "1.0.1015.0"
|
||||||
#define _FILEVERSION 1,0,0,0
|
#define _FILEVERSION 1,0,1015,0
|
||||||
#define SQLVERSION_MAJOR 1
|
#define SQLVERSION_MAJOR 1
|
||||||
#define SQLVERSION_MINOR 0
|
#define SQLVERSION_MINOR 0
|
||||||
#define SQLVERSION_MMDD 0
|
#define SQLVERSION_MMDD 1015
|
||||||
#define SQLVERSION_REVISION 0
|
#define SQLVERSION_REVISION 0
|
||||||
|
|
Loading…
Reference in a new issue