Use the ParameterType::DOUBLE
No error message
Error message:
Undefined class constant 'DOUBLE'
J4.x
Honestly I don't know if this is really a bug, but a conscious choice of Joomla design in the past.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
1) Joomla has defined the following parameters:
JOOMLA\libraries\vendor\joomla\database\src\Sqlsrv\SqlsrvStatement.php
protected $parameterTypeMapping = [
ParameterType::BOOLEAN => ParameterType::BOOLEAN,
ParameterType::INTEGER => ParameterType::INTEGER,
ParameterType::LARGE_OBJECT => ParameterType::LARGE_OBJECT,
ParameterType::NULL => ParameterType::NULL,
ParameterType::STRING => ParameterType::STRING,
];
2) I compare the Joomla parameters with the following:
https://www.php.net/manual/en/mysqli-stmt.bind-param.php
i corresponding variable has type integer
d corresponding variable has type double
s corresponding variable has type string
b corresponding variable is a blob and will be sent in packets
3) That's why I started this issue. But I may be seeing this wrong.
you do realise that the first file you reference is for sql server?
This is an example of what I mean.
The ParameterType::DOUBLE
is not available.
$test = (float) $value; // e.g. $value = 2.2311
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__example'))
->where($db->quoteName('test') . ' = :test')
->bind(':test', $test, ParameterType::DOUBLE);
$db->setQuery($query);
$db->execute();
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-01-31 17:45:17 |
Closed_By | ⇒ | sandewt |
Closed
It's a kinda conscious choice. The parameter types are a way for us to backport PDO's parameter types into the other languages. Double isn't one of these types (the 5 we have are a mapping to the non-php 7.2 param types here https://www.php.net/manual/en/pdo.constants.php) so we've not done anything special for it