diff --git a/source/pdo_sqlsrv/pdo_dbh.cpp b/source/pdo_sqlsrv/pdo_dbh.cpp index b9e3d882..0d8e18be 100644 --- a/source/pdo_sqlsrv/pdo_dbh.cpp +++ b/source/pdo_sqlsrv/pdo_dbh.cpp @@ -1162,20 +1162,17 @@ char * pdo_sqlsrv_dbh_last_id( pdo_dbh_t *dbh, const char *name, _Out_ size_t* l temp_stmt.dbh = dbh; // allocate a full driver statement to take advantage of the error handling - driver_stmt = core_sqlsrv_create_stmt( driver_dbh, core::allocate_stmt, NULL /*options_ht*/, - NULL /*valid_stmt_opts*/, pdo_sqlsrv_handle_stmt_error, &temp_stmt TSRMLS_CC ); + driver_stmt = core_sqlsrv_create_stmt( driver_dbh, core::allocate_stmt, NULL /*options_ht*/, NULL /*valid_stmt_opts*/, pdo_sqlsrv_handle_stmt_error, &temp_stmt TSRMLS_CC ); driver_stmt->set_func( __FUNCTION__ ); sqlsrv_malloc_auto_ptr wsql_string; unsigned int wsql_len; - wsql_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_CHAR, reinterpret_cast( last_insert_id_query ), - strlen(last_insert_id_query), &wsql_len ); + wsql_string = utf16_string_from_mbcs_string( SQLSRV_ENCODING_CHAR, reinterpret_cast( last_insert_id_query ), strlen(last_insert_id_query), &wsql_len ); - CHECK_CUSTOM_ERROR( wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, - get_last_error_message() ) { + CHECK_CUSTOM_ERROR( wsql_string == 0, driver_stmt, SQLSRV_ERROR_QUERY_STRING_ENCODING_TRANSLATE, get_last_error_message() ) { throw core::CoreException(); - } + } // execute the last insert id query core::SQLExecDirectW( driver_stmt, wsql_string TSRMLS_CC ); diff --git a/source/shared/core_conn.cpp b/source/shared/core_conn.cpp index d4801590..9fe965a9 100644 --- a/source/shared/core_conn.cpp +++ b/source/shared/core_conn.cpp @@ -114,14 +114,14 @@ sqlsrv_conn* core_sqlsrv_connect( sqlsrv_context& henv_cp, sqlsrv_context& henv_ // Instead, MSPHPSQL connection pooling is set according to the ODBCINST.INI file in [ODBC] section. #ifdef __linux__ - char pooling_string[ 128 ] = {0}; - SQLGetPrivateProfileString( "ODBC", "Pooling", "0", pooling_string, sizeof( pooling_string ), "ODBCINST.INI" ); + char pooling_string[ 128 ] = {0}; + SQLGetPrivateProfileString( "ODBC", "Pooling", "0", pooling_string, sizeof( pooling_string ), "ODBCINST.INI" ); - if ( pooling_string[ 0 ] == '1' || toupper( pooling_string[ 0 ] ) == 'Y' || - ( toupper( pooling_string[ 0 ] ) == 'O' && toupper( pooling_string[ 1 ] ) == 'N' )) - { - henv = &henv_cp; - } + if ( pooling_string[ 0 ] == '1' || toupper( pooling_string[ 0 ] ) == 'Y' || + ( toupper( pooling_string[ 0 ] ) == 'O' && toupper( pooling_string[ 1 ] ) == 'N' )) + { + henv = &henv_cp; + } #else // check the connection pooling setting to determine which henv to use to allocate the connection handle // we do this earlier because we have to allocate the connection handle prior to setting attributes on @@ -167,19 +167,14 @@ sqlsrv_conn* core_sqlsrv_connect( sqlsrv_context& henv_cp, sqlsrv_context& henv_ // connection handle has been allocated using henv_cp, means pooling enabled in a PHP script if ( henv == &henv_cp ) { - r = SQLDriverConnect( conn->handle(), NULL, (SQLCHAR*)conn_str.c_str(), - SQL_NTS, NULL, 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); + r = SQLDriverConnect( conn->handle(), NULL, (SQLCHAR*)conn_str.c_str(), SQL_NTS, NULL, 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); } else { - r = SQLDriverConnectW( conn->handle(), NULL, reinterpret_cast( wconn_string.get() ), - static_cast( wconn_len ), NULL, - 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); + r = SQLDriverConnectW( conn->handle(), NULL, reinterpret_cast( wconn_string.get() ), static_cast( wconn_len ), NULL, 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); } #else - r = SQLDriverConnectW( conn->handle(), NULL, reinterpret_cast( wconn_string.get() ), - static_cast( wconn_len ), NULL, - 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); + r = SQLDriverConnectW( conn->handle(), NULL, reinterpret_cast( wconn_string.get() ), static_cast( wconn_len ), NULL, 0, &output_conn_size, SQL_DRIVER_NOPROMPT ); #endif // clear the connection string from memory to remove sensitive data (such as a password).