Details to follow, but just from the function list you may see, that a simple search-and-replace will do the work to switch from mssql to sqlsrv-functions in a very simple case only.
| old php driver (mssql_) | sqlsrv php driver | Description |
| Server and Connection | ||
| mssql_connect | sqlsrv_connect | Open MS SQL server connection / Creates and opens a connection. |
| mssql_pconnect | - | Open persistent MS SQL connection |
| mssql_close | sqlsrv_close | Close MS SQL Server connection / Closes a connection. Frees all resources associated with the connection. |
| mssql_select_db | - | Select MS SQL database |
| - | sqlsrv_configure | Changes error handling and logging configurations. |
| - | sqlsrv_server_info | Provides information about the server. |
| - | sqlsrv_client_info | Provides information about the client. |
| - | sqlsrv_get_config | Returns the value of the specified configuration setting. |
| mssql_min_error_severity | - | Sets the minimum error severity |
| mssql_min_message_severity | - | Sets the minimum message severity |
| querying data | ||
| mssql_query | sqlsrv_query | Send MS SQL query / Prepares and executes a Transact-SQL query. |
| mssql_free_statement | sqlsrv_free_stmt | Free statement memory / Closes a statement. Frees all resources associated with the statement. |
| mssql_bind | - | Adds a parameter to a stored procedure or a remote stored procedure |
| mssql_data_seek | - | Moves internal row pointer |
| mssql_execute | sqlsrv_execute | Executes a stored procedure on a MS SQL server database / Executes a prepared statement. |
| mssql_rows_affected | sqlsrv_rows_affected | Returns the number of records affected by the query / Returns the number of modified rows. |
| mssql_result | - | Get result data |
| - | sqlsrv_fetch | Makes the next row of data available for reading. |
| mssql_free_result | - | Free result memory |
| sqlsrv_prepare | Prepares a Transact-SQL query without executing it. Implicitly binds parameters. | |
| mssql_next_result | sqlsrv_next_result | Move the internal result pointer to the next result / Makes the next result available for processing. |
| mssql_init | - | Initializes a stored procedure or a remote stored procedure |
| - | sqlsrv_begin_transaction | Begins a transaction. |
| - | sqlsrv_commit | Commits a transaction. |
| - | sqlsrv_cancel | Cancels a statement; discards any pending results for the statement. |
| - | sqlsrv_rollback | Rolls back a transaction. |
| getting results | ||
| mssql_fetch_array | sqlsrv_fetch_array | Fetch a result row as an associative array, a numeric array, or both / Retrieves the next row of data as a numerically indexed array, an associative array, or both. |
| mssql_fetch_assoc | - | Returns an associative array of the current row in the result |
| mssql_fetch_batch | - | Returns the next batch of records |
| mssql_fetch_field | sqlsrv_get_field | Get field information / Retrieves a field in the current row by index. The PHP return type can be specified. |
| mssql_fetch_object | sqlsrv_fetch_object | Fetch row as object / Retrieves the next row of data as an object. |
| mssql_fetch_row | Get row as enumerated array | |
| - | sqlsrv_fetch | |
| Metadata | ||
| mssql_field_length | - | Get the length of a field |
| mssql_field_name | - | Get the name of a field |
| mssql_field_seek | - | Seeks to the specified field offset |
| mssql_field_type | - | Gets the type of a field |
| mssql_num_fields | sqlsrv_num_fields | Gets the number of fields in result / Retrieves the number of fields in an active result set. |
| mssql_num_rows | sqlsrv_num_rows | Gets the number of rows in result / Reports the number of rows in a result set. |
| sqlsrv_field_metadata | Returns field metadata. | |
| sqlsrv_has_rows | Detects if a result set has one or more rows. | |
| Error-handling | ||
| mssql_get_last_message | - | Returns the last message from the server |
| - | sqlsrv_errors | Returns error and/or warning information about the last operation. |
| Other | ||
| mssql_guid_string | - | Converts a 16 byte binary GUID to a string |
| - | sqlsrv_send_stream_data | Sends up to eight kilobytes (8 KB) of data to the server with each call to the function. |

No comments:
Post a Comment