aboutsummaryrefslogtreecommitdiff
path: root/databases/pear-Horde_Db
diff options
context:
space:
mode:
authorMichael Reifenberger <mr@FreeBSD.org>2020-03-14 20:39:10 +0000
committerMichael Reifenberger <mr@FreeBSD.org>2020-03-14 20:39:10 +0000
commitd1049ae2f500164e61280c0e81d81e2b0843e921 (patch)
tree90e5bbba6f83059dbf2f5fd5a0f25fa13044cdb6 /databases/pear-Horde_Db
parent847846bd6466da7ef58076908ce55fb290491db5 (diff)
downloadports-d1049ae2f500164e61280c0e81d81e2b0843e921.tar.gz
ports-d1049ae2f500164e61280c0e81d81e2b0843e921.zip
Add upstream patch to Postgresql/Schema.php fixing the access for PostgreSQL >= 10
(extracted from the github repo of Horde-Db) Maintainer timeout: 4 weeks
Notes
Notes: svn path=/head/; revision=528440
Diffstat (limited to 'databases/pear-Horde_Db')
-rw-r--r--databases/pear-Horde_Db/Makefile1
-rw-r--r--databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php82
2 files changed, 83 insertions, 0 deletions
diff --git a/databases/pear-Horde_Db/Makefile b/databases/pear-Horde_Db/Makefile
index 9e72047adc82..1283b01251d8 100644
--- a/databases/pear-Horde_Db/Makefile
+++ b/databases/pear-Horde_Db/Makefile
@@ -2,6 +2,7 @@
PORTNAME= Horde_Db
PORTVERSION= 2.4.0
+PORTREVISION= 1
CATEGORIES= databases www pear
MAINTAINER= horde@FreeBSD.org
diff --git a/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php b/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php
new file mode 100644
index 000000000000..e813726126f6
--- /dev/null
+++ b/databases/pear-Horde_Db/files/patch-lib_Horde_Db_Adapter_Postgresql_Schema.php
@@ -0,0 +1,82 @@
+--- lib/Horde/Db/Adapter/Postgresql/Schema.php.orig 2017-02-27 10:00:17 UTC
++++ lib/Horde/Db/Adapter/Postgresql/Schema.php
+@@ -3,12 +3,15 @@
+ * Copyright 2007 Maintainable Software, LLC
+ * Copyright 2008-2017 Horde LLC (http://www.horde.org/)
+ *
++ * See the enclosed file LICENSE for license information (BSD). If you
++ * did not receive this file, see http://www.horde.org/licenses/bsd.
++ *
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Derek DeVries <derek@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Jan Schneider <jan@horde.org>
+- * @license http://www.horde.org/licenses/bsd
+ * @category Horde
++ * @license http://www.horde.org/licenses/bsd
+ * @package Db
+ * @subpackage Adapter
+ */
+@@ -21,8 +24,10 @@
+ * @author Derek DeVries <derek@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Jan Schneider <jan@horde.org>
+- * @license http://www.horde.org/licenses/bsd
+ * @category Horde
++ * @copyright 2007 Maintainable Software, LLC
++ * @copyright 2008-2017 Horde LLC
++ * @license http://www.horde.org/licenses/bsd
+ * @package Db
+ * @subpackage Adapter
+ */
+@@ -1057,13 +1062,32 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde
+ $quotedSequence = $this->quoteSequenceName($sequence);
+ $quotedTable = $this->quoteTableName($table);
+ $quotedPk = $this->quoteColumnName($pk);
+-
+- $sql = sprintf('SELECT setval(%s, (SELECT COALESCE(MAX(%s) + (SELECT increment_by FROM %s), (SELECT min_value FROM %s)) FROM %s), false)',
+- $quotedSequence,
+- $quotedPk,
+- $sequence,
+- $sequence,
+- $quotedTable);
++ if ($this->postgresqlVersion() >= 100000) {
++ $sql = sprintf('
++ SELECT setval(
++ %s,
++ (SELECT COALESCE(
++ MAX(%s) + (SELECT increment_by FROM pg_sequences WHERE schemaname=ANY(CURRENT_SCHEMAS(false)) AND sequencename=%s),
++ (SELECT min_value FROM pg_sequences WHERE schemaname=ANY(CURRENT_SCHEMAS(false)) AND sequencename=%s)
++ ) FROM %s),
++ false
++ )',
++ $quotedSequence,
++ $quotedPk,
++ $quotedSequence,
++ $quotedSequence,
++ $quotedTable
++ );
++ } else {
++ $sql = sprintf(
++ 'SELECT setval(%s, (SELECT COALESCE(MAX(%s) + (SELECT increment_by FROM %s), (SELECT min_value FROM %s)) FROM %s), false)',
++ $quotedSequence,
++ $quotedPk,
++ $sequence,
++ $sequence,
++ $quotedTable
++ );
++ }
+ $this->selectValue($sql, 'Reset sequence');
+ } else {
+ if ($this->_logger) {
+@@ -1138,9 +1162,7 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde
+ {
+ if (!$this->_version) {
+ try {
+- $version = $this->selectValue('SELECT version()');
+- if (preg_match('/PostgreSQL (\d+)\.(\d+)\.(\d+)/', $version, $matches))
+- $this->_version = ($matches[1] * 10000) + ($matches[2] * 100) + $matches[3];
++ $this->_version = $this->selectValue('SHOW server_version_num');
+ } catch (Exception $e) {
+ return 0;
+ }