Menu

#52 [PHP]Unify the return value of some functions when they fail

open
nobody
None
5
2012-01-01
2012-01-01
Jira Trac
No

Effective functions:
- [cubrid_affected_rows|http://www.php.net/manual/en/function.cubrid-affected-rows.php]:If the request identifier is not specified, it will return NULL and if there is no last request, it will return FALSE now. So we should unify these two situation, we will return NULL in both situation.
- [cubrid_col_size|http://www.php.net/manual/en/function.cubrid-col-size.php]
- [cubrid_column_names|http://www.php.net/manual/en/function.cubrid-column-names.php]
- [cubrid_column_types|http://www.php.net/manual/en/function.cubrid-column-types.php]
- [cubrid_connect_with_url|http://www.php.net/manual/en/function.cubrid-connect-with-url.php]
- [cubrid_connect|http://www.php.net/manual/en/function.cubrid-connect.php]
- [cubrid_current_oid|http://www.php.net/manual/en/function.cubrid-current-oid.php]
- [cubrid_get_charset|http://www.php.net/manual/en/function.cubrid-get-charset.php]
- [cubrid_get_class_name|http://www.php.net/manual/en/function.cubrid-get-class-name.php]
- [cubrid_get_client_info|http://www.php.net/manual/en/function.cubrid-get-client-info.php]
- [cubrid_get_db_parameter|http://www.php.net/manual/en/function.cubrid-get-db-parameter.php]
- [cubrid_get_query_timeout|http://www.php.net/manual/en/function.cubrid-get-query-timeout.php]
- [cubrid_get_server_info|http://www.php.net/manual/en/function.cubrid-get-server-info.php]
- [cubrid_insert_id|http://www.php.net/manual/en/function.cubrid-insert-id.php]
- [cubrid_lob_get|http://www.php.net/manual/en/function.cubrid-lob-get.php]
- [cubrid_lob_size|http://www.php.net/manual/en/function.cubrid-lob-size.php]
- [cubrid_pconnect_with_ur|http://www.php.net/manual/en/function.cubrid-pconnect-with-url.php]
- [cubrid_pconnect|http://www.php.net/manual/en/function.cubrid-pconnect.php]
- [cubrid_prepare|http://www.php.net/manual/en/function.cubrid-prepare.php]
- [cubrid_schema|http://www.php.net/manual/en/function.cubrid-schema.php]

The following functions return FALSE if there are no rows and return NULL if they are unsuccessful.
- [cubrid_fetch|http://www.php.net/manual/en/function.cubrid-fetch.php]
- [cubrid_fetch_array|http://www.php.net/manual/en/function.cubrid-fetch-array.php]
- [cubrid_fetch_assoc|http://www.php.net/manual/en/function.cubrid-fetch-assoc.php]
- [cubrid_fetch_row|http://www.php.net/manual/en/function.cubrid-fetch-row.php]
- [cubrid_fetch_object|http://www.php.net/manual/en/function.cubrid-fetch-object.php]

Reason: MySQL, PostgreSQL and Oracle return FALSE if there are no more rows. So we return FALSE when there are no more rows. For distinguishing this situation, we return NULL when they are unsuccessful.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.