Updated function signatures and error messages (#1163)
This commit is contained in:
parent
550a7104a4
commit
bba1f18f0f
|
@ -58,7 +58,7 @@ class ExPDO extends PDO
|
|||
$this->test2 = 22;
|
||||
}
|
||||
|
||||
function query($sql)
|
||||
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
|
||||
{
|
||||
echo __METHOD__ . "()\n";
|
||||
$stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement')));
|
||||
|
|
|
@ -55,7 +55,7 @@ class ExPDO extends PDO
|
|||
return (call_user_func_array(array($this, 'parent::exec'), $args));
|
||||
}
|
||||
|
||||
public function query(string $statement)
|
||||
public function query($statement, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
|
||||
{
|
||||
$this->protocol();
|
||||
$args = func_get_args();
|
||||
|
|
|
@ -61,7 +61,7 @@ class ExPDO extends PDO
|
|||
echo __METHOD__ . "()\n";
|
||||
}
|
||||
|
||||
function query($sql)
|
||||
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
|
||||
{
|
||||
echo __METHOD__ . "()\n";
|
||||
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement', array($this))));
|
||||
|
|
|
@ -66,7 +66,7 @@ class ExPDO extends PDO
|
|||
echo __METHOD__ . "()\n";
|
||||
}
|
||||
|
||||
function query($sql)
|
||||
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
|
||||
{
|
||||
echo __METHOD__ . "()\n";
|
||||
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement', array($this))));
|
||||
|
|
|
@ -69,7 +69,7 @@ class ExPDO extends PDO
|
|||
echo __METHOD__ . "()\n";
|
||||
}
|
||||
|
||||
function query($sql)
|
||||
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
|
||||
{
|
||||
echo __METHOD__ . "()\n";
|
||||
$stmt = parent::query($sql);
|
||||
|
|
|
@ -80,8 +80,11 @@ function fetchAllInvalid($conn, $tbname)
|
|||
} catch (PDOException $ex) {
|
||||
print_r($ex);
|
||||
} catch (Error $err) {
|
||||
$expected = (PHP_MAJOR_VERSION == 8) ? 'PDO::FETCH_UNKNOWN' : 'FETCH_UNKNOWN';
|
||||
$message = "Undefined class constant '$expected'";
|
||||
if (PHP_MAJOR_VERSION == 8) {
|
||||
$message = "Undefined constant PDO::FETCH_UNKNOWN";
|
||||
} else {
|
||||
$message = "Undefined class constant 'FETCH_UNKNOWN'";
|
||||
}
|
||||
if ($err->getMessage() !== $message) {
|
||||
echo $err->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
|
|
@ -82,8 +82,11 @@ function fetchWithStyle($conn, $tbname, $style)
|
|||
} catch (PDOException $err) {
|
||||
print_r($err);
|
||||
} catch (Error $err) {
|
||||
$expected = (PHP_MAJOR_VERSION == 8) ? 'PDO::FETCH_UNKNOWN' : 'FETCH_UNKNOWN';
|
||||
$message = "Undefined class constant '$expected'";
|
||||
if (PHP_MAJOR_VERSION == 8) {
|
||||
$message = "Undefined constant PDO::FETCH_UNKNOWN";
|
||||
} else {
|
||||
$message = "Undefined class constant 'FETCH_UNKNOWN'";
|
||||
}
|
||||
if ($err->getMessage() !== $message) {
|
||||
echo $err->getMessage() . PHP_EOL;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ function warningHandler($errno, $errstr)
|
|||
|
||||
function compareMessages($err)
|
||||
{
|
||||
$exp8x = "Undefined constant 'SQLSRV_ENC_UNKNOWN'";
|
||||
$exp8x = 'Undefined constant "SQLSRV_ENC_UNKNOWN"';
|
||||
$exp7x = "Use of undefined constant SQLSRV_ENC_UNKNOWN - assumed 'SQLSRV_ENC_UNKNOWN' (this will throw an Error in a future version of PHP)";
|
||||
|
||||
$expected = (PHP_MAJOR_VERSION == 8) ? $exp8x : $exp7x;
|
||||
|
|
Loading…
Reference in a new issue