<commit_before><?php
/*
 V5.19dev  ??-???-2014  (c) 2000-2014 <NAME> (<EMAIL>). All rights reserved.
  Released under both BSD license and Lesser GPL library license.
  Whenever there is any discrepancy between the two licenses,
  the BSD license will take precedence.
  Set tabs to 4.

  Postgres9 support.
  01 Dec 2011: gherteg added support for retrieving insert IDs from tables without OIDs
*/

// security - hide paths
if (!defined('ADODB_DIR')) die();

include_once(ADODB_DIR."/drivers/adodb-postgres7.inc.php");

class ADODB_postgres9 extends ADODB_postgres7
{
	var $databaseType = 'postgres9';

	// Don't use OIDs, as they typically won't be there, and
	// they're not what the application wants back, anyway.
	function _insertid($table,$column)
	{
		if ( empty($table) || empty($column) ) {
			if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
			if (function_exists('pg_getlastoid')) $oid = pg_getlastoid($this->_resultid);
			else $oid = false;
			return $oid;
		}

		return	$this->GetOne("SELECT currval(pg_get_serial_sequence('$table','$column'))");
	}
}

class ADORecordSet_postgres9 extends ADORecordSet_postgres7
{
	var $databaseType = "postgres9";
}

class ADORecordSet_assoc_postgres9 extends ADORecordSet_assoc_postgres7
{
	var $databaseType = "postgres9";
}
<commit_msg>Postgres: use lastval() to retrieve last insert id<commit_after><?php
/*
 V5.19dev  ??-???-2014  (c) 2000-2014 <NAME> (<EMAIL>). All rights reserved.
  Released under both BSD license and Lesser GPL library license.
  Whenever there is any discrepancy between the two licenses,
  the BSD license will take precedence.
  Set tabs to 4.

  Postgres9 support.
  01 Dec 2011: gherteg added support for retrieving insert IDs from tables without OIDs
*/

// security - hide paths
if (!defined('ADODB_DIR')) die();

include_once(ADODB_DIR."/drivers/adodb-postgres7.inc.php");

class ADODB_postgres9 extends ADODB_postgres7
{
	var $databaseType = 'postgres9';

	// Don't use OIDs, as they typically won't be there, and
	// they're not what the application wants back, anyway.
	function _insertid($table,$column)
	{
		return empty($table) || empty($column)
			? $this->GetOne("SELECT lastval()")
			: $this->GetOne("SELECT currval(pg_get_serial_sequence('$table', '$column'))");
	}
}

class ADORecordSet_postgres9 extends ADORecordSet_postgres7
{
	var $databaseType = "postgres9";
}

class ADORecordSet_assoc_postgres9 extends ADORecordSet_assoc_postgres7
{
	var $databaseType = "postgres9";
}

{'fraction_non_alphanumeric': 0.12075769534333071, 'fraction_numerical': 0.026045777426992895, 'mean_word_length': 4.827586206896552, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '5876635', 'n_tokens_mistral': 927, 'n_tokens_neox': 845, 'n_words': 243}