public function DriverBase::parmConvert in Forena Reports 8
Perform generic type conversion based on attributes.
Parameters
string $key : The token key for parameter replacement.
string $value : The value of the parameter
Return value
mixed Value of the parameter.
5 calls to DriverBase::parmConvert()
- FrxDrupal::format in src/
FrxPlugin/ Driver/ FrxDrupal.php - Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
- FrxMSSQL::format in src/
FrxPlugin/ Driver/ FrxMSSQL.php - Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
- FrxOracle::format in src/
FrxPlugin/ Driver/ FrxOracle.php - Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
- FrxPDO::format in src/
FrxPlugin/ Driver/ FrxPDO.php - Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
- FrxPostgres::format in src/
FrxPlugin/ Driver/ FrxPostgres.php - Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
File
- src/
FrxPlugin/ Driver/ DriverBase.php, line 475 - Class that defines default methods for access control in an DriverBase
Class
Namespace
Drupal\forena\FrxPlugin\DriverCode
public function parmConvert($key, $value) {
if (isset($this->types[$key]) && $this->types[$key]) {
if ($value === NULL || $value === '') {
$value = NULL;
}
else {
switch (strtolower($this->types[$key])) {
case 'date':
$time = @new \DateTime($value);
if ($time) {
$value = date_format($time, 'Y-m-d H:i:s');
}
else {
$value = NULL;
}
break;
case 'unixtime':
$time = @new \DateTime($value);
if ($time) {
$value = $time
->getTimestamp();
}
else {
$value = NULL;
}
break;
case 'numeric':
case 'float':
$value = (double) $value;
break;
case 'int':
case 'integer':
$value = (int) $value;
break;
case 'array':
$value = (array) $value;
break;
}
}
}
return $value;
}