protected function determineLastInsertId(callable $callback, $sequenceName)
	{
		try
		{
			switch($this->driverName)
			{
				case DB::DRIVER_MYSQL:
				case DB::DRIVER_SQLITE:
					return (int)$callback();
				case DB::DRIVER_POSTGRESQL:
					if(is_array($sequenceName))
					{
						$stmt = $this->prepare("SELECT currval(pg_get_serial_sequence(:table, :col))");
						$stmt->bindValue('table', $this->prepareSql($sequenceName[0]));
						$stmt->bindValue('col', $sequenceName[1]);
						$stmt->execute();
							
						return (int)$stmt->fetchNextColumn(0);
					}
					return $callback($this->prepareSql($sequenceName));
				case DB::DRIVER_MYSQL:
					$stmt = $this->prepare("SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int)");
					$stmt->execute();
						
					return (int)$stmt->fetchNextColumn(0);
			}
		
			return (int)$callback($this->prepareSql($sequenceName));
		}
		catch(\Exception $e)
		{
			throw $this->convertException($e);
		}
	}
protected function determineLastInsertId(callable $callback, $sequenceName)
	{
		try
		{
			switch($this->driverName)
			{
				case DB::DRIVER_MYSQL:
				case DB::DRIVER_SQLITE:
					return (int)$callback();
				case DB::DRIVER_POSTGRESQL:
					if(is_array($sequenceName))
					{
						$stmt = $this->prepare("SELECT currval(pg_get_serial_sequence(:table, :col))");
						$stmt->bindValue('table', $this->prepareSql($sequenceName[0]));
						$stmt->bindValue('col', $sequenceName[1]);
						$stmt->execute();
							
						return (int)$stmt->fetchNextColumn(0);
					}
					return $callback($this->prepareSql($sequenceName));
				case DB::DRIVER_MYSQL:
					$stmt = $this->prepare("SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int)");
					$stmt->execute();
						
					return (int)$stmt->fetchNextColumn(0);
			}
		
			return (int)$callback($this->prepareSql($sequenceName));
		}
		catch(\Exception $e)
		{
			throw $this->convertException($e);
		}
	}
protected function determineLastInsertId ( callable $ callback , $ sequenceName ) { try { switch ( $ this -> driverName ) { case DB :: DRIVER_MYSQL : case DB :: DRIVER_SQLITE : return ( int ) $ callback ( ) ; case DB :: DRIVER_POSTGRESQL : if ( is_array ( $ sequenceName ) ) { $ stmt = $ this -> prepare ( "SELECT currval(pg_get_serial_sequence(:table, :col))" ) ; $ stmt -> bindValue ( 'table' , $ this -> prepareSql ( $ sequenceName [ 0 ] ) ) ; $ stmt -> bindValue ( 'col' , $ sequenceName [ 1 ] ) ; $ stmt -> execute ( ) ; return ( int ) $ stmt -> fetchNextColumn ( 0 ) ; } return $ callback ( $ this -> prepareSql ( $ sequenceName ) ) ; case DB :: DRIVER_MYSQL : $ stmt = $ this -> prepare ( "SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int)" ) ; $ stmt -> execute ( ) ; return ( int ) $ stmt -> fetchNextColumn ( 0 ) ; } return ( int ) $ callback ( $ this -> prepareSql ( $ sequenceName ) ) ; } catch ( \ Exception $ e ) { throw $ this -> convertException ( $ e ) ; } }
Determine the last inserted ID value.

@param callable $callback The native callback to be invoked.
@param mixed $sequenceName Name of a sequence or an array containing a table name and a column name of a SERIAL column.
@return integer
Determine the last inserted ID value .