home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,820 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Lawrence D'Oliveiro   
   Re: VMS x86-64 database server   
   09 Jul 25 22:24:50   
   
   From: arne@vajhoej.dk   
      
   On 7/9/2025 9:21 PM, Lawrence D'Oliveiro wrote:   
   > On Wed, 9 Jul 2025 19:51:30 -0400, Arne Vajhøj wrote:   
   >   
   >> error_reporting(E_ERROR) is not need to get SQL errors - it is to avoid   
   >> getting warnings about mysql extension being obsolete.   
   >   
   > I think you need   
   >   
   >      mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);   
   >   
   > in order to get error exceptions raised about incorrect MySQL. Sensible   
   > languages would do this by default.   
      
   There are fundamentally two different ways of handling errors:   
   * return status   
   * exception   
      
   Different languages use different approaches. C use return status.   
   Java use exception.   
      
   PHP give you the choice of which you want (for mysqli and pdo mysql   
   and many other).   
      
   $ type err1.php   
      
   $ php err1.php   
   You have an error in your SQL syntax; check the manual that corresponds   
   to your MySQL server version for the right syntax to use near 'needed'   
   at line 1   
   $ type err2.php   
   getMessage() . "\r\n";   
        mysqli_close($con);   
   }   
   ?>   
   $ php err2.php   
   You have an error in your SQL syntax; check the manual that corresponds   
   to your MySQL server version for the right syntax to use near 'needed'   
   at line 1   
      
   Default in recent PHP versions is exceptions.   
      
   I prefer exceptions over return status, but not everybody agrees.   
      
   PHP provide a way to use return status for those that prefer that.   
      
   Some must prefer it that way. There are also newer languages   
   being created without exceptions.   
      
   I would say that in general high level languages do exceptions   
   while low level languages don't do exceptions.   
      
   PHP is a high level language, but while PHP in recent years   
   has been very inspired by Java, then in the beginning it was   
   very inspired by C. It got some baggage - a common example   
   is all the strxxx functions.   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca