From 45b3a51067de92ef2d8b44de8ec4d19d1383a74a Mon Sep 17 00:00:00 2001 From: Asish Kumar Date: Sat, 28 Nov 2026 05:18:13 +0000 Subject: [PATCH] [sqlsrv] Use union return types matching the extension's behaviour Several sqlsrv function synopses declared a single return type (or mixed) although the return values section, and the extension itself, document additional false and/or null returns. For instance sqlsrv_fetch_array() was declared as returning array while it returns null when there are no more rows and false on error. Update the synopses to the union types actually returned by the extension (checked against microsoft/msphpsql source/sqlsrv): - sqlsrv_fetch_array(): array|false|null - sqlsrv_fetch_object(): object|false|null - sqlsrv_errors(): array|false|null - sqlsrv_fetch(), sqlsrv_next_result(), sqlsrv_send_stream_data(): bool|null - sqlsrv_connect(), sqlsrv_prepare(), sqlsrv_query(): resource|false - sqlsrv_client_info(), sqlsrv_server_info(), sqlsrv_field_metadata(): array|false - sqlsrv_num_fields(), sqlsrv_num_rows(): int|false - sqlsrv_get_config(): int|bool Also complete the return values sections that did not mention every returned value: sqlsrv_send_stream_data() returns null (not false) once all data has been sent and false on error, sqlsrv_server_info() returns false on failure, and sqlsrv_errors() returns false for an invalid errorsOrWarnings value. Fixes #28 --- reference/sqlsrv/functions/sqlsrv-client-info.xml | 2 +- reference/sqlsrv/functions/sqlsrv-connect.xml | 2 +- reference/sqlsrv/functions/sqlsrv-errors.xml | 7 ++++--- reference/sqlsrv/functions/sqlsrv-fetch-array.xml | 2 +- reference/sqlsrv/functions/sqlsrv-fetch-object.xml | 2 +- reference/sqlsrv/functions/sqlsrv-fetch.xml | 2 +- reference/sqlsrv/functions/sqlsrv-field-metadata.xml | 2 +- reference/sqlsrv/functions/sqlsrv-get-config.xml | 2 +- reference/sqlsrv/functions/sqlsrv-next-result.xml | 2 +- reference/sqlsrv/functions/sqlsrv-num-fields.xml | 2 +- reference/sqlsrv/functions/sqlsrv-num-rows.xml | 2 +- reference/sqlsrv/functions/sqlsrv-prepare.xml | 2 +- reference/sqlsrv/functions/sqlsrv-query.xml | 2 +- reference/sqlsrv/functions/sqlsrv-send-stream-data.xml | 5 +++-- reference/sqlsrv/functions/sqlsrv-server-info.xml | 4 ++-- 15 files changed, 21 insertions(+), 19 deletions(-) diff --git a/reference/sqlsrv/functions/sqlsrv-client-info.xml b/reference/sqlsrv/functions/sqlsrv-client-info.xml index e301a5edf..ea9ea0b1b 100644 --- a/reference/sqlsrv/functions/sqlsrv-client-info.xml +++ b/reference/sqlsrv/functions/sqlsrv-client-info.xml @@ -8,7 +8,7 @@ &reftitle.description; - arraysqlsrv_client_info + arrayfalsesqlsrv_client_info resourceconn diff --git a/reference/sqlsrv/functions/sqlsrv-connect.xml b/reference/sqlsrv/functions/sqlsrv-connect.xml index 2dd7d58ae..bfc3cb9aa 100644 --- a/reference/sqlsrv/functions/sqlsrv-connect.xml +++ b/reference/sqlsrv/functions/sqlsrv-connect.xml @@ -8,7 +8,7 @@ &reftitle.description; - resourcesqlsrv_connect + resourcefalsesqlsrv_connect stringserverName arrayconnectionInfo diff --git a/reference/sqlsrv/functions/sqlsrv-errors.xml b/reference/sqlsrv/functions/sqlsrv-errors.xml index 067751e19..beb9dda87 100644 --- a/reference/sqlsrv/functions/sqlsrv-errors.xml +++ b/reference/sqlsrv/functions/sqlsrv-errors.xml @@ -9,7 +9,7 @@ &reftitle.description; - mixedsqlsrv_errors + arrayfalsenullsqlsrv_errors interrorsOrWarnings @@ -39,8 +39,9 @@ If errors and/or warnings occurred on the last sqlsrv operation, an array of arrays containing error information is returned. If no errors and/or warnings - occurred on the last sqlsrv operation, &null; is returned. The following table - describes the structure of the returned arrays: + occurred on the last sqlsrv operation, &null; is returned. If an invalid + errorsOrWarnings value is given, &false; is returned. + The following table describes the structure of the returned arrays: Array returned by sqlsrv_errors diff --git a/reference/sqlsrv/functions/sqlsrv-fetch-array.xml b/reference/sqlsrv/functions/sqlsrv-fetch-array.xml index 7517120c4..f6009100b 100644 --- a/reference/sqlsrv/functions/sqlsrv-fetch-array.xml +++ b/reference/sqlsrv/functions/sqlsrv-fetch-array.xml @@ -8,7 +8,7 @@ &reftitle.description; - arraysqlsrv_fetch_array + arrayfalsenullsqlsrv_fetch_array resourcestmt intfetchType introw diff --git a/reference/sqlsrv/functions/sqlsrv-fetch-object.xml b/reference/sqlsrv/functions/sqlsrv-fetch-object.xml index b8b923847..5bb1d1db7 100644 --- a/reference/sqlsrv/functions/sqlsrv-fetch-object.xml +++ b/reference/sqlsrv/functions/sqlsrv-fetch-object.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_fetch_object + objectfalsenullsqlsrv_fetch_object resourcestmt stringclassName arrayctorParams diff --git a/reference/sqlsrv/functions/sqlsrv-fetch.xml b/reference/sqlsrv/functions/sqlsrv-fetch.xml index 7395a13dc..76c2d3871 100644 --- a/reference/sqlsrv/functions/sqlsrv-fetch.xml +++ b/reference/sqlsrv/functions/sqlsrv-fetch.xml @@ -9,7 +9,7 @@ &reftitle.description; - mixedsqlsrv_fetch + boolnullsqlsrv_fetch resourcestmt introw intoffset diff --git a/reference/sqlsrv/functions/sqlsrv-field-metadata.xml b/reference/sqlsrv/functions/sqlsrv-field-metadata.xml index 2791452c2..387ff94c8 100644 --- a/reference/sqlsrv/functions/sqlsrv-field-metadata.xml +++ b/reference/sqlsrv/functions/sqlsrv-field-metadata.xml @@ -10,7 +10,7 @@ &reftitle.description; - mixedsqlsrv_field_metadata + arrayfalsesqlsrv_field_metadata resourcestmt diff --git a/reference/sqlsrv/functions/sqlsrv-get-config.xml b/reference/sqlsrv/functions/sqlsrv-get-config.xml index 196382e22..ddde8cfc6 100644 --- a/reference/sqlsrv/functions/sqlsrv-get-config.xml +++ b/reference/sqlsrv/functions/sqlsrv-get-config.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_get_config + intboolsqlsrv_get_config stringsetting diff --git a/reference/sqlsrv/functions/sqlsrv-next-result.xml b/reference/sqlsrv/functions/sqlsrv-next-result.xml index 51fbe8727..e77fb1c68 100644 --- a/reference/sqlsrv/functions/sqlsrv-next-result.xml +++ b/reference/sqlsrv/functions/sqlsrv-next-result.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_next_result + boolnullsqlsrv_next_result resourcestmt diff --git a/reference/sqlsrv/functions/sqlsrv-num-fields.xml b/reference/sqlsrv/functions/sqlsrv-num-fields.xml index 03ddeb9d4..5b514c32c 100644 --- a/reference/sqlsrv/functions/sqlsrv-num-fields.xml +++ b/reference/sqlsrv/functions/sqlsrv-num-fields.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_num_fields + intfalsesqlsrv_num_fields resourcestmt diff --git a/reference/sqlsrv/functions/sqlsrv-num-rows.xml b/reference/sqlsrv/functions/sqlsrv-num-rows.xml index 9a4689502..3a25a7624 100644 --- a/reference/sqlsrv/functions/sqlsrv-num-rows.xml +++ b/reference/sqlsrv/functions/sqlsrv-num-rows.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_num_rows + intfalsesqlsrv_num_rows resourcestmt diff --git a/reference/sqlsrv/functions/sqlsrv-prepare.xml b/reference/sqlsrv/functions/sqlsrv-prepare.xml index 0fe6b40d7..cc94ff8bc 100644 --- a/reference/sqlsrv/functions/sqlsrv-prepare.xml +++ b/reference/sqlsrv/functions/sqlsrv-prepare.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_prepare + resourcefalsesqlsrv_prepare resourceconn stringsql arrayparams diff --git a/reference/sqlsrv/functions/sqlsrv-query.xml b/reference/sqlsrv/functions/sqlsrv-query.xml index 242670938..1d02b6cf2 100644 --- a/reference/sqlsrv/functions/sqlsrv-query.xml +++ b/reference/sqlsrv/functions/sqlsrv-query.xml @@ -8,7 +8,7 @@ &reftitle.description; - mixedsqlsrv_query + resourcefalsesqlsrv_query resourceconn stringsql arrayparams diff --git a/reference/sqlsrv/functions/sqlsrv-send-stream-data.xml b/reference/sqlsrv/functions/sqlsrv-send-stream-data.xml index 30c4e2dd8..fa690a197 100644 --- a/reference/sqlsrv/functions/sqlsrv-send-stream-data.xml +++ b/reference/sqlsrv/functions/sqlsrv-send-stream-data.xml @@ -8,7 +8,7 @@ &reftitle.description; - boolsqlsrv_send_stream_data + boolnullsqlsrv_send_stream_data resourcestmt @@ -35,7 +35,8 @@ &reftitle.returnvalues; - Returns &true; if there is more data to send and &false; if there is not. + Returns &true; if there is more data to send, &null; if all of the data has + been sent, and &false; if an error occurred. diff --git a/reference/sqlsrv/functions/sqlsrv-server-info.xml b/reference/sqlsrv/functions/sqlsrv-server-info.xml index 4937bdc05..28372529a 100644 --- a/reference/sqlsrv/functions/sqlsrv-server-info.xml +++ b/reference/sqlsrv/functions/sqlsrv-server-info.xml @@ -8,7 +8,7 @@ &reftitle.description; - arraysqlsrv_server_info + arrayfalsesqlsrv_server_info resourceconn @@ -33,7 +33,7 @@ &reftitle.returnvalues; - Returns an array as described in the following table: + Returns an array as described in the following table, or &false; on failure:
Returned Array