<commit_before><?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class TikiDb_Pdo_Result
{
	public $result;
	public $numrows;

	function __construct ($result)
	{
		$this->result = &$result;
		$this->numrows = count($this->result);
	}

	function fetchRow()
	{
		return is_array($this->result) ? array_shift($this->result) : 0;
	}

	function numRows()
	{
		return $this->numrows;
	}
}

class TikiDb_Pdo extends TikiDb
{
	private $db;

	function __construct( $db ) // {{{
	{
		if (!$db) {
			die ("Invalid db object passed to TikiDB constructor");
		}

		$this->db=$db;
		$this->setServerType($db->getAttribute(PDO::ATTR_DRIVER_NAME));
	} // }}}

	function qstr( $str ) // {{{
	{
		if( is_null($str) )
			return 'NULL';
		return $this->db->quote($str);
	} // }}}

	private function _query($query, $values = null, $numrows = -1, $offset = -1) // {{{
	{
		global $num_queries;
		$num_queries++;

		$numrows = intval($numrows);
		$offset = intval($offset);
		if ( $query == null ) {
			$query = $this->getQuery();
		}<commit_msg>[REF] Hint on $db type<commit_after><?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class TikiDb_Pdo_Result
{
	public $result;
	public $numrows;

	function __construct ($result)
	{
		$this->result = &$result;
		$this->numrows = count($this->result);
	}

	function fetchRow()
	{
		return is_array($this->result) ? array_shift($this->result) : 0;
	}

	function numRows()
	{
		return $this->numrows;
	}
}

class TikiDb_Pdo extends TikiDb
{
	/** @var PDO $db */
	private $db;

	/**
	 * TikiDb_Pdo constructor.
	 * @param PDO $db 
	 */
	function __construct( $db ) // {{{
	{
		if (!$db) {
			die ("Invalid db object passed to TikiDB constructor");
		}

		$this->db=$db;
		$this->setServerType($db->getAttribute(PDO::ATTR_DRIVER_NAME));
	} // }}}

	function qstr( $str ) // {{{
	{
		if( is_null($str) )
			return 'NULL';
		return $this->db->quote($str);
	} // }}}

	private function _query($query, $values = null, $numrows = -1, $offset = -1) // {{{
	{
		global $num_queries;
		$num_queries++;

		$numrows = intval($numrows);
		$offset = intval($offset);
		if ( $query == null ) {
			$query = $this->getQuery();
		}
{'fraction_non_alphanumeric': 0.17276264591439688, 'fraction_numerical': 0.008560311284046693, 'mean_word_length': 3.4251290877796903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6779162', 'n_tokens_mistral': 1020, 'n_tokens_neox': 931, 'n_words': 238}