public function FrxDataSource::parmConvert in Forena Reports 7.5
Perform generic type conversion based on attributes.
Parameters
$key The token key for parameter replacement.:
$value The value of the parameter:
Return value
Ambigous <NULL, array>
5 calls to FrxDataSource::parmConvert()
- FrxDrupal::format in src/
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/
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/
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/
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/
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/
Driver/ FrxDataSource.php, line 424 - Class that defines default methods for access control in an FrxDataSource
Class
Namespace
Drupal\forena\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;
}