Cumulative Update 1 for Microsoft Drivers for PHP for SQL Server 2.0

This commit is contained in:
vineetc 2010-12-02 22:11:55 +00:00
parent 43907ce7be
commit 9c37a48e57
10 changed files with 82 additions and 38 deletions

View file

@ -1 +1 @@
Microsoft Drivers for PHP for SQL Server 2.0
Microsoft Drivers for PHP for SQL Server 2.0 Cumulative Update 1

View file

@ -23,16 +23,16 @@ ARG_WITH("pdo-sqlsrv", "MS SQL Server support for PDO", "no");
if( PHP_PDO_SQLSRV != "no" ) {
if (CHECK_LIB("odbc32.lib", "pdo_sqlsrv") && CHECK_LIB("odbccp32.lib", "pdo_sqlsrv") &&
CHECK_LIB("version.lib", "pdo_sqlsrv") && CHECK_LIB("psapi.lib", "pdo_sqlsrv")) {
if (CHECK_LIB("odbc32.lib", "pdo_sqlsrv") && CHECK_LIB("odbccp32.lib", "pdo_sqlsrv") &&
CHECK_LIB("version.lib", "pdo_sqlsrv") && CHECK_LIB("psapi.lib", "pdo_sqlsrv")) {
EXTENSION("pdo_sqlsrv", "pdo_dbh.cpp pdo_init.cpp pdo_stmt.cpp pdo_util.cpp pdo_parser.cpp core_init.cpp core_conn.cpp core_stmt.cpp core_util.cpp core_stream.cpp" )
CHECK_HEADER_ADD_INCLUDE('sql.h', 'CFLAGS_PDO_SQLSRV_ODBC');
CHECK_HEADER_ADD_INCLUDE('sqlext.h', 'CFLAGS_PDO_SQLSRV_ODBC');
ADD_FLAG( 'LDFLAGS_PDO_SQLSRV', '/NXCOMPAT /DYNAMICBASE' );
ADD_FLAG( 'CFLAGS_PDO_SQLSRV', '/EHsc' );
ADD_FLAG( 'CFLAGS_PDO_SQLSRV', '/GS' );
ADD_EXTENSION_DEP('pdo_sqlsrv', 'pdo');
}
EXTENSION("pdo_sqlsrv", "pdo_dbh.cpp pdo_init.cpp pdo_stmt.cpp pdo_util.cpp pdo_parser.cpp core_init.cpp core_conn.cpp core_stmt.cpp core_util.cpp core_stream.cpp" )
CHECK_HEADER_ADD_INCLUDE('sql.h', 'CFLAGS_PDO_SQLSRV_ODBC');
CHECK_HEADER_ADD_INCLUDE('sqlext.h', 'CFLAGS_PDO_SQLSRV_ODBC');
ADD_FLAG( 'LDFLAGS_PDO_SQLSRV', '/NXCOMPAT /DYNAMICBASE' );
ADD_FLAG( 'CFLAGS_PDO_SQLSRV', '/EHsc' );
ADD_FLAG( 'CFLAGS_PDO_SQLSRV', '/GS' );
ADD_EXTENSION_DEP('pdo_sqlsrv', 'pdo');
}
}

View file

@ -1618,7 +1618,18 @@ SQLSMALLINT default_c_type( sqlsrv_stmt* stmt, unsigned int paramno, zval const*
switch( php_type ) {
case IS_NULL:
sql_c_type = SQL_C_CHAR;
switch( encoding ) {
// The c type is set to match to the corresponding sql_type. For NULL cases, if the server type
// is a binary type, than the server expects the sql_type to be binary type as well, otherwise
// an error stating "Implicit conversion not allowed.." is thrown by the server.
// For all other server types, setting the sql_type to sql_char works fine.
case SQLSRV_ENCODING_BINARY:
sql_c_type = SQL_C_BINARY;
break;
default:
sql_c_type = SQL_C_CHAR;
break;
}
break;
case IS_BOOL:
case IS_LONG:
@ -1670,7 +1681,18 @@ void default_sql_type( sqlsrv_stmt* stmt, unsigned int paramno, zval* param_z, S
switch( php_type ) {
case IS_NULL:
sql_type = SQL_CHAR;
switch( encoding ) {
// Use the encoding to guess whether the sql_type is binary type or char type. For NULL cases,
// if the server type is a binary type, than the server expects the sql_type to be binary type
// as well, otherwise an error stating "Implicit conversion not allowed.." is thrown by the
// server. For all other server types, setting the sql_type to sql_char works fine.
case SQLSRV_ENCODING_BINARY:
sql_type = SQL_BINARY;
break;
default:
sql_type = SQL_CHAR;
break;
}
break;
case IS_BOOL:
case IS_LONG:
@ -1838,7 +1860,7 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC )
if( output_param->encoding != SQLSRV_ENCODING_CHAR && output_param->encoding != SQLSRV_ENCODING_BINARY ) {
bool converted = convert_string_from_utf16( output_param->encoding, &str, str_len );
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE ) {
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE, get_last_error_message()) {
throw core::CoreException();
}
}

View file

@ -1113,8 +1113,8 @@ int pdo_sqlsrv_dbh_quote( pdo_dbh_t* dbh, const char* unquoted, int unquoted_len
}
}
*quoted_len = unquoted_len + 1 + quotes_needed; // include the NULL terminator in case it isn't included already
*quoted = reinterpret_cast<char*>( sqlsrv_malloc( *quoted_len ));
*quoted_len = unquoted_len + quotes_needed; // length returned to the caller should not account for null terminator.
*quoted = reinterpret_cast<char*>( sqlsrv_malloc( *quoted_len + 1 )); // include space for null terminator.
unsigned int out_current = 0;
// insert initial quote

View file

@ -18,9 +18,9 @@
// limitations under the License.
//---------------------------------------------------------------------------------------------------------------------------------
#define VER_FILEVERSION_STR "2.0.0.0"
#define _FILEVERSION 2,0,0,0
#define VER_FILEVERSION_STR "2.0.0.200"
#define _FILEVERSION 2,0,0,200
#define SQLVERSION_MAJOR 2
#define SQLVERSION_MINOR 0
#define SQLVERSION_MMDD 0
#define SQLVERSION_REVISION 0
#define SQLVERSION_REVISION 200

View file

@ -1 +1 @@
Microsoft Drivers for PHP for SQL Server 2.0
Microsoft Drivers for PHP for SQL Server 2.0 Cumulative Update 1

View file

@ -22,15 +22,15 @@ ARG_ENABLE("sqlsrv", "enable MS SQL Server extension", "no");
if( PHP_SQLSRV != "no" ) {
if (CHECK_LIB("odbc32.lib", "sqlsrv") && CHECK_LIB("odbccp32.lib", "sqlsrv") &&
CHECK_LIB("version.lib", "sqlsrv") && CHECK_LIB("psapi.lib", "sqlsrv")) {
EXTENSION("sqlsrv", "conn.cpp init.cpp stmt.cpp util.cpp core_init.cpp core_conn.cpp core_stmt.cpp core_util.cpp core_stream.cpp" )
if (CHECK_LIB("odbc32.lib", "sqlsrv") && CHECK_LIB("odbccp32.lib", "sqlsrv") &&
CHECK_LIB("version.lib", "sqlsrv") && CHECK_LIB("psapi.lib", "sqlsrv")) {
EXTENSION("sqlsrv", "conn.cpp init.cpp stmt.cpp util.cpp core_init.cpp core_conn.cpp core_stmt.cpp core_util.cpp core_stream.cpp" )
CHECK_HEADER_ADD_INCLUDE('sql.h', 'CFLAGS_SQLSRV_ODBC');
CHECK_HEADER_ADD_INCLUDE('sqlext.h', 'CFLAGS_SQLSRV_ODBC');
ADD_FLAG( 'LDFLAGS_SQLSRV', '/NXCOMPAT /DYNAMICBASE' );
ADD_FLAG( 'CFLAGS_SQLSRV', '/EHsc' );
ADD_FLAG( 'CFLAGS_SQLSRV', '/GS' );
}
CHECK_HEADER_ADD_INCLUDE('sql.h', 'CFLAGS_SQLSRV_ODBC');
CHECK_HEADER_ADD_INCLUDE('sqlext.h', 'CFLAGS_SQLSRV_ODBC');
ADD_FLAG( 'LDFLAGS_SQLSRV', '/NXCOMPAT /DYNAMICBASE' );
ADD_FLAG( 'CFLAGS_SQLSRV', '/EHsc' );
ADD_FLAG( 'CFLAGS_SQLSRV', '/GS' );
}
}

View file

@ -1618,7 +1618,18 @@ SQLSMALLINT default_c_type( sqlsrv_stmt* stmt, unsigned int paramno, zval const*
switch( php_type ) {
case IS_NULL:
sql_c_type = SQL_C_CHAR;
switch( encoding ) {
// The c type is set to match to the corresponding sql_type. For NULL cases, if the server type
// is a binary type, than the server expects the sql_type to be binary type as well, otherwise
// an error stating "Implicit conversion not allowed.." is thrown by the server.
// For all other server types, setting the sql_type to sql_char works fine.
case SQLSRV_ENCODING_BINARY:
sql_c_type = SQL_C_BINARY;
break;
default:
sql_c_type = SQL_C_CHAR;
break;
}
break;
case IS_BOOL:
case IS_LONG:
@ -1670,7 +1681,18 @@ void default_sql_type( sqlsrv_stmt* stmt, unsigned int paramno, zval* param_z, S
switch( php_type ) {
case IS_NULL:
sql_type = SQL_CHAR;
switch( encoding ) {
// Use the encoding to guess whether the sql_type is binary type or char type. For NULL cases,
// if the server type is a binary type, than the server expects the sql_type to be binary type
// as well, otherwise an error stating "Implicit conversion not allowed.." is thrown by the
// server. For all other server types, setting the sql_type to sql_char works fine.
case SQLSRV_ENCODING_BINARY:
sql_type = SQL_BINARY;
break;
default:
sql_type = SQL_CHAR;
break;
}
break;
case IS_BOOL:
case IS_LONG:
@ -1838,7 +1860,7 @@ void finalize_output_parameters( sqlsrv_stmt* stmt TSRMLS_DC )
if( output_param->encoding != SQLSRV_ENCODING_CHAR && output_param->encoding != SQLSRV_ENCODING_BINARY ) {
bool converted = convert_string_from_utf16( output_param->encoding, &str, str_len );
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE ) {
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_OUTPUT_PARAM_ENCODING_TRANSLATE, get_last_error_message()) {
throw core::CoreException();
}
}

View file

@ -1815,13 +1815,13 @@ void fetch_fields_common( __inout ss_sqlsrv_stmt* stmt, int fetch_type, __out zv
if(( fetch_type & SQLSRV_FETCH_ASSOC ) && stmt->fetch_field_names == NULL ) {
SQLSMALLINT field_name_len;
char field_name_temp[ SQL_MAX_COLUMN_NAME_LEN ];
char field_name_temp[ SS_MAXCOLNAMELEN+1 ];
sqlsrv_malloc_auto_ptr<sqlsrv_fetch_field_name> field_names;
field_names = static_cast<sqlsrv_fetch_field_name*>( sqlsrv_malloc( num_cols * sizeof( sqlsrv_fetch_field_name )));
for( int i = 0; i < num_cols; ++i ) {
core::SQLColAttribute( stmt, i + 1, SQL_DESC_NAME, field_name_temp, SQL_MAX_COLUMN_NAME_LEN, &field_name_len, NULL
core::SQLColAttribute( stmt, i + 1, SQL_DESC_NAME, field_name_temp, SS_MAXCOLNAMELEN+1, &field_name_len, NULL
TSRMLS_CC );
field_names[ i ].name = static_cast<char*>( sqlsrv_malloc( field_name_len + 1 ));
memcpy( (void*) field_names[ i ].name, field_name_temp, field_name_len );

View file

@ -18,9 +18,9 @@
// limitations under the License.
//---------------------------------------------------------------------------------------------------------------------------------
#define VER_FILEVERSION_STR "2.0.0.0"
#define _FILEVERSION 2,0,0,0
#define VER_FILEVERSION_STR "2.0.0.200"
#define _FILEVERSION 2,0,0,200
#define SQLVERSION_MAJOR 2
#define SQLVERSION_MINOR 0
#define SQLVERSION_MMDD 0
#define SQLVERSION_REVISION 0
#define SQLVERSION_REVISION 200