Req #78855 [Com]: Native PHP types in database fetches

From: Date: Fri, 22 Nov 2019 12:23:41 +0000
Subject: Req #78855 [Com]: Native PHP types in database fetches
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223850@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78855&edit=1 ID: 78855 Comment by: fgfgfgfdf at somewhere dot com Reported by: olegxx at gmail dot com Summary: Native PHP types in database fetches Status: Open Type: Feature/Change Request Package: PostgreSQL related Operating System: Linux PHP Version: 7.2.25 Block user comment: N Private report: N New Comment: > This extension do not have any connection wide options cool, than introduce pg_options() is the right thing to do for the sake of cosistency and usability either i have a strict typed project or not and seek and adjust every single line containing pg_ don't scale at any moment, in a existing codebase nobody would do that and later you can be sure people forget to use the option here and there which is not funny when you get strings instead int on random places Previous Comments: ------------------------------------------------------------------------ [2019-11-22 12:19:31] imbolk at gmail dot com Of course I understand that. I don't think you understand what I mean. Now pg_fetch_result returns FALSE on the error. If they do as you suggest, it will return FALSE on the error and FALSE if it need to return the boolean value of FALSE, which came from the database. ------------------------------------------------------------------------ [2019-11-22 12:14:00] olegxx at gmail dot com This extension do not have any connection wide options. The problem with pg_fetch_result is that it cannot return false as valid result because it return false is case of an error. ------------------------------------------------------------------------ [2019-11-22 11:35:36] fgfgfgfdf at somewhere dot com didn't you get the point? it has to be *connection wide* option and it shouldn't be completly different for each and every database type mysqli_init() -> mysqli_options() -> mysqli_real_connect() ------------------------------------------------------------------------ [2019-11-22 11:29:36] imbolk at gmail dot com fgfgfgfdf, what about pg_fetch_result? It returns false on an error and will, in your case, return false also if it succeeds in getting the value false. ------------------------------------------------------------------------ [2019-11-22 11:11:27] fgfgfgfdf at somewhere dot com it's simply wrong add a param to each and every function and just to two can't be serious - how do you imagine to port existing code to that without a ton of errors over the time? besides that another quick shot with mor incosntistences given that myqli has solved that years ago ina proper way if(mysqli_options($this->conn, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, TRUE) === FALSE) { $this->error('mysqli_options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE) failed'); } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=78855 -- Edit this bug report at https://bugs.php.net/bug.php?id=78855&edit=1

« previous php.bugs (#223850) next »