Added mysqli_query error management for older php versions to function myq; minor changes

This commit is contained in:
pezcurrel 2022-12-16 19:05:46 +01:00
parent 4522bc3ea8
commit bab5bd5dd2

View file

@ -55,6 +55,8 @@ $opts=[
'jsonwrite'=>false,
];
$ghtsa=[[' day',' days'],[' hour',' hours'],[' minute',' minutes'],[' second',' seconds']];
$help='SYNOPSIS
'.SNAME.' [options]
@ -82,13 +84,13 @@ OPTIONS
it dead. See section «TIME SPECIFICATION» below to see how to specify time.
This option gets passed to each '.CHILD.' process as is, and has no effect
on '.SNAME.' itself.
DEFAULT: '.ght($opts['deadline'],[' day§ days',' hour§ hours',' minute§ minutes',' second§ seconds']).'
DEFAULT: '.ght($opts['deadline'],$ghtsa).'
-o, --oldline <time specification>
If an instance has been marked as new for more than this time, mark it as
not new. See section «TIME SPECIFICATION» below to see how to specify time.
This option gets passed to each '.CHILD.' process as is, and has no effect
on '.SNAME.' itself.
DEFAULT: '.ght($opts['oldline'],[' day§ days',' hour§ hours',' minute§ minutes',' second§ seconds']).'
DEFAULT: '.ght($opts['oldline'],$ghtsa).'
-l, --ldtoots <number>
This option defines the number of toots that '.CHILD.' processes will try
to fetch from the local public timelines to try and guess the most used
@ -421,6 +423,8 @@ function myq(&$link,$query,$line) {
catch (Exception $error) {
mexit('query «'.$query.'» (line '.$line.') failed: '.$error->getMessage().N,3);
}
// for older php versions, which seem to not catch mysql exceptions
if ($res===false) mexit('query «'.$query.'» (line '.$line.') failed: '.mysqli_errno($link).': '.mysqli_error($link).N,3);
return($res);
}