code: public static function dbValue($value, $nullValue = 'NULL')
      {
          if ($value === null) {
              return $nullValue;
          }
  
          if (is_string($value)) {
              return '\'' . str_replace('\'', '\'\'', $value) . '\'';
          }
  
          if (is_bool($value)) {
              return $value ? '1' : '0';
          }
  
          return $value;
      }
docs: Return value to be used for concatenation as a database value
  
  @param         $value
  @param  string $nullValue to be used if value is null
  
  @return string