No Code Attached Yet
avatar sandewt
sandewt
9 Sep 2022

Steps to reproduce the issue

Use the ParameterType::DOUBLE

Expected result

No error message

Actual result

Error message:
Undefined class constant 'DOUBLE'

System information (as much as possible)

J4.x

Additional comments

Honestly I don't know if this is really a bug, but a conscious choice of Joomla design in the past.

avatar sandewt sandewt - open - 9 Sep 2022
avatar sandewt sandewt - change - 9 Sep 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 9 Sep 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Sep 2022
avatar wilsonge
wilsonge - comment - 10 Sep 2022

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

avatar sandewt
sandewt - comment - 11 Sep 2022

@wilsonge

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.

avatar brianteeman
brianteeman - comment - 11 Sep 2022

you do realise that the first file you reference is for sql server?

avatar sandewt
sandewt - comment - 12 Sep 2022

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();


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38730.
avatar sandewt sandewt - close - 31 Jan 2023
avatar sandewt sandewt - change - 31 Jan 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-01-31 17:45:17
Closed_By sandewt
avatar sandewt
sandewt - comment - 31 Jan 2023

Closed

Add a Comment

Login with GitHub to post a comment