From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtsql/, dev-qt/qtsql/files/
Date: Sat, 26 Oct 2019 10:52:36 +0000 (UTC) [thread overview]
Message-ID: <1572087139.6519752b4d6e8609db3a09a2a3da94d329d443e2.asturm@gentoo> (raw)
commit: 6519752b4d6e8609db3a09a2a3da94d329d443e2
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 21:12:07 2019 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Oct 26 10:52:19 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6519752b
dev-qt/qtsql: Fix build against PostgreSQL 12.0
Backport from qtsql 5.14 branch.
Tested-by: Nils Freydank <holgersson <AT> posteo.de>
Bug: https://bugs.gentoo.org/696870
Package-Manager: Portage-2.3.77, Repoman-2.3.17
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
.../qtsql/files/qtsql-5.12.5-postgresql-12.patch | 97 ++++++++++++++++++++++
dev-qt/qtsql/qtsql-5.12.5-r2.ebuild | 62 ++++++++++++++
2 files changed, 159 insertions(+)
diff --git a/dev-qt/qtsql/files/qtsql-5.12.5-postgresql-12.patch b/dev-qt/qtsql/files/qtsql-5.12.5-postgresql-12.patch
new file mode 100644
index 00000000000..7e344389e5d
--- /dev/null
+++ b/dev-qt/qtsql/files/qtsql-5.12.5-postgresql-12.patch
@@ -0,0 +1,97 @@
+From 14b61d48e8bad6223a08843cf363ef48f09c479b Mon Sep 17 00:00:00 2001
+From: Christian Ehrlicher <ch.ehrlicher@gmx.de>
+Date: Fri, 11 Oct 2019 20:53:49 +0200
+Subject: [PATCH] QPSQL: Add support for PostgreSQL 12
+
+Add proper version check and replace long deprecated and now removed
+access to pg_attrdef.adsrc.
+
+[ChangeLog][QtSql][QPSQL] added support for PostgreSQL 12
+
+Fixes: QTBUG-79033
+Fixes: QTBUG-79064
+Change-Id: Iec1b13945c34ea017139ad1c5539ab5b7f1e03aa
+Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
+---
+ src/plugins/sqldrivers/psql/qsql_psql.cpp | 43 +++++++++++++++++--------------
+ src/plugins/sqldrivers/psql/qsql_psql_p.h | 1 +
+ 2 files changed, 25 insertions(+), 19 deletions(-)
+
+diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
+index 3803f05b9f9..760685f64b4 100644
+--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
++++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
+@@ -1078,8 +1078,10 @@ static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
+ return QPSQLDriver::Version10;
+ case 11:
+ return QPSQLDriver::Version11;
++ case 12:
++ return QPSQLDriver::Version12;
+ default:
+- if (vMaj > 11)
++ if (vMaj > 12)
+ return QPSQLDriver::UnknownLaterVersion;
+ break;
+ }
+@@ -1439,26 +1441,29 @@ QSqlRecord QPSQLDriver::record(const QString &tablename) const
+ else
+ schema = std::move(schema).toLower();
+
+- QString stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
+- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
+- "pg_attrdef.adsrc "
+- "from pg_class, pg_attribute "
+- "left join pg_attrdef on (pg_attrdef.adrelid = "
+- "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) "
+- "where %1 "
+- "and pg_class.relname = '%2' "
+- "and pg_attribute.attnum > 0 "
+- "and pg_attribute.attrelid = pg_class.oid "
+- "and pg_attribute.attisdropped = false "
+- "order by pg_attribute.attnum");
+- if (schema.isEmpty())
+- stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid)"));
+- else
+- stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
+- "pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
++ const QString adsrc = protocol() < Version8
++ ? QStringLiteral("pg_attrdef.adsrc")
++ : QStringLiteral("pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid)");
++ const QString nspname = schema.isEmpty()
++ ? QStringLiteral("pg_table_is_visible(pg_class.oid)")
++ : QStringLiteral("pg_class.relnamespace = (SELECT oid FROM "
++ "pg_namespace WHERE pg_namespace.nspname = '%1')").arg(schema);
++ const QString stmt =
++ QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
++ "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
++ "%1 "
++ "FROM pg_class, pg_attribute "
++ "LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
++ "pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
++ "WHERE %2 "
++ "AND pg_class.relname = '%3' "
++ "AND pg_attribute.attnum > 0 "
++ "AND pg_attribute.attrelid = pg_class.oid "
++ "AND pg_attribute.attisdropped = false "
++ "ORDER BY pg_attribute.attnum").arg(adsrc, nspname, tbl);
+
+ QSqlQuery query(createResult());
+- query.exec(stmt.arg(tbl));
++ query.exec(stmt);
+ while (query.next()) {
+ int len = query.value(3).toInt();
+ int precision = query.value(4).toInt();
+diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
+index 99e0b5f60f5..9ac1fb50d79 100644
+--- a/src/plugins/sqldrivers/psql/qsql_psql_p.h
++++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
+@@ -93,6 +93,7 @@ public:
+ Version9_6 = 22,
+ Version10 = 23,
+ Version11 = 24,
++ Version12 = 25,
+ UnknownLaterVersion = 100000
+ };
+
+--
+2.16.3
diff --git a/dev-qt/qtsql/qtsql-5.12.5-r2.ebuild b/dev-qt/qtsql/qtsql-5.12.5-r2.ebuild
new file mode 100644
index 00000000000..48eb0930db1
--- /dev/null
+++ b/dev-qt/qtsql/qtsql-5.12.5-r2.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+QT5_MODULE="qtbase"
+inherit qt5-build
+
+DESCRIPTION="SQL abstraction library for the Qt5 framework"
+SLOT=5/$(ver_cut 1-3) # bug 639140
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+fi
+
+IUSE="freetds mysql oci8 odbc postgres +sqlite"
+
+REQUIRED_USE="
+ || ( freetds mysql oci8 odbc postgres sqlite )
+"
+
+DEPEND="
+ ~dev-qt/qtcore-${PV}
+ freetds? ( dev-db/freetds )
+ mysql? ( dev-db/mysql-connector-c:= )
+ oci8? ( dev-db/oracle-instantclient:=[sdk] )
+ odbc? ( dev-db/unixODBC )
+ postgres? ( dev-db/postgresql:* )
+ sqlite? ( dev-db/sqlite:3 )
+"
+RDEPEND="${DEPEND}"
+
+QT5_TARGET_SUBDIRS=(
+ src/sql
+ src/plugins/sqldrivers
+)
+
+QT5_GENTOO_PRIVATE_CONFIG=(
+ :sql
+)
+
+PATCHES+=(
+ # Backport from 5.14 branch, bug #696870
+ "${FILESDIR}/${P}-postgresql-12.patch"
+ # Backport from dev branch
+ "${FILESDIR}/${PN}-5.12.4-mysql_free_results_when_qsqlquery_finished_is_called.patch"
+)
+
+src_configure() {
+ local myconf=(
+ $(qt_use freetds sql-tds plugin)
+ $(qt_use mysql sql-mysql plugin)
+ $(qt_use oci8 sql-oci plugin)
+ $(qt_use odbc sql-odbc plugin)
+ $(qt_use postgres sql-psql plugin)
+ $(qt_use sqlite sql-sqlite plugin)
+ $(usex sqlite -system-sqlite '')
+ )
+
+ use oci8 && myconf+=("-I${ORACLE_HOME}/include" "-L${ORACLE_HOME}/$(get_libdir)")
+
+ qt5-build_src_configure
+}
next reply other threads:[~2019-10-26 10:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 10:52 Andreas Sturmlechner [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-03-26 11:56 [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtsql/, dev-qt/qtsql/files/ Andreas Sturmlechner
2019-07-21 16:13 Andreas Sturmlechner
2018-02-22 20:09 Andreas Sturmlechner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1572087139.6519752b4d6e8609db3a09a2a3da94d329d443e2.asturm@gentoo \
--to=asturm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox