<commit_before><?php
/**
 * Firebird Database Connection (extends PDO)
 *
 * @package     NOFUZZ
*/
################################################################################################################################
/*
FIREBIRD:
  $connection = new PDO("firebird:dbname=<hostname>/<port>:C:\\path\\filename.fdb", $user, $pass,
    array(
      PDO::ATTR_PERSISTENT => true
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_AUTOCOMMIT => false
    )
  );
  setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%s')
  setAttribute(PDO::FB_ATTR_DATE_FORMAT, '%s' )
  setAttribute(PDO::FB_ATTR_TIME_FORMAT, '%S' )
  setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%s' )
*/

namespace Nofuzz\Database\Drivers\Pdo;

class Firebird extends \Nofuzz\Database\PdoConnection
{
  /**
   * Constructor
   *
   * @param string $connectionName [description]
   * @param array  $params         [description]
   */
  public function __construct(string $connectionName, array $params=[])
  {
    # Firebird default PDO options
    if (count($params['options'] ?? [])==0) {
      $params['options'] = [
          \PDO::ATTR_PERSISTENT => TRUE,
          \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
          // \PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
          \PDO::ATTR_AUTOCOMMIT => FALSE
        ];
    }

    # Parent Constructor (\Nofuzz\Database\PdoConnection)
    parent::__construct($connectionName,$params);
  }

  /**
   * Get DSN - Firebird formatting
   *
   * @return string       [description]
   */
  public function getDsn(): string
  {
    # Build the DSN
    $_dsn = $this->getDriver().':'.
            'dbname='.$this->GetHost().':'.($this->GetPort()!=0 ? ':'.$this->GetPort().':' : '' ).$this->GetSchema().';'.
            'charset='.$this->GetCharset();
    # Set it
    $this->setDsn($_dsn);<commit_msg>Firebird PDO connections string corrections<commit_after><?php
/**
 * Firebird Database Connection (extends PDO)
 *
 * @package     NOFUZZ
*/
################################################################################################################################
/*
FIREBIRD:
  $connection = new PDO("firebird:dbname=<hostname>/<port>:C:\\path\\filename.fdb", $user, $pass,
    array(
      PDO::ATTR_PERSISTENT => true
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_AUTOCOMMIT => false
    )
  );
  setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%s')
  setAttribute(PDO::FB_ATTR_DATE_FORMAT, '%s' )
  setAttribute(PDO::FB_ATTR_TIME_FORMAT, '%S' )
  setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%s' )
*/

namespace Nofuzz\Database\Drivers\Pdo;

class Firebird extends \Nofuzz\Database\PdoConnection
{
  /**
   * Constructor
   *
   * @param string $connectionName [description]
   * @param array  $params         [description]
   */
  public function __construct(string $connectionName, array $params=[])
  {
    # Firebird default PDO options
    if (count($params['options'] ?? [])==0) {
      $params['options'] = [
          \PDO::ATTR_PERSISTENT => TRUE,
          \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
          // \PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
          \PDO::ATTR_AUTOCOMMIT => FALSE
        ];
    }

    # Parent Constructor (\Nofuzz\Database\PdoConnection)
    parent::__construct($connectionName,$params);
  }

  /**
   * Get DSN - Firebird formatting
   *
   * @return string       [description]
   */
  public function getDsn(): string
  {
    # Build the DSN
    $_dsn = $this->getDriver().':'.
            'host='.$this->GetHost().($this->GetPort()!=0 ? ':'.$this->GetPort() : '' ).';'.
            'dbname='.$this->GetSchema().';'.
            'charset='.$this->GetCharset();
    # Set it
    $this->setDsn($_dsn);
{'fraction_non_alphanumeric': 0.2305413412335039, 'fraction_numerical': 0.0010772959870724481, 'mean_word_length': 3.4109263657957243, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1197481', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1208, 'n_words': 189}