You are here

public function FrxPDO::quote in Forena Reports 8

Wrapper method cause some ODBC providers do not support quoting. We're going to assume the MSSQL method of quoting.

Parameters

string $value: Value to be quoted.

Return value

string Properly quoted value.

1 call to FrxPDO::quote()
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

File

src/FrxPlugin/Driver/FrxPDO.php, line 185
General database engine used to do sql queries.

Class

FrxPDO
Class FrxPDO

Namespace

Drupal\forena\FrxPlugin\Driver

Code

public function quote($value) {
  $new_value = $this->db
    ->quote($value);
  if (($value !== '' || $value !== NULL) && !$new_value) {
    $value = "'" . str_replace("'", "''", $value) . "'";
  }
  else {
    $value = $new_value;
  }
  return $value;
}