PSARC/2016/072 DBD::mysql perl module integration to Solaris
authorVladimir Marek <Vladimir.Marek@oracle.com>
Tue, 26 Apr 2016 12:09:07 +0200
changeset 5913 02e8b39413b9
parent 5912 1d6640a68002
child 5914 b2220d33b0b8
PSARC/2016/072 DBD::mysql perl module integration to Solaris 15563282 SUNBT6841683 provide DBD::mysql for Solaris
components/perl_modules/dbd-mysql/DBD-mysql-PERLVER.p5m
components/perl_modules/dbd-mysql/DBD-mysql.license.template
components/perl_modules/dbd-mysql/Makefile
components/perl_modules/dbd-mysql/TESTING
components/perl_modules/dbd-mysql/patches/01_test05.patch
components/perl_modules/dbd-mysql/patches/02_int_min_max_test.patch
components/perl_modules/dbd-mysql/patches/03-Fix-transferring-MYSQL_TYPE_LONG-values-on-64-bit-bi.patch
components/perl_modules/dbd-mysql/test/results-all.master
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/DBD-mysql-PERLVER.p5m	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability volatile>
+set name=pkg.fmri \
+    value=pkg:/library/perl-5/dbd-mysql-$(PLV)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="Perl Mysql Database Interface"
+set name=pkg.description \
+    value="Mysql driver for the Perl5 Database Interface (DBI)"
+set name=pkg.human-version value=$(HUMAN_VERSION)
+set name=com.oracle.info.description value="DBD::mysql Perl module"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification \
+    value=org.opensolaris.category.2008:Development/Perl
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2016/072
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+
+
+#file path=usr/perl5/$(PERLVER)/lib/$(PERL_ARCH)/perllocal.pod
+file path=usr/perl5/$(PERLVER)/man/man3/Bundle::DBD::mysql.3
+file path=usr/perl5/$(PERLVER)/man/man3/DBD::README.3
+file path=usr/perl5/$(PERLVER)/man/man3/DBD::mysql.3
+file path=usr/perl5/$(PERLVER)/man/man3/DBD::mysql::INSTALL.3
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/Bundle/DBD/mysql.pm
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/DBD/README.pod
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/DBD/mysql.pm
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/DBD/mysql/GetInfo.pm
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/DBD/mysql/INSTALL.pod
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/auto/DBD/mysql/.packlist
+file path=usr/perl5/vendor_perl/$(PERLVER)/$(PERL_ARCH)/auto/DBD/mysql/mysql.so
+license DBD-mysql.license license=Artistic
+
+# force a dependency on the Perl runtime
+depend type=require fmri=__TBD pkg.debug.depend.file=perl \
+    pkg.debug.depend.path=usr/perl5/$(PERLVER)/bin
+
+# force a dependency on the DBI package
+depend type=require fmri=library/perl-5/database
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/DBD-mysql.license.template	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,54 @@
+Portions of this program use DBD-mysql COMPONENT_VERSION, the open source version is made available by CPAN under the terms of the below version of the Artistic License.  As such, Oracle is required to provide the following notices.  Note, however, that the Oracle program license that accompanied this program determines your right to use the Oracle program, including DBD-mysql, and the terms contained in the following notices do not change those rights.
+ 	
+Extensions to DBD-mysql have been made by Oracle to support current versions of Solaris and provide additional tools.  These changes are detailed in the 'patches' subdirectory.
+ 
+The current open source version of DBD-mysql can be downloaded at: https://github.com/perl5-dbi/DBD-mysql
+
+Oracle elects to license this file available under the Artistic License 1.0.  The Artistic License 1.0 is provided here.
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------
+The Artistic License v.1.0
+
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+•	"Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification.
+•	"Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder.
+•	"Copyright Holder" is whoever is named in the copyright or copyrights for the package.
+•	"You" is you, if you're thinking about copying or distributing this Package.
+•	"Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.)
+•	"Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:
+a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package.
+b) use the modified Package only within your corporation or organization.
+c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version.
+d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following:
+a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version.
+b) accompany the distribution with the machine-readable source of the Package with your modifications.
+c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version.
+d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/Makefile	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,180 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+# This variable has no impact on perl build, it is here merely to satisfy
+# "modernized" gate infrastructure. The bitness of the module is driven by the
+# bitness of perl interpreter itself. That is hardcoded in
+# $(WS_MAKE_RULES)/makemaker.mk
+BUILD_BITS = 64
+
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		DBD-mysql
+COMPONENT_VERSION=	4.033
+IPS_COMPONENT_VERSION=  4033
+HUMAN_VERSION=		$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE_HASH=	\
+	sha256:cc98bbcc33581fbc55b42ae681c6946b70a26f549b3c64466740dfe9a7eac91c
+COMPONENT_ARCHIVE_URL=	http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/$(COMPONENT_ARCHIVE)
+COMPONENT_PROJECT_URL=	https://github.com/perl5-dbi/DBD-mysql
+COMPONENT_BUGDB=	perl-mod/dbd-mysql
+
+TPNO=			25495
+
+BUILD_STYLE= makemaker
+LICENSE=DBD-mysql.license
+BUILD_TARGET= $(BUILD_$(MK_BITS)) $(LICENSE)
+include $(WS_MAKE_RULES)/common.mk
+
+CLEAN_PATHS += $(LICENSE)
+
+COMPONENT_TEST_TARGETS = test
+COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
+COMPONENT_TEST_TRANSFORMS += \
+	'-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \
+	'-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \
+	'-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \
+	'-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" '
+
+ASLR_MODE = $(ASLR_NOT_APPLICABLE)
+
+MYSQL_VERSION       = 5.6
+MYSQL_BINDIR        = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin
+MYSQL_TEST_USER     = root
+MYSQL_TEST_PASSWORD = new-password
+MYSQL_TEST_DATADIR  = $(COMPONENT_TEST_BUILD_DIR)/test_datadir
+
+COMPONENT_TEST_ENV  += MYSQL_HISTFILE=/dev/null
+
+CONFIGURE_OPTIONS += --mysql_config="$(MYSQL_BINDIR)/mysql_config"
+CONFIGURE_OPTIONS += --testuser=$(MYSQL_TEST_USER)
+CONFIGURE_OPTIONS += --testpassword=$(MYSQL_TEST_PASSWORD)
+CONFIGURE_OPTIONS += --testsocket=CHANGEME
+
+# !!!!!!!!! workaround for 22552923
+MYSQL_LIBS          = $(shell $(MYSQL_BINDIR)/mysql_config --libs)
+CONFIGURE_OPTIONS += --libs="$(MYSQL_LIBS) -lCrun"
+# !!!!!!!!! workaround for 22552923
+
+# For the testing we need to run mysql database first. The database needs it's
+# directory, which will be $(MYSQL_TEST_DATADIR). The directory will also
+# contain socket over which the testing will be performed. Problem is that the
+# path can be maximally 107 characters long. To overcome that limit, we'll
+# create a symlink in /tmp pointing to the directory and refer the database to
+# that symlink. The symlink must have random name, so that multiple tests may
+# be executed simultaneously. Problem is that we have to specify the symlink
+# name during configure. To overcome that I specify the socket name as
+# 'CHANGEME' and "fix" the tests once I know the name of symlink.
+
+# Second challenge is to make sure that the mysql daemon will be stopped once
+# the tests end (finish or are interrupted). There are three mechanisms to do
+# that.
+# a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid
+# b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the
+#    daemon in 10 minutes no matter what.
+# c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the
+#    background task
+
+# If you want to keep mysqld running for your own testing purposes, delete all
+# the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and
+# COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run
+# the DB and configure the module to use it. After that you can "cd builds/..."
+# and "gmake test" directly there.
+
+# Normally the noise from background jobs is sent to /dev/null so that it does
+# not clobber the terminal. For debugging you can leave SILENT empty which will
+# even turn on more output
+SILENT = >/dev/null 2>&1
+ifeq ($(strip $(SILENT)),)
+SET_X = set -x;
+MYSQLD_VERBOSE =
+else
+SET_X =
+MYSQLD_VERBOSE = --verbose
+endif
+
+COMPONENT_PRE_TEST_ACTION = ( \
+	$(SET_X) cd "$(@D)"; \
+	\
+	: "Prepare the testing directory and create the symlink to it"; \
+	$(RM) -r "$(MYSQL_TEST_DATADIR)"; \
+	mkdir "$(MYSQL_TEST_DATADIR)"; \
+	TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \
+	$(RM) "$$TEST_LINK"; \
+	ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \
+	echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \
+	\
+	: "alter the tests to use the path we just created"; \
+	$(PERL) -pi -e "s,CHANGEME,$$TEST_LINK/socket," t/mysql.mtest ;\
+	\
+	: "Initialize mysql DB"; \
+	"$(MYSQL_BINDIR)/mysql_install_db" \
+			--keep-my-cnf \
+			--datadir="$$TEST_LINK" \
+			--basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \
+	\
+	: "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \
+	"$(MYSQL_BINDIR)/mysqld" \
+			$(MYSQLD_VERBOSE) \
+			--skip-networking \
+			--datadir="$$TEST_LINK" \
+			--socket="$$TEST_LINK"/socket \
+			--pid-file="$$TEST_LINK"/pid \
+			--gdb \
+			--log-warnings=0 \
+			$(SILENT) & \
+	: "Now wait for the database to be online"; \
+	sleep 10; \
+	if [ ! -e "$$TEST_LINK/socket" ]; then \
+		: "We were not able to bring up the database?"; \
+		PID=`cat "$$TEST_LINK"/pid`; \
+		ps -p $$PID && kill $$PID || : \
+		$(RM) "$$TEST_LINK"; \
+		exit 1; \
+	fi; \
+	\
+	: "Set admin password"; \
+	"$(MYSQL_BINDIR)/mysqladmin" \
+			--socket "$$TEST_LINK"/socket \
+			-u "$(MYSQL_TEST_USER)" \
+			password "$(MYSQL_TEST_PASSWORD)" ; \
+	\
+	: "Run job which will kill mysqld in 10 minutes"; \
+	( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \
+	echo $$! > "$$TEST_LINK"/pid_of_guard; \
+)
+
+COMPONENT_POST_TEST_ACTION = ( \
+	( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
+	( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid_of_guard`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
+	( $(SET_X) if [ -e "$(MYSQL_TEST_DATADIR)/test_link" ]; then rm -f `cat "$(MYSQL_TEST_DATADIR)/test_link"`; fi ) $(SILENT); \
+)
+
+$(LICENSE): $(LICENSE).template
+	$(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "[email protected]"
+
+REQUIRED_PACKAGES += database/mysql-56/library
+REQUIRED_PACKAGES += library/perl-5/database
+REQUIRED_PACKAGES += system/library/c++-runtime
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/TESTING	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,131 @@
+================================================================================
+================================ Install mysql =================================
+================================================================================
+
+$ pkg install database/mysql-56 database/mysql-56/client
+
+
+
+================================================================================
+========================== Init database & run daemon ==========================
+================================================================================
+
+#!/bin/bash
+
+set -x
+
+MYSQL_TEST_DATADIR=/var/tmp/mysql
+MYSQL_VERSION=5.6
+MYSQL_BINDIR=/usr/mysql/$MYSQL_VERSION/bin
+MYSQL_TEST_USER=root
+MYSQL_TEST_PASSWORD=new-password
+
+rm -rf "$MYSQL_TEST_DATADIR"
+
+"$MYSQL_BINDIR/mysql_install_db" \
+        --keep-my-cnf \
+        --datadir="$MYSQL_TEST_DATADIR" \
+        --basedir=/usr/mysql/$MYSQL_VERSION
+
+# Run the daemon in background.
+#   --gdb makes it possible to terminate mysqld via Ctrl+C
+"$MYSQL_BINDIR/mysqld" \
+        --skip-networking \
+        -u $MYSQL_TEST_USER \
+        --datadir="$MYSQL_TEST_DATADIR" \
+        --socket="$MYSQL_TEST_DATADIR"/socket \
+        --pid-file="$MYSQL_TEST_DATADIR"/pid \
+        --gdb &
+
+sleep 10 # wait for db to come up
+
+"$MYSQL_BINDIR/mysqladmin" \
+        --socket "$MYSQL_TEST_DATADIR"/socket \
+        -u "$MYSQL_TEST_USER" \
+        password "$MYSQL_TEST_PASSWORD"
+
+
+
+================================================================================
+============ In perl craete DB, table, trigger and insert some data ============
+================================================================================
+
+#!/usr/perl5/5.22/bin/perl
+
+use DBI;
+
+my $dbname="perl_test_db";
+
+$dsn = "DBI:mysql:;mysql_socket=/var/tmp/mysql/socket;";
+$dbh = DBI->connect($dsn, 'root', 'new-password');
+
+# List all databases available
+say STDOUT join " : ", $dbh->func('_ListDBs');
+
+# Call mysql specific function
+bless ($dbh, "DBD::mysql::db");
+$dbh->admin('createdb', $dbname);
+
+# Connect again, this time directly to DB
+$dsn = "DBI:mysql:$dbname;mysql_socket=/var/tmp/mysql/socket;";
+$dbh = DBI->connect($dsn, 'root', 'new-password');
+
+eval { $dbh->do("DROP TABLE foo") };
+
+$dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20))");
+
+$dbh->do("
+CREATE TRIGGER only_even
+     BEFORE INSERT ON foo FOR EACH ROW
+     BEGIN
+          IF NEW.id % 2 = 1
+          THEN
+               SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Insert only odd numbers!';
+          ELSE
+               SET NEW.id = NEW.id * 5;
+          END IF;
+     END;
+");
+
+# First fails, it's odd number
+$dbh->do("INSERT INTO foo VALUES (1, " . $dbh->quote("Tim") . ")");
+$dbh->do("INSERT INTO foo VALUES (?, ?)", undef, 2, "Jochen");
+$dbh->do("INSERT INTO foo VALUES (4, " . $dbh->quote("Pete") . ")");
+
+my $sth = $dbh->prepare("SELECT * FROM foo");
+$sth->execute();
+while (my $ref = $sth->fetchrow_hashref()) {
+        print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}\n";
+}
+$sth->finish();
+
+$dbh->disconnect();
+
+
+
+================================================================================
+============================== Perl script output ==============================
+================================================================================
+
+information_schema : mysql : performance_schema : test
+DBD::mysql::db do failed: Insert only odd numbers! at ./a.pl line 39.
+Found a row: id = 10, name = Jochen
+Found a row: id = 20, name = Pete
+
+(please note that first line may vary, it just lists all currently available
+databases)
+
+
+
+================================================================================
+===================== Verify from shell the data are there =====================
+================================================================================
+
+$ echo 'select * from foo;' |
+	mysql --socket=/var/tmp/mysql/socket -u root --password=new-password perl_test_db
+
+Warning: Using a password on the command line interface can be insecure.
+id      name
+10      Jochen
+20      Pete
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/patches/01_test05.patch	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,38 @@
+https://rt.cpan.org/Public/Bug/Display.html?id=112072
+
+--- DBD-mysql-4.033/t/05dbcreate.t	2016-02-13 13:29:56.467130717 -0800
++++ DBD-mysql-4.033/t/05dbcreate.t	2016-02-13 13:23:45.371688976 -0800
[email protected]@ -10,7 +10,7 @@ use lib 't', '.';
+ require 'lib.pl';
+ 
+ my $dbh;
+-eval {$dbh= DBI->connect('DBI:mysql:', $test_user, $test_password,
++eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
+                       { RaiseError => 1, PrintError => 1, AutoCommit => 0 });};
+ if ([email protected]) {
+     diag [email protected];
+--- DBD-mysql-4.033/t/87async.t	2016-02-13 13:37:19.948093572 -0800
++++ DBD-mysql-4.033/t/87async.t	2016-02-13 13:36:58.066381499 -0800
[email protected]@ -1,7 +1,6 @@
+ use strict;
+ use warnings;
+ 
+-use Test::Deep;
+ use Test::More;
+ use DBI;
+ use DBI::Const::GetInfoType;
[email protected]@ -11,10 +10,10 @@ use vars qw($test_dsn $test_user $test_p
+ use lib 't', '.';
+ require 'lib.pl';
+ 
+-eval { use Test::Deep };
+-SKIP: {
+-    if ($!) {
+-        skip "Test::Deep is not installed!";
++BEGIN {
++    eval { require Test::Deep };
++    if ([email protected]) {
++            plan skip_all => 'Test::Deep is not installed!';
+     }
+ }
+ my $dbh;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/patches/02_int_min_max_test.patch	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,153 @@
+https://rt.cpan.org/Public/Bug/Display.html?id=57266
+
+--- DBD-mysql-4.033/t/41int_min_max.t	2016-03-02 17:52:49.620948225 +0100
++++ DBD-mysql-4.033/t/41int_min_max.t	2016-03-02 17:52:20.582073477 +0100
[email protected]@ -0,0 +1,148 @@
++use strict;
++use warnings;
++use bigint;
++
++use DBI;
++use Test::More;
++use lib 't', '.';
++use Data::Dumper;
++require 'lib.pl';
++use vars qw($test_dsn $test_user $test_password);
++
++my $dbh;
++eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
++                      { RaiseError => 1, PrintError => 1, AutoCommit => 1 });};
++if ([email protected]) {
++    plan skip_all => "no database connection";
++}
++
++if (!MinimumVersion($dbh, '4.1')) {
++    plan skip_all => "ERROR: $DBI::errstr. Can't continue test";
++    plan skip_all =>
++        "SKIP TEST: You must have MySQL version 4.1 and greater for this test to run";
++}
++# nostrict tests + strict tests + init/tear down commands
++plan tests => 19*8 + 17*8 + 4;
++
++my $table = 'dbd_mysql_t41minmax'; # name of the table we will be using
++my $mode; # 'strict' or 'nostrict' corresponds to strict SQL mode
++
++sub test_int_type ($$$$) {
++    my ($perl_type, $mysql_type, $min, $max) = @_;
++
++    # Disable the warning text clobbering our output
++    local $SIG{__WARN__} = sub { 1; };
++
++    # Create the table
++    ok($dbh->do(qq{DROP TABLE IF EXISTS $table}), "removing $table");
++    ok($dbh->do(qq{
++            CREATE TABLE `$table` (
++                `id` int not null auto_increment,
++                `val` $mysql_type,
++                primary key (id)
++            )
++    }), "creating minmax table for type $mysql_type");
++
++    my ($store, $retrieve); # statements
++    my $read_value;         # retrieved value
++    ok($store = $dbh->prepare("INSERT INTO $table (val) VALUES (?)"));
++    ok($retrieve = $dbh->prepare("SELECT val from $table where id=(SELECT MAX(id) FROM $table)"));
++
++    ########################################
++    # Insert allowed min value
++    ########################################
++    ok($store->bind_param( 1, $min->bstr(), $perl_type ), "binding minimal $mysql_type, mode=$mode");
++    ok($store->execute(), "inserting min data for type $mysql_type, mode=$mode");
++
++    ########################################
++    # Read it back and compare
++    ########################################
++    ok{$retrieve->execute()};
++    ($read_value) = $retrieve->fetchrow_array();
++    cmp_ok($read_value, 'eq', $min, "retrieved minimal value for $mysql_type, mode=$mode");
++
++    ########################################
++    # Insert allowed max value
++    ########################################
++    ok($store->bind_param( 1, $max->bstr(), $perl_type ), "binding maximal $mysql_type, mode=$mode");
++    ok($store->execute(), "inserting max data for type $mysql_type, mode=$mode");
++
++    ########################################
++    # Read it back and compare
++    ########################################
++    ok{$retrieve->execute()};
++    ($read_value) = $retrieve->fetchrow_array();
++    cmp_ok($read_value, 'eq', $max, "retrieved maximal value for $mysql_type, mode=$mode");
++
++    ########################################
++    # Try to insert under the limit value
++    ########################################
++    ok($store->bind_param( 1, ($min-1)->bstr(), $perl_type ), "binding less than minimal $mysql_type, mode=$mode");
++    if ($mode eq 'strict') {
++        [email protected] = '';
++        eval{$store->execute()};
++        like([email protected], qr/Out of range value for column 'val'/, "Error, you stored ".($min-1)." into $mysql_type, mode=$mode\n".
++            Data::Dumper->Dump([$dbh->selectall_arrayref("SELECT * FROM $table")]).
++            Data::Dumper->Dump([$dbh->selectall_arrayref("describe $table")])
++        );
++    } else {
++        ok{$store->execute()};
++        ########################################
++        # Check that it was rounded correctly
++        ########################################
++        ok{$retrieve->execute()};
++        ($read_value) = $retrieve->fetchrow_array();
++        cmp_ok($read_value, 'eq', $min, "retrieved minimal value for type $mysql_type, mode=$mode");
++    };
++
++    ########################################
++    # Try to insert over the limit value
++    ########################################
++    ok($store->bind_param( 1, ($max+1)->bstr(), $perl_type ), "binding more than maximal $mysql_type, mode=$mode");
++    if ($mode eq 'strict') {
++        [email protected] = '';
++        eval{$store->execute()};
++        like([email protected], qr/Out of range value for column 'val'/, "Error, you stored ".($max+1)." into $mysql_type, mode=$mode\n".
++            Data::Dumper->Dump([$dbh->selectall_arrayref("SELECT * FROM $table")]).
++            Data::Dumper->Dump([$dbh->selectall_arrayref("describe $table")])
++        );
++    } else {
++        ok{$store->execute()};
++        ########################################
++        # Check that it was rounded correctly
++        ########################################
++        ok{$retrieve->execute()};
++        ($read_value) = $retrieve->fetchrow_array();
++        cmp_ok($read_value, 'eq', $max, "retrieved maximal value for type $mysql_type, mode=$mode");
++    };
++}
++
++# Set strict SQL mode
++ok($dbh->do("SET SQL_MODE='STRICT_ALL_TABLES'"),"Enter strict SQL mode.");
++$mode = 'strict';
++
++test_int_type(DBI::SQL_TINYINT,  'tinyint signed',     -2**7,  2**7-1);
++test_int_type(DBI::SQL_TINYINT,  'tinyint unsigned',       0,  2**8-1);
++test_int_type(DBI::SQL_SMALLINT, 'smallint signed',   -2**15, 2**15-1);
++test_int_type(DBI::SQL_SMALLINT, 'smallint unsigned',      0, 2**16-1);
++test_int_type(DBI::SQL_INTEGER,  'int signed',        -2**31, 2**31-1);
++test_int_type(DBI::SQL_INTEGER,  'int unsigned',           0, 2**32-1);
++test_int_type(DBI::SQL_BIGINT,   'bigint signed',     -2**63, 2**63-1);
++test_int_type(DBI::SQL_BIGINT,   'bigint unsigned',        0, 2**64-1);
++
++# Do not use strict SQL mode
++ok($dbh->do("SET SQL_MODE=''"),"Leave strict SQL mode.");
++$mode = 'nostrict';
++
++test_int_type(DBI::SQL_TINYINT,  'tinyint signed',     -2**7,  2**7-1);
++test_int_type(DBI::SQL_TINYINT,  'tinyint unsigned',       0,  2**8-1);
++test_int_type(DBI::SQL_SMALLINT, 'smallint signed',   -2**15, 2**15-1);
++test_int_type(DBI::SQL_SMALLINT, 'smallint unsigned',      0, 2**16-1);
++test_int_type(DBI::SQL_INTEGER,  'int signed',        -2**31, 2**31-1);
++test_int_type(DBI::SQL_INTEGER,  'int unsigned',           0, 2**32-1);
++test_int_type(DBI::SQL_BIGINT,   'bigint signed',     -2**63, 2**63-1);
++test_int_type(DBI::SQL_BIGINT,   'bigint unsigned',        0, 2**64-1);
++
++ok ($dbh->do("DROP TABLE $table"));
++
++ok $dbh->disconnect;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/patches/03-Fix-transferring-MYSQL_TYPE_LONG-values-on-64-bit-bi.patch	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,119 @@
+From 95b210810301f0a5c87adc0d682bc8424dfb41d0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
+Date: Fri, 26 Feb 2016 13:32:31 +0100
+Subject: [PATCH] Fix transferring MYSQL_TYPE_LONG values on 64-bit big endian
+ systems
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+t/40server_prepare.t test failed on s390x platform. Server-prepared
+values of types int, smallint, and tinyint are passed to application
+as 32-bit integer. The same buffer was interpreted as long integer
+by DBD::MySQL. This caused missaligned read/write and bogus
+interpretation of the values.
+
+https://rt.cpan.org/Public/Bug/Display.html?id=57266
+https://bugzilla.redhat.com/show_bug.cgi?id=1311646
+http://dev.mysql.com/doc/refman/5.7/en/mysql-stmt-fetch.html
+Signed-off-by: Petr Písař <[email protected]>
+---
+ dbdimp.c | 20 +++++++++++++-------
+ dbdimp.h |  5 +++--
+ 2 files changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/dbdimp.c b/dbdimp.c
+index d507588..9a1be20 100644
+--- a/dbdimp.c
++++ b/dbdimp.c
[email protected]@ -18,6 +18,7 @@
+ #endif
+ 
+ #include "dbdimp.h"
++#include <inttypes.h> /* for PRId32 */
+ 
+ #if defined(WIN32)  &&  defined(WORD)
+ #undef WORD
[email protected]@ -3753,8 +3754,8 @@ int dbd_describe(SV* sth, imp_sth_t* imp_sth)
+ 
+       if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
+       {
+-        PerlIO_printf(DBIc_LOGPIO(imp_xxh),"\t\ti %d col_type %d fbh->length %d\n",
+-                      i, col_type, (int) fbh->length);
++        PerlIO_printf(DBIc_LOGPIO(imp_xxh),"\t\ti %d col_type %d fbh->length %lu\n",
++                      i, col_type, fbh->length);
+         PerlIO_printf(DBIc_LOGPIO(imp_xxh),
+                       "\t\tfields[i].length %lu fields[i].max_length %lu fields[i].type %d fields[i].charsetnr %d\n",
+                       (long unsigned int) fields[i].length, (long unsigned int) fields[i].max_length, fields[i].type,
[email protected]@ -4015,8 +4016,8 @@ process:
+ 
+         case MYSQL_TYPE_LONG:
+           if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
+-            PerlIO_printf(DBIc_LOGPIO(imp_xxh), "\t\tst_fetch int data %d, unsigned? %d\n",
+-                          (int) fbh->ldata, buffer->is_unsigned);
++            PerlIO_printf(DBIc_LOGPIO(imp_xxh), "\t\tst_fetch int data %"PRId32", unsigned? %d\n",
++                          fbh->ldata, buffer->is_unsigned);
+           if (buffer->is_unsigned)
+             sv_setuv(sv, fbh->ldata);
+           else
[email protected]@ -4787,6 +4788,7 @@ int dbd_bind_ph(SV *sth, imp_sth_t *imp_sth, SV *param, SV *value,
+   int buffer_is_null= 0;
+   int buffer_length= slen;
+   unsigned int buffer_type= 0;
++  IV tmp;
+ #endif
+ 
+   D_imp_dbh_from_sth;
[email protected]@ -4874,12 +4876,16 @@ int dbd_bind_ph(SV *sth, imp_sth_t *imp_sth, SV *param, SV *value,
+           if (!SvIOK(imp_sth->params[idx].value) && DBIc_TRACE_LEVEL(imp_xxh) >= 2)
+             PerlIO_printf(DBIc_LOGPIO(imp_xxh), "\t\tTRY TO BIND AN INT NUMBER\n");
+           buffer_length = sizeof imp_sth->fbind[idx].numeric_val.lval;
+-          imp_sth->fbind[idx].numeric_val.lval= SvIV(imp_sth->params[idx].value);
++
++          tmp = SvIV(imp_sth->params[idx].value);
++          if (tmp > INT32_MAX)
++	        croak("Could not bind %ld: Integer too large for MYSQL_TYPE_LONG", tmp);
++          imp_sth->fbind[idx].numeric_val.lval= tmp;
+           buffer=(void*)&(imp_sth->fbind[idx].numeric_val.lval);
+           if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
+             PerlIO_printf(DBIc_LOGPIO(imp_xxh),
+-                          "   SCALAR type %d ->%ld<- IS A INT NUMBER\n",
+-                          (int) sql_type, (long) (*buffer));
++                          "   SCALAR type %d ->%"PRId32"<- IS A INT NUMBER\n",
++                          (int) sql_type, *(int32_t *)buffer);
+           break;
+ 
+         case MYSQL_TYPE_DOUBLE:
+diff --git a/dbdimp.h b/dbdimp.h
+index 8723bcc..1ef5d72 100644
+--- a/dbdimp.h
++++ b/dbdimp.h
[email protected]@ -22,6 +22,7 @@
+ #include <mysqld_error.h>  /* Comes MySQL */
+ 
+ #include <errmsg.h> /* Comes with MySQL-devel */
++#include <stdint.h> /* For int32_t */
+ 
+ /* For now, we hardcode this, but in the future,
+  * we can detect capabilities of the MySQL libraries
[email protected]@ -212,7 +213,7 @@ typedef struct imp_sth_ph_st {
+ typedef struct imp_sth_phb_st {
+     union
+     {
+-      long lval;
++      int32_t lval;
+       double dval;
+     } numeric_val;
+     unsigned long   length;
[email protected]@ -233,7 +234,7 @@ typedef struct imp_sth_fbh_st {
+     char           *data;
+     int            charsetnr;
+     double         ddata;
+-    long           ldata;
++    int32_t        ldata;
+ #if MYSQL_VERSION_ID < FIELD_CHARSETNR_VERSION 
+     unsigned int   flags;
+ #endif
+-- 
+2.5.0
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/perl_modules/dbd-mysql/test/results-all.master	Tue Apr 26 12:09:07 2016 +0200
@@ -0,0 +1,79 @@
+make[1]: Entering directory '$(@D)'
+PERL_DL_NONLAZY=1 "$(PERL)" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
+# Driver version is <REMOVED>
+t/00base.t ........................... ok
+t/05dbcreate.t ....................... ok
+# mysql_clientinfo is: <REMOVED>
+# mysql_clientversion is: <REMOVED>
+# mysql_serverversion is: <REMOVED>
+# mysql_hostinfo is: <REMOVED>
+# mysql_serverinfo is: <REMOVED>
+# mysql_stat is: <REMOVED>
+# mysql_protoinfo is: <REMOVED>
+# SQL_DBMS_VER is <REMOVED>
+# Default storage engine is: InnoDB
+t/10connect.t ........................ ok
+t/15reconnect.t ...................... ok
+t/20createdrop.t ..................... ok
+t/25lockunlock.t ..................... ok
+t/29warnings.t ....................... ok
+t/30insertfetch.t .................... ok
+t/31insertid.t ....................... ok
+t/32insert_error.t ................... ok
+t/35limit.t .......................... ok
+t/35prepare.t ........................ ok
+t/40bindparam.t ...................... ok
+t/40bindparam2.t ..................... ok
+t/40bit.t ............................ ok
+t/40blobs.t .......................... ok
+t/40catalog.t ........................ ok
+t/40keyinfo.t ........................ ok
+t/40listfields.t ..................... ok
+t/40nulls.t .......................... ok
+t/40nulls_prepare.t .................. ok
+t/40numrows.t ........................ ok
+t/40server_prepare.t ................. ok
+t/40server_prepare_error.t ........... ok
+t/40types.t .......................... ok
+t/41bindparam.t ...................... ok
+t/41blobs_prepare.t .................. ok
+t/41int_min_max.t .................... ok
+t/42bindparam.t ...................... ok
+t/43count_params.t ................... ok
+t/50chopblanks.t ..................... ok
+t/50commit.t ......................... ok
+t/51bind_type_guessing.t ............. ok
+t/52comment.t ........................ ok
+t/53comment.t ........................ ok
+t/55utf8.t ........................... ok
+t/60leaks.t .......................... skipped: Skip $ENV{EXTENDED_TESTING} is not set
+t/65segfault.t ....................... ok
+t/65types.t .......................... ok
+t/70takeimp.t ........................ ok
+t/71impdata.t ........................ ok
+t/75supported_sql.t .................. ok
+t/76multi_statement.t ................ ok
+t/80procs.t .......................... ok
+t/81procs.t .......................... ok
+t/85init_command.t ................... ok
+t/86_bug_36972.t ..................... ok
+t/87async.t .......................... skipped: Test::Deep is not installed!
+t/88async-multi-stmts.t .............. ok
+t/89async-method-check.t ............. ok
+t/90no-async.t ....................... skipped: Async support was built into this version of DBD::mysql
+t/91errcheck.t ....................... ok
+t/99_bug_server_prepare_blob_null.t .. ok
+t/manifest.t ......................... skipped: these tests are for release testing
+t/pod.t .............................. skipped: Test::Pod 1.00 required for testing POD
+t/rt25389-bin-case.t ................. ok
+t/rt50304-column_info_parentheses.t .. ok
+t/rt83494-quotes-comments.t .......... ok
+t/rt85919-fetch-lost-connection.t .... ok
+t/rt86153-reconnect-fail-memory.t .... skipped: $ENV{EXTENDED_TESTING} is not set
+t/rt88006-bit-prepare.t .............. ok
+t/rt91715.t .......................... ok
+t/version.t .......................... ok
+All tests successful.
+Files=63, Tests=1615, <TIMINGS REMOVED>
+Result: PASS
+make[1]: Leaving directory '$(@D)'