merge revision 1154 to add templates for tests to tip.
--- a/common/build.postbuild.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/common/build.postbuild.xml Tue Jul 20 23:33:58 2010 +0100
@@ -742,6 +742,26 @@
<arg value="-f"/>
<arg value="${build.log.dir}/linksForDiamonds.xml"/>
</exec>
+
+ <echo message="report	Summary,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/summary/_brag.xml,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="report	Raptor Build Summary,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/html/index.html,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="report	Build BOM,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/build_BOM.zip,file${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="report	Build Logs,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/build_logs.zip,file${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <if><and><equals arg1="${sf.spec.smoketest.enable}" arg2="true"/><equals arg1="${sf.spec.ats.version}" arg2="ats3"/></and><then>
+ <echo message="report	Smoke Test Report,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/ats_reports/ATS3Report.html,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </then></if>
+ <if><and><equals arg1="${sf.spec.smoketest.enable}" arg2="true"/><equals arg1="${sf.spec.ats.version}" arg2="ats4"/></and><then>
+ <echo message="report	Smoke Test Report,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/ats_reports/simplelogger/testreport.xml,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </then></if>
+ <if><and><equals arg1="${sf.spec.bccheck.enable}" arg2="true"/><equals arg1="${sf.spec.bccheck.enable.ha}" arg2="true"/></and><then>
+ <echo message="report	Binary Compatibility Report (Headerfiles),http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/BC/headers_report.xml,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </then></if>
+ <if><and><equals arg1="${sf.spec.bccheck.enable}" arg2="true"/><equals arg1="${sf.spec.bccheck.enable.la}" arg2="true"/></and><then>
+ <echo message="report	Binary Compatibility Report (Libraries),http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/BC/libraries_report.xml,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </then></if>
+ <if><equals arg1="${sf.spec.bccheck.enable.dynamic}" arg2="true"/><then>
+ <echo message="report	Dynamic BC Test Reports,http://cdn.symbian.org/SF_builds/${sf.spec.job.name}/builds/${sf.spec.job.codeline}/${build.id}/ats_reports/index.html,report${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </then></if>
</target>
<target name="sf-merge-brag">
@@ -762,7 +782,7 @@
<arg value="-XSL"/>
<arg value="${sf.common.config.dir}/tools/brag/bragForDiamonds.xsl"/>
<arg value="-OUT"/>
- <arg value="${temp.build.dir}/bragForDiamonds.xml"/>
+ <arg value="${build.log.dir}/diamonds-status.xml"/>
</java>
<if>
<istrue value="${sf.spec.publish.enable}"/>
@@ -789,7 +809,7 @@
<arg value="-u"/>
<arg value="http://${diamonds.host}${diamonds.build.id}"/>
<arg value="-f"/>
- <arg value="${temp.build.dir}/bragForDiamonds.xml"/>
+ <arg value="${build.log.dir}/diamonds-status.xml"/>
</exec>
</then>
<else>
@@ -804,7 +824,7 @@
<available property="sf-utilities-available" file="${build.drive}/utilities" type="dir"/>
</target>
- <target name="sf-compare-to-baseline" depends="sf-diamondize-bom,sf-check-utilities-dir" if="sf-utilities-available">
+ <target name="sf-compare-to-baseline" depends="sf-check-utilities-dir" if="sf-utilities-available">
<property name="sf.releasenotes.wiki.txt" value="${build.log.dir}/releaseNotes.wiki.txt"/>
<delete file="${sf.releasenotes.wiki.txt}"/>
<!-- FCL Usage and Changesets -->
@@ -922,23 +942,7 @@
<!-- TODO: Make this work for package builds once we have sysmodel story worked out -->
<target name="sf-run-analysis-missing-files" if="sf.spec.checkbuild">
- <!-- splitbuild is only set for Platform builds -->
- <if><istrue value="${sf.spec.splitbuild}"/>
- <then>
- <if><istrue value="${sf.spec.os.skipbuild}" />
- <then><echo message="Skipping OS file check"/></then>
- <else><runtarget target="sf-check-missing-os-files"/></else>
- </if>
-
- <if><istrue value="${sf.spec.s60.skipbuild}" />
- <then><echo message="Skipping S60 file check"/></then>
- <else><runtarget target="sf-check-missing-s60-files"/></else>
- </if>
- </then>
- <else>
- <runtarget target="sf-check-missing-os-files"/>
- </else>
- </if>
+ <runtarget target="sf-check-missing-os-files"/>
</target>
<target name="sf-check-missing-os-files" depends="sf-compile-options">
@@ -954,7 +958,6 @@
<antcall target="compile-main" inheritAll="false" inheritRefs="true">
<param name="build.system" value="${sf.spec.build.system}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<param name="build.id" value ="sbs_check"/>
<reference refid="sbs.check.tools.var" torefid="sbs.var" />
<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
@@ -973,7 +976,6 @@
<antcall target="compile-main" inheritAll="false" inheritRefs="true">
<param name="build.system" value="${sf.spec.build.system}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<param name="build.id" value ="sbs_check"/>
<reference refid="sbs.check.iterate.main.var" torefid="sbs.var" />
<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
@@ -986,7 +988,6 @@
<antcall target="compile-main" inheritAll="false" inheritRefs="true">
<param name="build.system" value="${sf.spec.build.system}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<param name="build.id" value ="sbs_check"/>
<reference refid="sbs.check.main.var" torefid="sbs.var" />
<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
@@ -996,38 +997,6 @@
</if>
</target>
- <target name="sf-check-missing-s60-files" depends="sf-compile-options">
-
- <hlm:argSet id="sbs.check.tools.var">
- <hlm:arg name="config" value="${sf.spec.sbs.tools.config}" />
- <hlm:arg name="run-check" value="true" />
- </hlm:argSet>
-
- <hlm:argSet id="sbs.check.main.var">
- <hlm:arg name="config" value="${sf.spec.sbs.config}" />
- <hlm:arg name="run-check" value="true" />
- </hlm:argSet>
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
- <param name="build.id" value ="sbs_check"/>
- <reference refid="sbs.check.tools.var" torefid="sbs.var" />
- <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
- <param name="build.id" value ="sbs_check"/>
- <reference refid="sbs.check.main.var" torefid="sbs.var" />
- <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
-
- </target>
-
<target name="sf-create-public-PDK" depends="sf-prebuild,sf-run-sfl-licence-munging" >
<if>
<istrue value="${sf.spec.md5.enable}"/>
@@ -1117,6 +1086,9 @@
</filterchain>
</loadfile>
<echo message="BRAG STATUS: [${sf.brag.status}] - full build details available at ${build.drive}\output\logs\summary\_BRAG.xml"/>
+
+ <!-- record brag information in BIT file -->
+ <echo message="build_brag	${sf.brag.status}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
</target>
</project>
--- a/common/build.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/common/build.xml Tue Jul 20 23:33:58 2010 +0100
@@ -279,7 +279,7 @@
</then>
</if>
<!-- Delete build directory -->
- <delete dir="${prep.build.dir}"/>
+ <delete dir="${prep.build.dir}" failonerror="false" deleteonexit="true"/>
</target>
<target name="sf-prebuild" depends="sf-prep,sf-prebuild-noprep"/>
@@ -290,6 +290,10 @@
<target name="sf-prebuild-announce">
<stopwatch name="sf-prebuild"/>
<echo>[SF-PREBUILD]</echo>
+ <tstamp>
+ <format property="sf.build.starttime" pattern="yyyy-MM-dd HH:mm:ss" locale="en,UK"/>
+ </tstamp>
+ <echo message="started	${sf.build.starttime}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
</target>
<target name="sf-diamonds-connect">
@@ -302,6 +306,13 @@
<echo message="diamonds.build.id=${diamonds.build.id}" file="${build.log.dir}/diamonds_build_id.properties"/>
</then>
</if>
+
+ <!-- Supply build-start info in a BIT file -->
+ <echo message="build_id_string	${sf.spec.job.name}_${sf.spec.job.codeline}.${sf.spec.job.number}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="package	${sf.spec.job.name}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="platform	${sf.spec.job.codeline}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="creator	${env.USERNAME}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <echo message="machine	${env.COMPUTERNAME}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
</target>
<target name="sf-diamonds-envinfo">
@@ -334,6 +345,12 @@
</exec>
</then>
</if>
+ <!-- Supply labels info to the BIT file -->
+ <for list="${sf.spec.publish.diamonds.tag}" param="label">
+ <sequential>
+ <echo message="label	@{label}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ </sequential>
+ </for>
</target>
<target name="sf-record-proj-conf-bom">
@@ -351,6 +368,8 @@
<arg value="-i"/>
</exec>
<echo message="${sf.job.bom.config.repo},sf-config,${sf.job.bom.config.checksum}" file="${build.drive}/output/logs/BOM/config.csv"/>
+ <!-- Record revision of config repository into BIT file -->
+ <echo message="content	config,${sf.job.bom.config.repo},${sf.job.bom.config.checksum}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
<exec executable="hg" dir="${sf.project.location}" outputproperty="sf.job.bom.project.repo">
<arg value="showconfig"/>
@@ -362,6 +381,8 @@
<arg value="-i"/>
</exec>
<echo message="${sf.job.bom.project.repo},build/config,${sf.job.bom.project.checksum}" file="${build.drive}/output/logs/BOM/project.csv"/>
+ <!-- Record revision of project repository into BIT file -->
+ <echo message="content	project,${sf.job.bom.project.repo},${sf.job.bom.project.checksum}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
</target>
<target name="sf-get-utils">
@@ -374,6 +395,12 @@
<arg value="http://developer.symbian.org/oss/MCL/sftools/fbf/utilities"/>
<arg value="${build.drive}/utilities"/>
</exec>
+ <exec executable="hg" dir="${build.drive}/utilities" outputproperty="sf.job.bom.utilities.checksum">
+ <arg value="identify"/>
+ <arg value="-i"/>
+ </exec>
+ <!-- Record revision of utilities repository into BIT file -->
+ <echo message="content	utilities,http://developer.symbian.org/oss/MCL/sftools/fbf/utilities,${sf.job.bom.utilities.checksum}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
<stopwatch name="sf-get-utils" action="elapsed"/>
</target>
@@ -389,8 +416,9 @@
<then>
<stopwatch name="sf-getenvs (tools)"/>
- <!-- record toolsbaseline information in BOM file -->
+ <!-- record toolsbaseline information in BOM file and in BIT file -->
<echo message="${sf.spec.toolsbaseline.location}" file="${build.drive}/output/logs/BOM/toolsbaseline.txt"/>
+ <echo message="baseline	toolsbaseline${sf.spec.toolsbaseline.location}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
<!-- wrapper around preparation-getenv but with diff params -->
<runtarget target="sf-getenv-tools"/>
@@ -409,8 +437,11 @@
<istrue value="${sf.spec.baseline.enable}" />
<then>
<stopwatch name="sf-getenvs (baseline)"/>
- <!-- record baseline information in BOM file -->
+ <!-- record baseline information in BOM file and in BIT file -->
<echo message="${sf.spec.baseline.location}" file="${build.drive}/output/logs/BOM/baseline.txt"/>
+ <echo message="baseline	baseline,${sf.spec.baseline.location}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
+ <propertyregex property="sf.baseline.version" override="true" input="${sf.spec.baseline.location}" regexp=".*\\(.*)" select="\1" global="true" casesensitive="false"/>
+ <echo message="baseline_short	${sf.baseline.version}${line.separator}" file="${build.log.dir}/bitinfo.txt" append="true"/>
<!-- run internal target preparation-getenv -->
<delete file="${build.drive}/currentRelease.xml"/>
@@ -790,13 +821,14 @@
<!-- Unpack the rnd zips ready to be used in the build -->
<target name="sf-unpack-rnd">
<echo message="INFO Unpacking any available RnD binaries"/>
+ <mkdir dir="${build.drive}/output/zips/"/>
<for param="rndZip">
<fileset dir="${build.drive}/output/zips/">
<include name="binaries_*.zip"/> <!-- Internal rnd bins -->
<include name="release/bin_*.zip"/> <!-- Releaseable rnd bins -->
</fileset>
<sequential>
- <exec executable="7za" dir="${build.drive}" output="${build.log.dir}/unzip_${build.id}_binaries_rnd.log" append="true">
+ <exec executable="7za" dir="${build.drive}" output="${build.log.dir}/unzip_${build.id}_binaries_rnd.log" append="true" failonerror="false">
<arg value="x"/>
<arg value="-y"/> <!-- Need to unpack in overwrite mode, due to TEF -->
<arg value="-i!epoc32\*"/> <!-- Only unzip items into the epoc32 tree -->
--- a/common/templates/run-qmake.ant.xml.ftl Thu Jul 08 18:13:52 2010 +0100
+++ b/common/templates/run-qmake.ant.xml.ftl Tue Jul 20 23:33:58 2010 +0100
@@ -58,15 +58,15 @@
<if>
<available file="${r'$'}{build.drive}/${unit.@bldFile}" type="dir"/>
<then>
- <exec executable="cmd" dir="${r'$'}{build.drive}/${unit.@bldFile}" failonerror="false">
+ <exec executable="cmd" dir="${r'$'}{build.drive}/${unit.@bldFile}" failonerror="false" output="${r'$'}{build.drive}/output/logs/${ant['build.id']}_compile_hb_configure.log">
<arg value="/C"/>
<arg value="python"/>
- <arg line ="configure.py --qmake-bin=\epoc32\tools\qmake.bat --qmake-spec=symbian-sbsv2 --platform=symbian --qmake-options=MMP_RULES+=EXPORTUNFROZEN CONFIG+=sgimagelite_support DEFINES+=HB_EFFECTS_OPENVG DEFINES+=HB_FILTER_EFFECTS"/>
+ <arg line ="configure.py --qmake-spec=symbian-sbsv2 --platform=symbian --qmake-options=MMP_RULES+=EXPORTUNFROZEN CONFIG+=sgimagelite_support DEFINES+=HB_EFFECTS_OPENVG DEFINES+=HB_FILTER_EFFECTS"/>
</exec>
<echo>INFO: Exporting Orbit mkspecs to epoc32\tools for ${unit.@bldFile}/${unit.@proFile}</echo>
<echo>INFO: Running Orbit theme installer, make install step</echo>
- <exec executable="cmd" dir="${r'$'}{build.drive}/${unit.@bldFile}" failonerror="false">
+ <exec executable="cmd" dir="${r'$'}{build.drive}/${unit.@bldFile}" failonerror="false" output="${r'$'}{build.drive}/output/logs/${ant['build.id']}_install_hb_configure.log">
<arg value="/C"/>
<arg value="make install"/>
</exec>
--- a/common/templates/source-spec.ant.xml.ftl Thu Jul 08 18:13:52 2010 +0100
+++ b/common/templates/source-spec.ant.xml.ftl Tue Jul 20 23:33:58 2010 +0100
@@ -184,8 +184,9 @@
</target>
<target name="sf-bom-info-${count}">
- <!-- record info on source code repo/rev in BOM file -->
+ <!-- record info on source code repo/rev in BOM file and in BIT file -->
<echo file="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true" message="${dollar}{sources.${count}.URL},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}${dollar}{line.separator}"/>
+ <echo message="content	sources,${dollar}{sources.${count}.URL},${dollar}{sf.sourcesync.${count}.checksum}
" file="${ant['build.log.dir']}/bitinfo.txt" append="true"/>
</target>
<target name="sf-bom-change-info-${count}">
--- a/common/tools/BuildEnv.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/common/tools/BuildEnv.xml Tue Jul 20 23:33:58 2010 +0100
@@ -32,10 +32,9 @@
<context id="Common">
<tool name="Perl">
<location strict="false" value="C:\apps\perl\bin\perl.exe"/>
- <verify version="5.6.1" showstopper="true" >
- <check name="version" execute="%location% -v" values="v5\.6\.1" locator="This is perl, (.*) built"/>
- <check name="build" execute="%location% -v" values="build 633|build 635|build 638" locator="Binary (.*) provided by ActiveState" log="true"/>
- <check name="module SAX version" execute="ppm query sax" values="0\.15" locator="XML-SAX \[(.*)\] Simple API" />
+ <verify version="5.10.1" showstopper="true" >
+ <check name="version" execute="%location% -v" values="v5\.10\.1" locator="This is perl, (.*) built"/>
+ <check name="build" execute="%location% -v" values="build *" locator="Binary (.*) provided by ActiveState" log="true"/>
</verify>
</tool>
<tool name="Mercurial">
@@ -46,8 +45,8 @@
</tool>
<tool name="Python">
<location strict="false" value="c:\apps\python25\python.exe"/>
- <verify version="2.5" showstopper="false">
- <check name="version" execute="%location% -V" values="2\.5\.[0-9]" locator="Python (.*)"/>
+ <verify version="2.5 or 2.6]" showstopper="false">
+ <check name="version" execute="%location% -V" values="2\.[5-6]\.[0-9]" locator="Python (.*)"/>
</verify>
</tool>
<tool name="Java Compiler">
@@ -79,8 +78,8 @@
</tool>
<tool name="Raptor">
<location strict="false" value="C:\apps\raptor2.7.2\bin\sbs.bat"/>
- <verify version="2.9.*" showstopper="true">
- <check name="version" execute="%SBS_HOME%\bin\sbs.bat -version" values="2\.9\.\d" locator="sbs version (.*) \["/>
+ <verify version="2.12.* or 2.14.*" showstopper="true">
+ <check name="version" execute="%SBS_HOME%\bin\sbs.bat -version" values="2\.1[2|4]\.\d" locator="sbs version (.*) \["/>
</verify>
</tool>
</context>
--- a/common/tools/ats/hlm_prep_package.pl Thu Jul 08 18:13:52 2010 +0100
+++ b/common/tools/ats/hlm_prep_package.pl Tue Jul 20 23:33:58 2010 +0100
@@ -41,17 +41,28 @@
tie (@lines, 'Tie::File', $file, recsep => "\n") or die ("Cannot tie file \"$file\". $!\n");
$n = 0;
$file_fixed = 0;
+ print @lines[49] . "\n";
foreach (@lines) {
if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\urel\\/) {
@lines[$n] = lc(@lines[$n]);
@lines[$n] =~ s/\\armv5\\urel\\/\\\$(platform)\\\$(target)\\/;
$file_fixed = 1;
}
+ if (lc(@lines[$n]) =~ m/epoc32\/release\/armv5\/urel\//) {
+ @lines[$n] = lc(@lines[$n]);
+ @lines[$n] =~ s/\/armv5\/urel\//\/\$(platform)\/\$(target)\//;
+ $file_fixed = 1;
+ }
if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\udeb\\/) {
@lines[$n] = lc(@lines[$n]);
@lines[$n] =~ s/\\armv5\\udeb\\/\\\$(platform)\\\$(target)\\/;
$file_fixed = 1;
}
+# if (lc(@lines[$n]) =~ m/e:\\/) { # Replace e: with c:
+# @lines[$n] = lc(@lines[$n]);
+# @lines[$n] =~ s/e:\\/c:\\/;
+# $file_fixed = 1;
+# }
$n++;
}
if ($file_fixed) { print $file . " fixed.\n"; }
@@ -61,7 +72,7 @@
find(\&Parse_ini, $package_path);
foreach $file (@ini_files) {
- if ($file =~ m/\/init\//) { # Only operate on files from /init/ directories
+ if ((lc($file) =~ m/\/init\//) || (lc($file) =~ m/\/group\//)) { # Only operate on files from /init/ directories
copy($file,$file . ".orig") or die ("Cannot copy file \"$file\". $!\n");
tie (@lines, 'Tie::File', $file, recsep => "\n") or die ("Cannot tie file \"$file\". $!\n");
$n = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/bitops.pl Tue Jul 20 23:33:58 2010 +0100
@@ -0,0 +1,561 @@
+use strict;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Date::Calc qw{Delta_DHMS This_Year};
+use DBI;
+
+use Getopt::Long;
+
+my $help = 0;
+my $create = 0;
+my $id = '';
+my $file = '';
+my $verbose = 0;
+my $dryrun = 0;
+GetOptions((
+ 'create!' => \$create,
+ 'file=s' => \$file,
+ 'id=s' => \$id,
+ 'help!' => \$help,
+ 'verbose!' => \$verbose,
+ 'dryrun!' => \$dryrun,
+));
+
+if ($help||!$file)
+{
+ print <<_EOH;
+bitops
+Executes operations on the BIT db
+
+Usage: bitops.pl [-c|-i ID] -f FILE
+
+Options:
+ -h, --help Show this help message and exit
+ -c, --create Create entry for a new build then set the attributes to
+ the values provided in FILE. Returns the build id for
+ the newly created build.
+ -i ID, --id ID Update entry for build number ID with the values
+ provided in FILE.
+ -f FILE, --file FILE Use attributes in FILE to create/update the build info
+ See below for file format.
+ -v, --verbose Increase info level
+ -d, --dryrun Only show what would happen, do not actually interact
+ with the DB
+
+File format:
+ File must be a list of attribute-value-pairs. One avp per line, on each line
+ attribute and value are separated by a tab.
+ These are the supported attributes (in brackets the syntax of the value):
+ - build_id_string
+ - package (VALUE)
+ - platform (VALUE)
+ - started (VALUE)
+ - finished (VALUE)
+ - creator (VALUE)
+ - machine (VALUE)
+ - build_brag (VALUE)
+ - test_brag (VALUE)
+ - baseline_short (VALUE)
+ - sources_short (VALUE)
+ - envinfo (TOOL,VERSION)
+ - failure (CATEGORY,COUNT)
+ - report (NAME,URL,TYPE)
+ - content (NAME,URL,REVISION)
+ - baseline (TYPE,PATH)
+ - label (VALUE)
+_EOH
+ exit(0);
+}
+
+my $db = undef;
+
+my $builds_entry = {};
+my $envinfo = [];
+my $failures = [];
+my $reports = [];
+my $content = [];
+my $baselines = [];
+my $labels = [];
+my $testing_entry = {};
+
+sub ConnectToDB()
+{
+ $db = DBI->connect('DBI:mysql:bit:v800016:3306','fbf','mysql')
+ or die("Couldn't connect to database: " . DBI->errstr()) if (!$dryrun);
+}
+
+sub DisconnectFromDB()
+{
+ $db->disconnect() if (!$dryrun);
+}
+
+sub parse_file
+{
+ my ($file) = @_;
+
+ print "Reading $file...\n" if ($verbose);
+
+ open(FILE, $file) or die "Can't open file $file";
+
+ while (<FILE>)
+ {
+ my $line = $_;
+ chomp $line;
+ $line =~ s/^\s//g;
+ $line =~ s/\s$//g;
+ next if ($line !~ /[^\s]/);
+
+ if ($line =~ /([^\t]+)\t([^\t]+)/)
+ {
+ my $attr = $1;
+ my $value = $2;
+
+ if ($attr =~ /^(build_id_string|package|platform|started|finished|creator|machine|build_brag|test_brag|baseline_short|sources_short)$/i)
+ {
+ $attr = lc($attr);
+ print " found ($attr,$value) for table 'build'\n" if ($verbose);
+ $builds_entry->{$attr}=$value;
+ }
+ elsif ($attr =~ /^(envinfo)$/i)
+ {
+ $attr = lc($attr);
+ if ($value =~ /([^,]*),([^,]*)/)
+ {
+ my $tool = $1;
+ my $version = $2;
+
+ if (!$tool || !$version)
+ {
+ print "ERROR: Tool or version empty: \"$value\"\n";
+ return 1;
+ }
+ print " found ($tool,$version) for table 'envinfo'\n" if ($verbose);
+ push(@{$envinfo}, {tool=>$tool, version=>$version});
+ }
+ else
+ {
+ print "ERROR: Could not understand value of envinfo: \"$value\"\n";
+ return 1;
+ }
+ }
+ elsif ($attr =~ /^(failure)$/i)
+ {
+ $attr = lc($attr);
+ if ($value =~ /([^,]*),([^,]*)/)
+ {
+ my $category = $1;
+ my $count = $2;
+
+ if (!$category || !defined $count || $count eq '')
+ {
+ print "ERROR: Category or count empty: \"$value\"\n";
+ return 1;
+ }
+ print " found ($category,$count) for table 'failures'\n" if ($verbose);
+ push(@{$failures}, {category=>$category, count=>$count});
+ }
+ else
+ {
+ print "ERROR: Could not understand value of failure: \"$value\"\n";
+ return 1;
+ }
+ }
+ elsif ($attr =~ /^(report)$/i)
+ {
+ $attr = lc($attr);
+ if ($value =~ /([^,]*),([^,]*),([^,]*)/)
+ {
+ my $name = $1;
+ my $url = $2;
+ my $type = $3;
+
+ if (!$name || !$url || !$type)
+ {
+ print "ERROR: Name, url or type empty: \"$value\"\n";
+ return 1;
+ }
+ print " found ($name,$url,$type) for table 'reports'\n" if ($verbose);
+ push(@{$reports}, {name=>$name, url=>$url, type=>$type});
+ }
+ else
+ {
+ print "ERROR: Could not understand value of report: \"$value\"\n";
+ return 1;
+ }
+ }
+ elsif ($attr =~ /^(content)$/i)
+ {
+ $attr = lc($attr);
+ if ($value =~ /([^,]*),([^,]*),([^,]*)/)
+ {
+ my $name = $1;
+ my $url = $2;
+ my $revision = $3;
+
+ if (!$name || !$url || !$revision)
+ {
+ print "ERROR: Name, url or revision empty: \"$value\"\n";
+ return 1;
+ }
+ print " found ($name,$url,$revision) for table 'content'\n" if ($verbose);
+ push(@{$content}, {name=>$name, url=>$url, revision=>$revision});
+ }
+ else
+ {
+ print "ERROR: Could not understand value of content: \"$value\"\n";
+ return 1;
+ }
+ }
+ elsif ($attr =~ /^(baseline)$/i)
+ {
+ $attr = lc($attr);
+ if ($value =~ /([^,]*),([^,]*)/)
+ {
+ my $type = $1;
+ my $path = $2;
+
+ if (!$type || !$path)
+ {
+ print "ERROR: Type or path empty: \"$value\"\n";
+ return 1;
+ }
+ print " found ($type,$path) for table 'baselines'\n" if ($verbose);
+ push(@{$baselines}, {type=>$type, path=>$path});
+ }
+ else
+ {
+ print "ERROR: Could not understand value of baseline: \"$value\"\n";
+ return 1;
+ }
+ }
+ elsif ($attr =~ /^(label)$/i)
+ {
+ print " found ($attr,$value) for table 'labels'\n" if ($verbose);
+ push(@{$labels}, {label=>$value});
+ }
+ else
+ {
+ print "ERROR: Could not understand avp: \"$line\"\n";
+ return 1;
+ }
+
+ }
+ else
+ {
+ print "WARNING: line \"$line\" does not seem a correctly formed attribute-value-pair (tab-separated)\n";
+ return 1;
+ }
+ }
+
+ close(FILE);
+ return 0;
+}
+
+# MAIN PROGRAM
+
+my $r=parse_file($file);
+if ($r)
+{
+ print "Error while parsing file $file\n";
+ exit(1);
+}
+
+print "Executing SQL commands...\n" if ($verbose);
+
+ConnectToDB();
+my $newbuildid = -1;
+if ($create)
+{
+ if (keys %{$builds_entry})
+ {
+ my $field_list = '';
+ my $qm_list = '';
+ my @fields = ();
+ for my $field (keys %{$builds_entry})
+ {
+ $field_list .= "$field,";
+ $qm_list .= "?,";
+ push(@fields,$builds_entry->{$field});
+ }
+ $field_list =~ s/,$//;
+ $qm_list =~ s/,$//;
+
+ my $query = $db->prepare("insert into builds ($field_list) values ($qm_list)")
+ or die("Couldn't prepare query insert into builds: " . $db->errstr()) if (!$dryrun);
+
+ $query->execute(@fields)
+ or print "WARNING: Couldn't execute insert into builds (@fields): " . $db->errstr() . "\n" if (!$dryrun);
+
+ $newbuildid = $db->last_insert_id(undef, undef, undef, undef) if (!$dryrun);
+ }
+ if (@{$envinfo})
+ {
+ my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($newbuildid,?,?)")
+ or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$envinfo})
+ {
+ my $tool = $entry->{tool};
+ my $version = $entry->{version};
+
+ $query->execute($tool, $version)
+ or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$failures})
+ {
+ print " prepare_cached 'insert into failures (build_id,category,count) values ($newbuildid,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($newbuildid,?,?)")
+ or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$failures})
+ {
+ my $category = $entry->{category};
+ my $count = $entry->{count};
+
+ print " execute '$category, $count'\n" if ($verbose);
+ $query->execute($category, $count)
+ or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$reports})
+ {
+ print " prepare_cached 'insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($newbuildid,?,?,?)")
+ or die("Couldn't prepare query insert into reports: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$reports})
+ {
+ my $name = $entry->{name};
+ my $url = $entry->{url};
+ my $type = $entry->{type};
+
+ print " execute '$name, $url, $type'\n" if ($verbose);
+ $query->execute($name, $url, $type)
+ or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$content})
+ {
+ print " prepare_cached 'insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($newbuildid,?,?,?)")
+ or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$content})
+ {
+ my $name = $entry->{name};
+ my $url = $entry->{url};
+ my $revision = $entry->{revision};
+
+ print " execute '$name, $url, $revision'\n" if ($verbose);
+ $query->execute($name, $url, $revision)
+ or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$baselines})
+ {
+ print " prepare_cached 'insert into baselines (build_id,type,path) values ($newbuildid,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into baselines (build_id,type,path) values ($newbuildid,?,?)")
+ or die("Couldn't prepare query insert into baselines: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$baselines})
+ {
+ my $type = $entry->{type};
+ my $path = $entry->{path};
+
+ print " execute '$type, $path'\n" if ($verbose);
+ $query->execute($type, $path)
+ or print "WARNING: Couldn't execute insert into baselines ($type,$path): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$labels})
+ {
+ print " prepare_cached 'insert into labels (build_id,label) values ($newbuildid,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into labels (build_id,label) values ($newbuildid,?)")
+ or die("Couldn't prepare query insert into labels: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$labels})
+ {
+ my $label = $entry->{label};
+
+ print " execute '$label'\n" if ($verbose);
+ $query->execute($label)
+ or print "WARNING: Couldn't execute insert into revision ($label): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ print "new build id: $newbuildid\n";
+}
+else
+{
+ print "Updating build $id\n";
+
+ if (keys %{$builds_entry})
+ {
+ my $field_list = '';
+ my @fields = ();
+ for my $field (keys %{$builds_entry})
+ {
+ $field_list .= "$field=?,";
+ push(@fields,$builds_entry->{$field});
+ }
+ $field_list =~ s/,$//;
+
+ print " prepare 'update builds set $field_list where id=$id'\n" if ($verbose);
+ my $query = $db->prepare("update builds set $field_list where id=$id")
+ or die("Couldn't prepare query update builds: " . $db->errstr()) if (!$dryrun);
+
+ print " execute '@fields'\n" if ($verbose);
+ $query->execute(@fields)
+ or print "WARNING: Couldn't execute update builds (@fields): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ if (@{$envinfo})
+ {
+ print " prepare 'delete from envinfo where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from envinfo where build_id=$id")
+ or die("Couldn't prepare query delete from envinfo: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from envinfo: " . $db->errstr() . "\n" if (!$dryrun);
+
+ print " prepare 'insert into envinfo (build_id,tool,version) values ($id,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into envinfo (build_id,tool,version) values ($id,?,?)")
+ or die("Couldn't prepare query insert into envinfo: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$envinfo})
+ {
+ my $tool = $entry->{tool};
+ my $version = $entry->{version};
+
+ print " execute '$tool,$version'\n" if ($verbose);
+ $query->execute($tool, $version)
+ or print "WARNING: Couldn't execute insert into envinfo ($tool,$version): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$failures})
+ {
+ print " prepare 'delete from failures where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from failures where build_id=$id")
+ or die("Couldn't prepare query delete from failures: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from failures: " . $db->errstr() . "\n" if (!$dryrun);
+
+ print " prepare 'insert into failures (build_id,category,count) values ($id,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into failures (build_id,category,count) values ($id,?,?)")
+ or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$failures})
+ {
+ my $category = $entry->{category};
+ my $count = $entry->{count};
+
+ print " execute '$category,$count'\n" if ($verbose);
+ $query->execute($category, $count)
+ or print "WARNING: Couldn't execute insert into failures ($category,$count): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$reports})
+ {
+ print " prepare 'delete from reports where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from reports where build_id=$id")
+ or die("Couldn't prepare query delete from reports: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from reports: " . $db->errstr() . "\n";
+
+ print " prepare 'insert into reports (build_id,name,url,type) values ($id,?,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into reports (build_id,name,url,type) values ($id,?,?,?)")
+ or die("Couldn't prepare query insert into failures: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$reports})
+ {
+ my $name = $entry->{name};
+ my $url = $entry->{url};
+ my $type = $entry->{type};
+
+ print " execute '$name,$url,$type'\n" if ($verbose);
+ $query->execute($name, $url, $type)
+ or print "WARNING: Couldn't execute insert into reports ($name,$url,$type): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$content})
+ {
+ print " prepare 'delete from content where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from content where build_id=$id")
+ or die("Couldn't prepare query delete from content: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from content: " . $db->errstr() . "\n" if (!$dryrun);
+
+ print " prepare 'insert into content (build_id,name,url,revision) values ($id,?,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into content (build_id,name,url,revision) values ($id,?,?,?)")
+ or die("Couldn't prepare query insert into content: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$content})
+ {
+ my $name = $entry->{name};
+ my $url = $entry->{url};
+ my $revision = $entry->{revision};
+
+ print " execute '$name,$url,$revision'\n" if ($verbose);
+ $query->execute($name, $url, $revision)
+ or print "WARNING: Couldn't execute insert into content ($name,$url,$revision): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$baselines})
+ {
+ print " prepare 'delete from baselines where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from baselines where build_id=$id")
+ or die("Couldn't prepare query delete from baselines: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from baselines: " . $db->errstr() . "\n" if (!$dryrun);
+
+ print " prepare 'insert into baselines (build_id,type,path) values ($id,?,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into baselines (build_id,type,path) values ($id,?,?)")
+ or die("Couldn't prepare query insert into baselines: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$baselines})
+ {
+ my $type = $entry->{type};
+ my $path = $entry->{path};
+
+ print " execute '$type,$path'\n" if ($verbose);
+ $query->execute($type, $path)
+ or print "WARNING: Couldn't execute insert into baselines ($type,$path): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+ if (@{$labels})
+ {
+ print " prepare 'delete from labels where build_id=$id'\n" if ($verbose);
+ my $delete_query = $db->prepare("delete from labels where build_id=$id")
+ or die("Couldn't prepare query delete from labels: " . $db->errstr()) if (!$dryrun);
+
+ print " execute ''\n" if ($verbose);
+ $delete_query->execute()
+ or print "WARNING: Couldn't execute delete from labels: " . $db->errstr() . "\n" if (!$dryrun);
+
+ print " prepare 'insert into labels (build_id,label) values ($id,?)'\n" if ($verbose);
+ my $query = $db->prepare_cached("insert into label (build_id,label) values ($id,?)")
+ or die("Couldn't prepare query insert into label: " . $db->errstr()) if (!$dryrun);
+
+ for my $entry (@{$labels})
+ {
+ my $label = $entry->{label};
+
+ print " execute '$label'\n" if ($verbose);
+ $query->execute($label)
+ or print "WARNING: Couldn't execute insert into labels ($label): " . $db->errstr() . "\n" if (!$dryrun);
+ }
+ }
+}
+DisconnectFromDB();
+
+
--- a/common/tools/envinfo2diamonds.pl Thu Jul 08 18:13:52 2010 +0100
+++ b/common/tools/envinfo2diamonds.pl Tue Jul 20 23:33:58 2010 +0100
@@ -18,6 +18,7 @@
my $input = "\\output\\logs\\envinfo.txt";
my $output = "\\output\\logs\\diamonds_envinfo.xml";
+my $bit_output = "\\output\\logs\\bitinfo.txt";
my $help = 0;
GetOptions((
'in=s' => \$input,
@@ -53,7 +54,6 @@
close(INFILE);
# write diamonds file
-@environment_info = reverse(@environment_info);
my $xml_content = <<_EOX;
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
@@ -66,10 +66,15 @@
_EOX
my $tools_lines = '';
-for my $tool_info (@environment_info)
+for my $tool_info (reverse(@environment_info))
{
$tools_lines .= " <tool><name>$tool_info->{name}</name><version>$tool_info->{version}</version></tool>\n";
}
+my $bit_tools_lines = '';
+for my $bit_tool_info (@environment_info)
+{
+ $bit_tools_lines .= "envinfo\t$bit_tool_info->{name},$bit_tool_info->{version}\n";
+}
$xml_content =~ s/_HERE_TOOLS_LINES_/$tools_lines/;
@@ -83,3 +88,9 @@
{
warn "Could not write to file: $output\n";
}
+
+if (open(BITINFO, ">>$bit_output"))
+{
+ print BITINFO $bit_tools_lines;
+ close(BITINFO);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/lib/Bundle/DBD/mysql.pm Tue Jul 20 23:33:58 2010 +0100
@@ -0,0 +1,30 @@
+# -*- perl -*-
+
+package Bundle::DBD::mysql;
+
+$VERSION = '4.004';
+
+1;
+
+__END__
+
+=head1 NAME
+
+Bundle::DBD::mysql - A bundle to install Perl drivers for MySQL
+
+=head1 SYNOPSIS
+
+C<perl -MCPAN -e 'install Bundle::DBD::mysql'>
+
+=head1 CONTENTS
+
+DBI
+
+DBD::mysql
+
+=head1 DESCRIPTION
+
+This bundle includes all that is needed to connect with a MySQL server using
+DBI.
+
+=cut
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/lib/DBD/mysql.pm Tue Jul 20 23:33:58 2010 +0100
@@ -0,0 +1,1945 @@
+# -*- cperl -*-
+
+package DBD::mysql;
+use strict;
+use vars qw(@ISA $VERSION $err $errstr $drh);
+
+use DBI ();
+use DynaLoader();
+use Carp ();
+@ISA = qw(DynaLoader);
+
+$VERSION = '4.014';
+
+bootstrap DBD::mysql $VERSION;
+
+
+$err = 0; # holds error code for DBI::err
+$errstr = ""; # holds error string for DBI::errstr
+$drh = undef; # holds driver handle once initialised
+
+sub driver{
+ return $drh if $drh;
+ my($class, $attr) = @_;
+
+ $class .= "::dr";
+
+ # not a 'my' since we use it above to prevent multiple drivers
+ $drh = DBI::_new_drh($class, { 'Name' => 'mysql',
+ 'Version' => $VERSION,
+ 'Err' => \$DBD::mysql::err,
+ 'Errstr' => \$DBD::mysql::errstr,
+ 'Attribution' => 'DBD::mysql by Patrick Galbraith'
+ });
+
+ $drh;
+}
+
+sub CLONE {
+ undef $drh;
+}
+
+sub _OdbcParse($$$) {
+ my($class, $dsn, $hash, $args) = @_;
+ my($var, $val);
+ if (!defined($dsn)) {
+ return;
+ }
+ while (length($dsn)) {
+ if ($dsn =~ /([^:;]*)[:;](.*)/) {
+ $val = $1;
+ $dsn = $2;
+ } else {
+ $val = $dsn;
+ $dsn = '';
+ }
+ if ($val =~ /([^=]*)=(.*)/) {
+ $var = $1;
+ $val = $2;
+ if ($var eq 'hostname' || $var eq 'host') {
+ $hash->{'host'} = $val;
+ } elsif ($var eq 'db' || $var eq 'dbname') {
+ $hash->{'database'} = $val;
+ } else {
+ $hash->{$var} = $val;
+ }
+ } else {
+ foreach $var (@$args) {
+ if (!defined($hash->{$var})) {
+ $hash->{$var} = $val;
+ last;
+ }
+ }
+ }
+ }
+}
+
+sub _OdbcParseHost ($$) {
+ my($class, $dsn) = @_;
+ my($hash) = {};
+ $class->_OdbcParse($dsn, $hash, ['host', 'port']);
+ ($hash->{'host'}, $hash->{'port'});
+}
+
+sub AUTOLOAD {
+ my ($meth) = $DBD::mysql::AUTOLOAD;
+ my ($smeth) = $meth;
+ $smeth =~ s/(.*)\:\://;
+
+ my $val = constant($smeth, @_ ? $_[0] : 0);
+ if ($! == 0) { eval "sub $meth { $val }"; return $val; }
+
+ Carp::croak "$meth: Not defined";
+}
+
+1;
+
+
+package DBD::mysql::dr; # ====== DRIVER ======
+use strict;
+use DBI qw(:sql_types);
+use DBI::Const::GetInfoType;
+
+sub connect {
+ my($drh, $dsn, $username, $password, $attrhash) = @_;
+ my($port);
+ my($cWarn);
+ my $connect_ref= { 'Name' => $dsn };
+ my $dbi_imp_data;
+
+ # Avoid warnings for undefined values
+ $username ||= '';
+ $password ||= '';
+ $attrhash ||= {};
+
+ # create a 'blank' dbh
+ my($this, $privateAttrHash) = (undef, $attrhash);
+ $privateAttrHash = { %$privateAttrHash,
+ 'Name' => $dsn,
+ 'user' => $username,
+ 'password' => $password
+ };
+
+ DBD::mysql->_OdbcParse($dsn, $privateAttrHash,
+ ['database', 'host', 'port']);
+
+
+ if ($DBI::VERSION >= 1.49)
+ {
+ $dbi_imp_data = delete $attrhash->{dbi_imp_data};
+ $connect_ref->{'dbi_imp_data'} = $dbi_imp_data;
+ }
+
+ if (!defined($this = DBI::_new_dbh($drh,
+ $connect_ref,
+ $privateAttrHash)))
+ {
+ return undef;
+ }
+
+ # Call msqlConnect func in mSQL.xs file
+ # and populate internal handle data.
+ DBD::mysql::db::_login($this, $dsn, $username, $password)
+ or $this = undef;
+
+ if ($this && ($ENV{MOD_PERL} || $ENV{GATEWAY_INTERFACE})) {
+ $this->{mysql_auto_reconnect} = 1;
+ }
+ $this;
+}
+
+sub data_sources {
+ my($self) = shift;
+ my($attributes) = shift;
+ my($host, $port, $user, $password) = ('', '', '', '');
+ if ($attributes) {
+ $host = $attributes->{host} || '';
+ $port = $attributes->{port} || '';
+ $user = $attributes->{user} || '';
+ $password = $attributes->{password} || '';
+ }
+ my(@dsn) = $self->func($host, $port, $user, $password, '_ListDBs');
+ my($i);
+ for ($i = 0; $i < @dsn; $i++) {
+ $dsn[$i] = "DBI:mysql:$dsn[$i]";
+ }
+ @dsn;
+}
+
+sub admin {
+ my($drh) = shift;
+ my($command) = shift;
+ my($dbname) = ($command eq 'createdb' || $command eq 'dropdb') ?
+ shift : '';
+ my($host, $port) = DBD::mysql->_OdbcParseHost(shift(@_) || '');
+ my($user) = shift || '';
+ my($password) = shift || '';
+
+ $drh->func(undef, $command,
+ $dbname || '',
+ $host || '',
+ $port || '',
+ $user, $password, '_admin_internal');
+}
+
+package DBD::mysql::db; # ====== DATABASE ======
+use strict;
+use DBI qw(:sql_types);
+
+%DBD::mysql::db::db2ANSI = ("INT" => "INTEGER",
+ "CHAR" => "CHAR",
+ "REAL" => "REAL",
+ "IDENT" => "DECIMAL"
+ );
+
+### ANSI datatype mapping to mSQL datatypes
+%DBD::mysql::db::ANSI2db = ("CHAR" => "CHAR",
+ "VARCHAR" => "CHAR",
+ "LONGVARCHAR" => "CHAR",
+ "NUMERIC" => "INTEGER",
+ "DECIMAL" => "INTEGER",
+ "BIT" => "INTEGER",
+ "TINYINT" => "INTEGER",
+ "SMALLINT" => "INTEGER",
+ "INTEGER" => "INTEGER",
+ "BIGINT" => "INTEGER",
+ "REAL" => "REAL",
+ "FLOAT" => "REAL",
+ "DOUBLE" => "REAL",
+ "BINARY" => "CHAR",
+ "VARBINARY" => "CHAR",
+ "LONGVARBINARY" => "CHAR",
+ "DATE" => "CHAR",
+ "TIME" => "CHAR",
+ "TIMESTAMP" => "CHAR"
+ );
+
+sub prepare {
+ my($dbh, $statement, $attribs)= @_;
+
+ # create a 'blank' dbh
+ my $sth = DBI::_new_sth($dbh, {'Statement' => $statement});
+
+ # Populate internal handle data.
+ if (!DBD::mysql::st::_prepare($sth, $statement, $attribs)) {
+ $sth = undef;
+ }
+
+ $sth;
+}
+
+sub db2ANSI {
+ my $self = shift;
+ my $type = shift;
+ return $DBD::mysql::db::db2ANSI{"$type"};
+}
+
+sub ANSI2db {
+ my $self = shift;
+ my $type = shift;
+ return $DBD::mysql::db::ANSI2db{"$type"};
+}
+
+sub admin {
+ my($dbh) = shift;
+ my($command) = shift;
+ my($dbname) = ($command eq 'createdb' || $command eq 'dropdb') ?
+ shift : '';
+ $dbh->{'Driver'}->func($dbh, $command, $dbname, '', '', '',
+ '_admin_internal');
+}
+
+sub _SelectDB ($$) {
+ die "_SelectDB is removed from this module; use DBI->connect instead.";
+}
+
+sub table_info ($) {
+ my ($dbh, $catalog, $schema, $table, $type, $attr) = @_;
+ $dbh->{mysql_server_prepare}||= 0;
+ my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
+ $dbh->{mysql_server_prepare}= 0;
+ my @names = qw(TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS);
+ my @rows;
+
+ my $sponge = DBI->connect("DBI:Sponge:", '','')
+ or return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr");
+
+# Return the list of catalogs
+ if (defined $catalog && $catalog eq "%" &&
+ (!defined($schema) || $schema eq "") &&
+ (!defined($table) || $table eq ""))
+ {
+ @rows = (); # Empty, because MySQL doesn't support catalogs (yet)
+ }
+ # Return the list of schemas
+ elsif (defined $schema && $schema eq "%" &&
+ (!defined($catalog) || $catalog eq "") &&
+ (!defined($table) || $table eq ""))
+ {
+ my $sth = $dbh->prepare("SHOW DATABASES")
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return undef);
+
+ $sth->execute()
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
+
+ while (my $ref = $sth->fetchrow_arrayref())
+ {
+ push(@rows, [ undef, $ref->[0], undef, undef, undef ]);
+ }
+ }
+ # Return the list of table types
+ elsif (defined $type && $type eq "%" &&
+ (!defined($catalog) || $catalog eq "") &&
+ (!defined($schema) || $schema eq "") &&
+ (!defined($table) || $table eq ""))
+ {
+ @rows = (
+ [ undef, undef, undef, "TABLE", undef ],
+ [ undef, undef, undef, "VIEW", undef ],
+ );
+ }
+ # Special case: a catalog other than undef, "", or "%"
+ elsif (defined $catalog && $catalog ne "" && $catalog ne "%")
+ {
+ @rows = (); # Nothing, because MySQL doesn't support catalogs yet.
+ }
+ # Uh oh, we actually have a meaty table_info call. Work is required!
+ else
+ {
+ my @schemas;
+ # If no table was specified, we want them all
+ $table ||= "%";
+
+ # If something was given for the schema, we need to expand it to
+ # a list of schemas, since it may be a wildcard.
+ if (defined $schema && $schema ne "")
+ {
+ my $sth = $dbh->prepare("SHOW DATABASES LIKE " .
+ $dbh->quote($schema))
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return undef);
+ $sth->execute()
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
+
+ while (my $ref = $sth->fetchrow_arrayref())
+ {
+ push @schemas, $ref->[0];
+ }
+ }
+ # Otherwise we want the current database
+ else
+ {
+ push @schemas, $dbh->selectrow_array("SELECT DATABASE()");
+ }
+
+ # Figure out which table types are desired
+ my ($want_tables, $want_views);
+ if (defined $type && $type ne "")
+ {
+ $want_tables = ($type =~ m/table/i);
+ $want_views = ($type =~ m/view/i);
+ }
+ else
+ {
+ $want_tables = $want_views = 1;
+ }
+
+ for my $database (@schemas)
+ {
+ my $sth = $dbh->prepare("SHOW /*!50002 FULL*/ TABLES FROM " .
+ $dbh->quote_identifier($database) .
+ " LIKE " . $dbh->quote($table))
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return undef);
+
+ $sth->execute() or
+ ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return DBI::set_err($dbh, $sth->err(), $sth->errstr()));
+
+ while (my $ref = $sth->fetchrow_arrayref())
+ {
+ my $type = (defined $ref->[1] &&
+ $ref->[1] =~ /view/i) ? 'VIEW' : 'TABLE';
+ next if $type eq 'TABLE' && not $want_tables;
+ next if $type eq 'VIEW' && not $want_views;
+ push @rows, [ undef, $database, $ref->[0], $type, undef ];
+ }
+ }
+ }
+
+ my $sth = $sponge->prepare("table_info",
+ {
+ rows => \@rows,
+ NUM_OF_FIELDS => scalar @names,
+ NAME => \@names,
+ })
+ or ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
+
+ $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
+ return $sth;
+}
+
+sub _ListTables {
+ my $dbh = shift;
+ if (!$DBD::mysql::QUIET) {
+ warn "_ListTables is deprecated, use \$dbh->tables()";
+ }
+ return map { $_ =~ s/.*\.//; $_ } $dbh->tables();
+}
+
+
+sub column_info {
+ my ($dbh, $catalog, $schema, $table, $column) = @_;
+ $dbh->{mysql_server_prepare}||= 0;
+ my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
+ $dbh->{mysql_server_prepare}= 0;
+
+ # ODBC allows a NULL to mean all columns, so we'll accept undef
+ $column = '%' unless defined $column;
+
+ my $ER_NO_SUCH_TABLE= 1146;
+
+ my $table_id = $dbh->quote_identifier($catalog, $schema, $table);
+
+ my @names = qw(
+ TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME
+ DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS
+ NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF
+ SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH
+ ORDINAL_POSITION IS_NULLABLE CHAR_SET_CAT
+ CHAR_SET_SCHEM CHAR_SET_NAME COLLATION_CAT COLLATION_SCHEM COLLATION_NAME
+ UDT_CAT UDT_SCHEM UDT_NAME DOMAIN_CAT DOMAIN_SCHEM DOMAIN_NAME
+ SCOPE_CAT SCOPE_SCHEM SCOPE_NAME MAX_CARDINALITY
+ DTD_IDENTIFIER IS_SELF_REF
+ mysql_is_pri_key mysql_type_name mysql_values
+ mysql_is_auto_increment
+ );
+ my %col_info;
+
+ local $dbh->{FetchHashKeyName} = 'NAME_lc';
+ # only ignore ER_NO_SUCH_TABLE in internal_execute if issued from here
+ my $desc_sth = $dbh->prepare("DESCRIBE $table_id " . $dbh->quote($column));
+ my $desc = $dbh->selectall_arrayref($desc_sth, { Columns=>{} });
+
+ #return $desc_sth if $desc_sth->err();
+ if (my $err = $desc_sth->err())
+ {
+ # return the error, unless it is due to the table not
+ # existing per DBI spec
+ if ($err != $ER_NO_SUCH_TABLE)
+ {
+ $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
+ return undef;
+ }
+ $dbh->set_err(undef,undef);
+ $desc = [];
+ }
+
+ my $ordinal_pos = 0;
+ for my $row (@$desc)
+ {
+ my $type = $row->{type};
+ $type =~ m/^(\w+)(?:\((.*?)\))?\s*(.*)/;
+ my $basetype = lc($1);
+ my $typemod = $2;
+ my $attr = $3;
+
+ my $info = $col_info{ $row->{field} }= {
+ TABLE_CAT => $catalog,
+ TABLE_SCHEM => $schema,
+ TABLE_NAME => $table,
+ COLUMN_NAME => $row->{field},
+ NULLABLE => ($row->{null} eq 'YES') ? 1 : 0,
+ IS_NULLABLE => ($row->{null} eq 'YES') ? "YES" : "NO",
+ TYPE_NAME => uc($basetype),
+ COLUMN_DEF => $row->{default},
+ ORDINAL_POSITION => ++$ordinal_pos,
+ mysql_is_pri_key => ($row->{key} eq 'PRI'),
+ mysql_type_name => $row->{type},
+ mysql_is_auto_increment => ($row->{extra} =~ /auto_increment/i ? 1 : 0),
+ };
+ #
+ # This code won't deal with a pathalogical case where a value
+ # contains a single quote followed by a comma, and doesn't unescape
+ # any escaped values. But who would use those in an enum or set?
+ #
+ my @type_params= ($typemod && index($typemod,"'")>=0) ?
+ ("$typemod," =~ /'(.*?)',/g) # assume all are quoted
+ : split /,/, $typemod||''; # no quotes, plain list
+ s/''/'/g for @type_params; # undo doubling of quotes
+
+ my @type_attr= split / /, $attr||'';
+
+ $info->{DATA_TYPE}= SQL_VARCHAR();
+ if ($basetype =~ /^(char|varchar|\w*text|\w*blob)/)
+ {
+ $info->{DATA_TYPE}= SQL_CHAR() if $basetype eq 'char';
+ if ($type_params[0])
+ {
+ $info->{COLUMN_SIZE} = $type_params[0];
+ }
+ else
+ {
+ $info->{COLUMN_SIZE} = 65535;
+ $info->{COLUMN_SIZE} = 255 if $basetype =~ /^tiny/;
+ $info->{COLUMN_SIZE} = 16777215 if $basetype =~ /^medium/;
+ $info->{COLUMN_SIZE} = 4294967295 if $basetype =~ /^long/;
+ }
+ }
+ elsif ($basetype =~ /^(binary|varbinary)/)
+ {
+ $info->{COLUMN_SIZE} = $type_params[0];
+ # SQL_BINARY & SQL_VARBINARY are tempting here but don't match the
+ # semantics for mysql (not hex). SQL_CHAR & SQL_VARCHAR are correct here.
+ $info->{DATA_TYPE} = ($basetype eq 'binary') ? SQL_CHAR() : SQL_VARCHAR();
+ }
+ elsif ($basetype =~ /^(enum|set)/)
+ {
+ if ($basetype eq 'set')
+ {
+ $info->{COLUMN_SIZE} = length(join ",", @type_params);
+ }
+ else
+ {
+ my $max_len = 0;
+ length($_) > $max_len and $max_len = length($_) for @type_params;
+ $info->{COLUMN_SIZE} = $max_len;
+ }
+ $info->{"mysql_values"} = \@type_params;
+ }
+ elsif ($basetype =~ /int/)
+ {
+ # big/medium/small/tiny etc + unsigned?
+ $info->{DATA_TYPE} = SQL_INTEGER();
+ $info->{NUM_PREC_RADIX} = 10;
+ $info->{COLUMN_SIZE} = $type_params[0];
+ }
+ elsif ($basetype =~ /^decimal/)
+ {
+ $info->{DATA_TYPE} = SQL_DECIMAL();
+ $info->{NUM_PREC_RADIX} = 10;
+ $info->{COLUMN_SIZE} = $type_params[0];
+ $info->{DECIMAL_DIGITS} = $type_params[1];
+ }
+ elsif ($basetype =~ /^(float|double)/)
+ {
+ $info->{DATA_TYPE} = ($basetype eq 'float') ? SQL_FLOAT() : SQL_DOUBLE();
+ $info->{NUM_PREC_RADIX} = 2;
+ $info->{COLUMN_SIZE} = ($basetype eq 'float') ? 32 : 64;
+ }
+ elsif ($basetype =~ /date|time/)
+ {
+ # date/datetime/time/timestamp
+ if ($basetype eq 'time' or $basetype eq 'date')
+ {
+ #$info->{DATA_TYPE} = ($basetype eq 'time') ? SQL_TYPE_TIME() : SQL_TYPE_DATE();
+ $info->{DATA_TYPE} = ($basetype eq 'time') ? SQL_TIME() : SQL_DATE();
+ $info->{COLUMN_SIZE} = ($basetype eq 'time') ? 8 : 10;
+ }
+ else
+ {
+ # datetime/timestamp
+ #$info->{DATA_TYPE} = SQL_TYPE_TIMESTAMP();
+ $info->{DATA_TYPE} = SQL_TIMESTAMP();
+ $info->{SQL_DATA_TYPE} = SQL_DATETIME();
+ $info->{SQL_DATETIME_SUB} = $info->{DATA_TYPE} - ($info->{SQL_DATA_TYPE} * 10);
+ $info->{COLUMN_SIZE} = ($basetype eq 'datetime') ? 19 : $type_params[0] || 14;
+ }
+ $info->{DECIMAL_DIGITS}= 0; # no fractional seconds
+ }
+ elsif ($basetype eq 'year')
+ {
+ # no close standard so treat as int
+ $info->{DATA_TYPE} = SQL_INTEGER();
+ $info->{NUM_PREC_RADIX} = 10;
+ $info->{COLUMN_SIZE} = 4;
+ }
+ else
+ {
+ Carp::carp("column_info: unrecognized column type '$basetype' of $table_id.$row->{field} treated as varchar");
+ }
+ $info->{SQL_DATA_TYPE} ||= $info->{DATA_TYPE};
+ #warn Dumper($info);
+ }
+
+ my $sponge = DBI->connect("DBI:Sponge:", '','')
+ or ( $dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr"));
+
+ my $sth = $sponge->prepare("column_info $table", {
+ rows => [ map { [ @{$_}{@names} ] } values %col_info ],
+ NUM_OF_FIELDS => scalar @names,
+ NAME => \@names,
+ }) or
+ return ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
+
+ $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
+ return $sth;
+}
+
+
+sub primary_key_info {
+ my ($dbh, $catalog, $schema, $table) = @_;
+ $dbh->{mysql_server_prepare}||= 0;
+ my $mysql_server_prepare_save= $dbh->{mysql_server_prepare};
+
+ my $table_id = $dbh->quote_identifier($catalog, $schema, $table);
+
+ my @names = qw(
+ TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME
+ );
+ my %col_info;
+
+ local $dbh->{FetchHashKeyName} = 'NAME_lc';
+ my $desc_sth = $dbh->prepare("SHOW KEYS FROM $table_id");
+ my $desc= $dbh->selectall_arrayref($desc_sth, { Columns=>{} });
+ my $ordinal_pos = 0;
+ for my $row (grep { $_->{key_name} eq 'PRIMARY'} @$desc)
+ {
+ $col_info{ $row->{column_name} }= {
+ TABLE_CAT => $catalog,
+ TABLE_SCHEM => $schema,
+ TABLE_NAME => $table,
+ COLUMN_NAME => $row->{column_name},
+ KEY_SEQ => $row->{seq_in_index},
+ PK_NAME => $row->{key_name},
+ };
+ }
+
+ my $sponge = DBI->connect("DBI:Sponge:", '','')
+ or
+ ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return $dbh->DBI::set_err($DBI::err, "DBI::Sponge: $DBI::errstr"));
+
+ my $sth= $sponge->prepare("primary_key_info $table", {
+ rows => [ map { [ @{$_}{@names} ] } values %col_info ],
+ NUM_OF_FIELDS => scalar @names,
+ NAME => \@names,
+ }) or
+ ($dbh->{mysql_server_prepare}= $mysql_server_prepare_save &&
+ return $dbh->DBI::set_err($sponge->err(), $sponge->errstr()));
+
+ $dbh->{mysql_server_prepare}= $mysql_server_prepare_save;
+
+ return $sth;
+}
+
+
+sub foreign_key_info {
+ my ($dbh,
+ $pk_catalog, $pk_schema, $pk_table,
+ $fk_catalog, $fk_schema, $fk_table,
+ ) = @_;
+
+ # INFORMATION_SCHEMA.KEY_COLUMN_USAGE was added in 5.0.6
+ my ($maj, $min, $point) = _version($dbh);
+ return if $maj < 5 || ($maj == 5 && $point < 6);
+
+ my $sql = <<'EOF';
+SELECT NULL AS PKTABLE_CAT,
+ A.REFERENCED_TABLE_SCHEMA AS PKTABLE_SCHEM,
+ A.REFERENCED_TABLE_NAME AS PKTABLE_NAME,
+ A.REFERENCED_COLUMN_NAME AS PKCOLUMN_NAME,
+ A.TABLE_CATALOG AS FKTABLE_CAT,
+ A.TABLE_SCHEMA AS FKTABLE_SCHEM,
+ A.TABLE_NAME AS FKTABLE_NAME,
+ A.COLUMN_NAME AS FKCOLUMN_NAME,
+ A.ORDINAL_POSITION AS KEY_SEQ,
+ NULL AS UPDATE_RULE,
+ NULL AS DELETE_RULE,
+ A.CONSTRAINT_NAME AS FK_NAME,
+ NULL AS PK_NAME,
+ NULL AS DEFERABILITY,
+ NULL AS UNIQUE_OR_PRIMARY
+ FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE A,
+ INFORMATION_SCHEMA.TABLE_CONSTRAINTS B
+ WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME
+ AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE IS NOT NULL
+EOF
+
+ my @where;
+ my @bind;
+
+ # catalogs are not yet supported by MySQL
+
+# if (defined $pk_catalog) {
+# push @where, 'A.REFERENCED_TABLE_CATALOG = ?';
+# push @bind, $pk_catalog;
+# }
+
+ if (defined $pk_schema) {
+ push @where, 'A.REFERENCED_TABLE_SCHEMA = ?';
+ push @bind, $pk_schema;
+ }
+
+ if (defined $pk_table) {
+ push @where, 'A.REFERENCED_TABLE_NAME = ?';
+ push @bind, $pk_table;
+ }
+
+# if (defined $fk_catalog) {
+# push @where, 'A.TABLE_CATALOG = ?';
+# push @bind, $fk_schema;
+# }
+
+ if (defined $fk_schema) {
+ push @where, 'A.TABLE_SCHEMA = ?';
+ push @bind, $fk_schema;
+ }
+
+ if (defined $fk_table) {
+ push @where, 'A.TABLE_NAME = ?';
+ push @bind, $fk_table;
+ }
+
+ if (@where) {
+ $sql .= ' AND ';
+ $sql .= join ' AND ', @where;
+ }
+ $sql .= " ORDER BY A.TABLE_SCHEMA, A.TABLE_NAME, A.ORDINAL_POSITION";
+
+ local $dbh->{FetchHashKeyName} = 'NAME_uc';
+ my $sth = $dbh->prepare($sql);
+ $sth->execute(@bind);
+
+ return $sth;
+}
+
+
+sub _version {
+ my $dbh = shift;
+
+ return
+ $dbh->get_info($DBI::Const::GetInfoType::GetInfoType{SQL_DBMS_VER})
+ =~ /(\d+)\.(\d+)\.(\d+)/;
+}
+
+
+####################
+# get_info()
+# Generated by DBI::DBD::Metadata
+
+sub get_info {
+ my($dbh, $info_type) = @_;
+ require DBD::mysql::GetInfo;
+ my $v = $DBD::mysql::GetInfo::info{int($info_type)};
+ $v = $v->($dbh) if ref $v eq 'CODE';
+ return $v;
+}
+
+
+
+package DBD::mysql::st; # ====== STATEMENT ======
+use strict;
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
+
+=head1 SYNOPSIS
+
+ use DBI;
+
+ $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+
+ $dbh = DBI->connect($dsn, $user, $password);
+
+
+ $drh = DBI->install_driver("mysql");
+ @databases = DBI->data_sources("mysql");
+ or
+ @databases = DBI->data_sources("mysql",
+ {"host" => $host, "port" => $port, "user" => $user, password => $pass});
+
+ $sth = $dbh->prepare("SELECT * FROM foo WHERE bla");
+ or
+ $sth = $dbh->prepare("LISTFIELDS $table");
+ or
+ $sth = $dbh->prepare("LISTINDEX $table $index");
+ $sth->execute;
+ $numRows = $sth->rows;
+ $numFields = $sth->{'NUM_OF_FIELDS'};
+ $sth->finish;
+
+ $rc = $drh->func('createdb', $database, $host, $user, $password, 'admin');
+ $rc = $drh->func('dropdb', $database, $host, $user, $password, 'admin');
+ $rc = $drh->func('shutdown', $host, $user, $password, 'admin');
+ $rc = $drh->func('reload', $host, $user, $password, 'admin');
+
+ $rc = $dbh->func('createdb', $database, 'admin');
+ $rc = $dbh->func('dropdb', $database, 'admin');
+ $rc = $dbh->func('shutdown', 'admin');
+ $rc = $dbh->func('reload', 'admin');
+
+
+=head1 EXAMPLE
+
+ #!/usr/bin/perl
+
+ use strict;
+ use DBI();
+
+ # Connect to the database.
+ my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost",
+ "joe", "joe's password",
+ {'RaiseError' => 1});
+
+ # Drop table 'foo'. This may fail, if 'foo' doesn't exist.
+ # Thus we put an eval around it.
+ eval { $dbh->do("DROP TABLE foo") };
+ print "Dropping foo failed: $@\n" if $@;
+
+ # Create a new table 'foo'. This must not fail, thus we don't
+ # catch errors.
+ $dbh->do("CREATE TABLE foo (id INTEGER, name VARCHAR(20))");
+
+ # INSERT some data into 'foo'. We are using $dbh->quote() for
+ # quoting the name.
+ $dbh->do("INSERT INTO foo VALUES (1, " . $dbh->quote("Tim") . ")");
+
+ # Same thing, but using placeholders
+ $dbh->do("INSERT INTO foo VALUES (?, ?)", undef, 2, "Jochen");
+
+ # Now retrieve data from the table.
+ 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();
+
+ # Disconnect from the database.
+ $dbh->disconnect();
+
+
+=head1 DESCRIPTION
+
+B<DBD::mysql> is the Perl5 Database Interface driver for the MySQL
+database. In other words: DBD::mysql is an interface between the Perl
+programming language and the MySQL programming API that comes with
+the MySQL relational database management system. Most functions
+provided by this programming API are supported. Some rarely used
+functions are missing, mainly because noone ever requested
+them. :-)
+
+In what follows we first discuss the use of DBD::mysql,
+because this is what you will need the most. For installation, see the
+sections on L<INSTALLATION>, and L<WIN32 INSTALLATION>
+below. See L<EXAMPLE> for a simple example above.
+
+From perl you activate the interface with the statement
+
+ use DBI;
+
+After that you can connect to multiple MySQL database servers
+and send multiple queries to any of them via a simple object oriented
+interface. Two types of objects are available: database handles and
+statement handles. Perl returns a database handle to the connect
+method like so:
+
+ $dbh = DBI->connect("DBI:mysql:database=$db;host=$host",
+ $user, $password, {RaiseError => 1});
+
+Once you have connected to a database, you can can execute SQL
+statements with:
+
+ my $query = sprintf("INSERT INTO foo VALUES (%d, %s)",
+ $number, $dbh->quote("name"));
+ $dbh->do($query);
+
+See L<DBI(3)> for details on the quote and do methods. An alternative
+approach is
+
+ $dbh->do("INSERT INTO foo VALUES (?, ?)", undef,
+ $number, $name);
+
+in which case the quote method is executed automatically. See also
+the bind_param method in L<DBI(3)>. See L<DATABASE HANDLES> below
+for more details on database handles.
+
+If you want to retrieve results, you need to create a so-called
+statement handle with:
+
+ $sth = $dbh->prepare("SELECT * FROM $table");
+ $sth->execute();
+
+This statement handle can be used for multiple things. First of all
+you can retreive a row of data:
+
+ my $row = $sth->fetchrow_hashref();
+
+If your table has columns ID and NAME, then $row will be hash ref with
+keys ID and NAME. See L<STATEMENT HANDLES> below for more details on
+statement handles.
+
+But now for a more formal approach:
+
+
+=head2 Class Methods
+
+=over
+
+=item B<connect>
+
+ use DBI;
+
+ $dsn = "DBI:mysql:$database";
+ $dsn = "DBI:mysql:database=$database;host=$hostname";
+ $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
+
+ $dbh = DBI->connect($dsn, $user, $password);
+
+A C<database> must always be specified.
+
+=over
+
+=item host
+
+=item port
+
+The hostname, if not specified or specified as '' or 'localhost', will
+default to a MySQL server running on the local machine using the default for
+the UNIX socket. To connect to a MySQL server on the local machine via TCP,
+you must specify the loopback IP address (127.0.0.1) as the host.
+
+Should the MySQL server be running on a non-standard port number,
+you may explicitly state the port number to connect to in the C<hostname>
+argument, by concatenating the I<hostname> and I<port number> together
+separated by a colon ( C<:> ) character or by using the C<port> argument.
+
+To connect to a MySQL server on localhost using TCP/IP, you must specify the
+hostname as 127.0.0.1 (with the optional port).
+
+=item mysql_client_found_rows
+
+Enables (TRUE value) or disables (FALSE value) the flag CLIENT_FOUND_ROWS
+while connecting to the MySQL server. This has a somewhat funny effect:
+Without mysql_client_found_rows, if you perform a query like
+
+ UPDATE $table SET id = 1 WHERE id = 1
+
+then the MySQL engine will always return 0, because no rows have changed.
+With mysql_client_found_rows however, it will return the number of rows
+that have an id 1, as some people are expecting. (At least for compatibility
+to other engines.)
+
+=item mysql_compression
+
+As of MySQL 3.22.3, a new feature is supported: If your DSN contains
+the option "mysql_compression=1", then the communication between client
+and server will be compressed.
+
+=item mysql_connect_timeout
+
+If your DSN contains the option "mysql_connect_timeout=##", the connect
+request to the server will timeout if it has not been successful after
+the given number of seconds.
+
+ =item mysql_init_command
+
+ If your DSN contains the option "mysql_init_command_timeout=##", then
+ this SQL statement is executed when connecting to the MySQL server.
+ It is automatically re-executed if reconnection occurs.
+
+=item mysql_read_default_file
+
+=item mysql_read_default_group
+
+These options can be used to read a config file like /etc/my.cnf or
+~/.my.cnf. By default MySQL's C client library doesn't use any config
+files unlike the client programs (mysql, mysqladmin, ...) that do, but
+outside of the C client library. Thus you need to explicitly request
+reading a config file, as in
+
+ $dsn = "DBI:mysql:test;mysql_read_default_file=/home/joe/my.cnf";
+ $dbh = DBI->connect($dsn, $user, $password)
+
+The option mysql_read_default_group can be used to specify the default
+group in the config file: Usually this is the I<client> group, but
+see the following example:
+
+ [client]
+ host=localhost
+
+ [perl]
+ host=perlhost
+
+(Note the order of the entries! The example won't work, if you reverse
+the [client] and [perl] sections!)
+
+If you read this config file, then you'll be typically connected to
+I<localhost>. However, by using
+
+ $dsn = "DBI:mysql:test;mysql_read_default_group=perl;"
+ . "mysql_read_default_file=/home/joe/my.cnf";
+ $dbh = DBI->connect($dsn, $user, $password);
+
+you'll be connected to I<perlhost>. Note that if you specify a
+default group and do not specify a file, then the default config
+files will all be read. See the documentation of
+the C function mysql_options() for details.
+
+=item mysql_socket
+
+As of MySQL 3.21.15, it is possible to choose the Unix socket that is
+used for connecting to the server. This is done, for example, with
+
+ mysql_socket=/dev/mysql
+
+Usually there's no need for this option, unless you are using another
+location for the socket than that built into the client.
+
+=item mysql_ssl
+
+A true value turns on the CLIENT_SSL flag when connecting to the MySQL
+database:
+
+ mysql_ssl=1
+
+This means that your communication with the server will be encrypted.
+
+If you turn mysql_ssl on, you might also wish to use the following
+flags:
+
+=item mysql_ssl_client_key
+
+=item mysql_ssl_client_cert
+
+=item mysql_ssl_ca_file
+
+=item mysql_ssl_ca_path
+
+=item mysql_ssl_cipher
+
+These are used to specify the respective parameters of a call
+to mysql_ssl_set, if mysql_ssl is turned on.
+
+
+=item mysql_local_infile
+
+As of MySQL 3.23.49, the LOCAL capability for LOAD DATA may be disabled
+in the MySQL client library by default. If your DSN contains the option
+"mysql_local_infile=1", LOAD DATA LOCAL will be enabled. (However,
+this option is *ineffective* if the server has also been configured to
+disallow LOCAL.)
+
+=item mysql_multi_statements
+
+As of MySQL 4.1, support for multiple statements seperated by a semicolon
+(;) may be enabled by using this option. Enabling this option may cause
+problems if server-side prepared statements are also enabled.
+
+=item Prepared statement support (server side prepare)
+
+As of 3.0002_1, server side prepare statements were on by default (if your
+server was >= 4.1.3). As of 3.0009, they were off by default again due to
+issues with the prepared statement API (all other mysql connectors are
+set this way until C API issues are resolved). The requirement to use
+prepared statements still remains that you have a server >= 4.1.3
+
+To use server side prepared statements, all you need to do is set the variable
+mysql_server_prepare in the connect:
+
+$dbh = DBI->connect(
+ "DBI:mysql:database=test;host=localhost;mysql_server_prepare=1",
+ "",
+ "",
+ { RaiseError => 1, AutoCommit => 1 }
+ );
+
+* Note: delimiter for this param is ';'
+
+There are many benefits to using server side prepare statements, mostly if you are
+performing many inserts because of that fact that a single statement is prepared
+to accept multiple insert values.
+
+To make sure that the 'make test' step tests whether server prepare works, you just
+need to export the env variable MYSQL_SERVER_PREPARE:
+
+export MYSQL_SERVER_PREPARE=1
+
+
+=item mysql_embedded_options
+
+The option <mysql_embedded_options> can be used to pass 'command-line'
+options to embedded server.
+
+Example:
+
+use DBI;
+$testdsn="DBI:mysqlEmb:database=test;mysql_embedded_options=--help,--verbose";
+$dbh = DBI->connect($testdsn,"a","b");
+
+This would cause the command line help to the embedded MySQL server library
+to be printed.
+
+
+=item mysql_embedded_groups
+
+The option <mysql_embedded_groups> can be used to specify the groups in the
+config file(I<my.cnf>) which will be used to get options for embedded server.
+If not specified [server] and [embedded] groups will be used.
+
+Example:
+
+$testdsn="DBI:mysqlEmb:database=test;mysql_embedded_groups=embedded_server,common";
+
+
+=back
+
+=back
+
+
+=head2 Private MetaData Methods
+
+=over
+
+=item B<ListDBs>
+
+ my $drh = DBI->install_driver("mysql");
+ @dbs = $drh->func("$hostname:$port", '_ListDBs');
+ @dbs = $drh->func($hostname, $port, '_ListDBs');
+ @dbs = $dbh->func('_ListDBs');
+
+Returns a list of all databases managed by the MySQL server
+running on C<$hostname>, port C<$port>. This is a legacy
+method. Instead, you should use the portable method
+
+ @dbs = DBI->data_sources("mysql");
+
+=back
+
+
+=head2 Server Administration
+
+=over
+
+=item admin
+
+ $rc = $drh->func("createdb", $dbname, [host, user, password,], 'admin');
+ $rc = $drh->func("dropdb", $dbname, [host, user, password,], 'admin');
+ $rc = $drh->func("shutdown", [host, user, password,], 'admin');
+ $rc = $drh->func("reload", [host, user, password,], 'admin');
+
+ or
+
+ $rc = $dbh->func("createdb", $dbname, 'admin');
+ $rc = $dbh->func("dropdb", $dbname, 'admin');
+ $rc = $dbh->func("shutdown", 'admin');
+ $rc = $dbh->func("reload", 'admin');
+
+For server administration you need a server connection. For obtaining
+this connection you have two options: Either use a driver handle (drh)
+and supply the appropriate arguments (host, defaults localhost, user,
+defaults to '' and password, defaults to ''). A driver handle can be
+obtained with
+
+ $drh = DBI->install_driver('mysql');
+
+Otherwise reuse the existing connection of a database handle (dbh).
+
+There's only one function available for administrative purposes, comparable
+to the m(y)sqladmin programs. The command being execute depends on the
+first argument:
+
+=over
+
+=item createdb
+
+Creates the database $dbname. Equivalent to "m(y)sqladmin create $dbname".
+
+=item dropdb
+
+Drops the database $dbname. Equivalent to "m(y)sqladmin drop $dbname".
+
+It should be noted that database deletion is
+I<not prompted for> in any way. Nor is it undo-able from DBI.
+
+ Once you issue the dropDB() method, the database will be gone!
+
+These method should be used at your own risk.
+
+=item shutdown
+
+Silently shuts down the database engine. (Without prompting!)
+Equivalent to "m(y)sqladmin shutdown".
+
+=item reload
+
+Reloads the servers configuration files and/or tables. This can be particularly
+important if you modify access privileges or create new users.
+
+=back
+
+=back
+
+
+=head1 DATABASE HANDLES
+
+The DBD::mysql driver supports the following attributes of database
+handles (read only):
+
+ $errno = $dbh->{'mysql_errno'};
+ $error = $dbh->{'mysql_error'};
+ $info = $dbh->{'mysql_hostinfo'};
+ $info = $dbh->{'mysql_info'};
+ $insertid = $dbh->{'mysql_insertid'};
+ $info = $dbh->{'mysql_protoinfo'};
+ $info = $dbh->{'mysql_serverinfo'};
+ $info = $dbh->{'mysql_stat'};
+ $threadId = $dbh->{'mysql_thread_id'};
+
+These correspond to mysql_errno(), mysql_error(), mysql_get_host_info(),
+mysql_info(), mysql_insert_id(), mysql_get_proto_info(),
+mysql_get_server_info(), mysql_stat() and mysql_thread_id(),
+respectively.
+
+
+ $info_hashref = $dhb->{mysql_dbd_stats}
+
+DBD::mysql keeps track of some statistics in the mysql_dbd_stats attribute.
+The following stats are being maintained:
+
+=over
+
+=item auto_reconnects_ok
+
+The number of times that DBD::mysql successfully reconnected to the mysql
+server.
+
+=item auto_reconnects_failed
+
+The number of times that DBD::mysql tried to reconnect to mysql but failed.
+
+=back
+
+The DBD::mysql driver also supports the following attribute(s) of database
+handles (read/write):
+
+ $bool_value = $dbh->{mysql_auto_reconnect};
+ $dbh->{mysql_auto_reconnect} = $AutoReconnect ? 1 : 0;
+
+
+=item mysql_auto_reconnect
+
+This attribute determines whether DBD::mysql will automatically reconnect
+to mysql if the connection be lost. This feature defaults to off; however,
+if either the GATEWAY_INTERFACE or MOD_PERL envionment variable is set,
+DBD::mysql will turn mysql_auto_reconnect on. Setting mysql_auto_reconnect
+to on is not advised if 'lock tables' is used because if DBD::mysql reconnect
+to mysql all table locks will be lost. This attribute is ignored when
+AutoCommit is turned off, and when AutoCommit is turned off, DBD::mysql will
+not automatically reconnect to the server.
+
+=item mysql_use_result
+
+This attribute forces the driver to use mysql_use_result rather than
+mysql_store_result. The former is faster and less memory consuming, but
+tends to block other processes. (That's why mysql_store_result is the
+default.)
+
+It is possible to set default value of the C<mysql_use_result> attribute
+for $dbh using several ways:
+
+ - through DSN
+
+ $dbh= DBI->connect("DBI:mysql:test;mysql_use_result=1", "root", "");
+
+ - after creation of database handle
+
+ $dbh->{'mysql_use_result'}=0; #disable
+ $dbh->{'mysql_use_result'}=1; #enable
+
+It is possible to set/unset the C<mysql_use_result> attribute after
+creation of statement handle. See below.
+
+=item mysql_enable_utf8
+
+This attribute determines whether DBD::mysql should assume strings
+stored in the database are utf8. This feature defaults to off.
+
+When set, a data retrieved from a textual column type (char, varchar,
+etc) will have the UTF-8 flag turned on if necessary. This enables
+character semantics on that string. You will also need to ensure that
+your database / table / column is configured to use UTF8. See Chapter
+10 of the mysql manual for details.
+
+Additionally, turning on this flag tells MySQL that incoming data should
+be treated as UTF-8. This will only take effect if used as part of the
+call to connect(). If you turn the flag on after connecting, you will
+need to issue the command C<SET NAMES utf8> to get the same effect.
+
+This option is experimental and may change in future versions.
+
+=item mysql_bind_type_guessing
+
+This attribute causes the driver (emulated prepare statements)
+to attempt to guess if a value being bound is a numeric value,
+and if so, doesn't quote the value. This was created by
+Dragonchild and is one way to deal with the performance issue
+of using quotes in a statement that is inserting or updating a
+large numeric value. This was previously called
+C<unsafe_bind_type_guessing> because it is experimental. I have
+successfully run the full test suite with this option turned on,
+the name can now be simply C<mysql_bind_type_guessing>.
+
+See bug: https://rt.cpan.org/Ticket/Display.html?id=43822
+
+C<mysql_bind_type_guessing> can be turned on via
+
+ - through DSN
+
+ my $dbh= DBI->connect('DBI:mysql:test', 'username', 'pass',
+ { mysql_bind_type_guessing => 1})
+
+ - OR after handle creation
+
+ $dbh->{mysql_bind_type_guessing} = 1;
+
+=item mysql_no_autocommit_cmd
+
+This attribute causes the driver to not issue 'set autocommit'
+either through explicit or using mysql_autocommit(). This is
+particularly useful in the case of using MySQL Proxy.
+
+See the bug report:
+
+https://rt.cpan.org/Public/Bug/Display.html?id=46308
+
+As well as:
+
+http://bugs.mysql.com/bug.php?id=32464
+
+C<mysql_no_autocommit_cmd> can be turned on via
+
+ - through DSN
+
+ my $dbh= DBI->connect('DBI:mysql:test', 'username', 'pass',
+ { mysql_no_autocommit_cmd => 1})
+
+ - OR after handle creation
+
+ $dbh->{mysql_no_autocommit_cmd} = 1;
+
+
+
+=head1 STATEMENT HANDLES
+
+The statement handles of DBD::mysql support a number
+of attributes. You access these by using, for example,
+
+ my $numFields = $sth->{'NUM_OF_FIELDS'};
+
+Note, that most attributes are valid only after a successfull I<execute>.
+An C<undef> value will returned in that case. The most important exception
+is the C<mysql_use_result> attribute: This forces the driver to use
+mysql_use_result rather than mysql_store_result. The former is faster
+and less memory consuming, but tends to block other processes. (That's why
+mysql_store_result is the default.)
+
+To set the C<mysql_use_result> attribute, use either of the following:
+
+ my $sth = $dbh->prepare("QUERY", { "mysql_use_result" => 1});
+
+or
+
+ my $sth = $dbh->prepare("QUERY");
+ $sth->{"mysql_use_result"} = 1;
+
+Column dependent attributes, for example I<NAME>, the column names,
+are returned as a reference to an array. The array indices are
+corresponding to the indices of the arrays returned by I<fetchrow>
+and similar methods. For example the following code will print a
+header of table names together with all rows:
+
+ my $sth = $dbh->prepare("SELECT * FROM $table");
+ if (!$sth) {
+ die "Error:" . $dbh->errstr . "\n";
+ }
+ if (!$sth->execute) {
+ die "Error:" . $sth->errstr . "\n";
+ }
+ my $names = $sth->{'NAME'};
+ my $numFields = $sth->{'NUM_OF_FIELDS'};
+ for (my $i = 0; $i < $numFields; $i++) {
+ printf("%s%s", $i ? "," : "", $$names[$i]);
+ }
+ print "\n";
+ while (my $ref = $sth->fetchrow_arrayref) {
+ for (my $i = 0; $i < $numFields; $i++) {
+ printf("%s%s", $i ? "," : "", $$ref[$i]);
+ }
+ print "\n";
+ }
+
+For portable applications you should restrict yourself to attributes with
+capitalized or mixed case names. Lower case attribute names are private
+to DBD::mysql. The attribute list includes:
+
+=over
+
+=item ChopBlanks
+
+this attribute determines whether a I<fetchrow> will chop preceding
+and trailing blanks off the column values. Chopping blanks does not
+have impact on the I<max_length> attribute.
+
+=item mysql_insertid
+
+MySQL has the ability to choose unique key values automatically. If this
+happened, the new ID will be stored in this attribute. An alternative
+way for accessing this attribute is via $dbh->{'mysql_insertid'}.
+(Note we are using the $dbh in this case!)
+
+=item mysql_is_blob
+
+Reference to an array of boolean values; TRUE indicates, that the
+respective column is a blob. This attribute is valid for MySQL only.
+
+=item mysql_is_key
+
+Reference to an array of boolean values; TRUE indicates, that the
+respective column is a key. This is valid for MySQL only.
+
+=item mysql_is_num
+
+Reference to an array of boolean values; TRUE indicates, that the
+respective column contains numeric values.
+
+=item mysql_is_pri_key
+
+Reference to an array of boolean values; TRUE indicates, that the
+respective column is a primary key.
+
+=item mysql_is_auto_increment
+
+Reference to an array of boolean values; TRUE indicates that the
+respective column is an AUTO_INCREMENT column. This is only valid
+for MySQL.
+
+=item mysql_length
+
+=item mysql_max_length
+
+A reference to an array of maximum column sizes. The I<max_length> is
+the maximum physically present in the result table, I<length> gives
+the theoretically possible maximum. I<max_length> is valid for MySQL
+only.
+
+=item NAME
+
+A reference to an array of column names.
+
+=item NULLABLE
+
+A reference to an array of boolean values; TRUE indicates that this column
+may contain NULL's.
+
+=item NUM_OF_FIELDS
+
+Number of fields returned by a I<SELECT> or I<LISTFIELDS> statement.
+You may use this for checking whether a statement returned a result:
+A zero value indicates a non-SELECT statement like I<INSERT>,
+I<DELETE> or I<UPDATE>.
+
+=item mysql_table
+
+A reference to an array of table names, useful in a I<JOIN> result.
+
+=item TYPE
+
+A reference to an array of column types. The engine's native column
+types are mapped to portable types like DBI::SQL_INTEGER() or
+DBI::SQL_VARCHAR(), as good as possible. Not all native types have
+a meaningfull equivalent, for example DBD::mysql::FIELD_TYPE_INTERVAL
+is mapped to DBI::SQL_VARCHAR().
+If you need the native column types, use I<mysql_type>. See below.
+
+=item mysql_type
+
+A reference to an array of MySQL's native column types, for example
+DBD::mysql::FIELD_TYPE_SHORT() or DBD::mysql::FIELD_TYPE_STRING().
+Use the I<TYPE> attribute, if you want portable types like
+DBI::SQL_SMALLINT() or DBI::SQL_VARCHAR().
+
+=item mysql_type_name
+
+Similar to mysql, but type names and not numbers are returned.
+Whenever possible, the ANSI SQL name is preferred.
+
+=item mysql_warning_count
+
+The number of warnings generated during execution of the SQL statement.
+
+=back
+
+=head1 TRANSACTION SUPPORT
+
+Beginning with DBD::mysql 2.0416, transactions are supported.
+The transaction support works as follows:
+
+=over
+
+=item *
+
+By default AutoCommit mode is on, following the DBI specifications.
+
+=item *
+
+If you execute
+
+ $dbh->{'AutoCommit'} = 0;
+
+or
+
+ $dbh->{'AutoCommit'} = 1;
+
+then the driver will set the MySQL server variable autocommit to 0 or
+1, respectively. Switching from 0 to 1 will also issue a COMMIT,
+following the DBI specifications.
+
+=item *
+
+The methods
+
+ $dbh->rollback();
+ $dbh->commit();
+
+will issue the commands COMMIT and ROLLBACK, respectively. A
+ROLLBACK will also be issued if AutoCommit mode is off and the
+database handles DESTROY method is called. Again, this is following
+the DBI specifications.
+
+=back
+
+Given the above, you should note the following:
+
+=over
+
+=item *
+
+You should never change the server variable autocommit manually,
+unless you are ignoring DBI's transaction support.
+
+=item *
+
+Switching AutoCommit mode from on to off or vice versa may fail.
+You should always check for errors, when changing AutoCommit mode.
+The suggested way of doing so is using the DBI flag RaiseError.
+If you don't like RaiseError, you have to use code like the
+following:
+
+ $dbh->{'AutoCommit'} = 0;
+ if ($dbh->{'AutoCommit'}) {
+ # An error occurred!
+ }
+
+=item *
+
+If you detect an error while changing the AutoCommit mode, you
+should no longer use the database handle. In other words, you
+should disconnect and reconnect again, because the transaction
+mode is unpredictable. Alternatively you may verify the transaction
+mode by checking the value of the server variable autocommit.
+However, such behaviour isn't portable.
+
+=item *
+
+DBD::mysql has a "reconnect" feature that handles the so-called
+MySQL "morning bug": If the server has disconnected, most probably
+due to a timeout, then by default the driver will reconnect and
+attempt to execute the same SQL statement again. However, this
+behaviour is disabled when AutoCommit is off: Otherwise the
+transaction state would be completely unpredictable after a
+reconnect.
+
+=item *
+
+The "reconnect" feature of DBD::mysql can be toggled by using the
+L<mysql_auto_reconnect> attribute. This behaviour should be turned off
+in code that uses LOCK TABLE because if the database server time out
+and DBD::mysql reconnect, table locks will be lost without any
+indication of such loss.
+
+=back
+
+=over
+
+=head1 MULTIPLE RESULT SETS
+
+As of version 3.0002_5, DBD::mysql supports multiple result sets (Thanks
+to Guy Harrison!). This is the first release of this functionality, so
+there may be issues. Please report bugs if you run into them!
+
+The basic usage of multiple result sets is
+
+ do
+ {
+ while (@row= $sth->fetchrow_array())
+ {
+ do stuff;
+ }
+ } while ($sth->more_results)
+
+An example would be:
+
+ $dbh->do("drop procedure if exists someproc") or print $DBI::errstr;
+
+ $dbh->do("create procedure somproc() deterministic
+ begin
+ declare a,b,c,d int;
+ set a=1;
+ set b=2;
+ set c=3;
+ set d=4;
+ select a, b, c, d;
+ select d, c, b, a;
+ select b, a, c, d;
+ select c, b, d, a;
+ end") or print $DBI::errstr;
+
+ $sth=$dbh->prepare('call someproc()') ||
+ die $DBI::err.": ".$DBI::errstr;
+
+ $sth->execute || die DBI::err.": ".$DBI::errstr; $rowset=0;
+ do {
+ print "\nRowset ".++$i."\n---------------------------------------\n\n";
+ foreach $colno (0..$sth->{NUM_OF_FIELDS}) {
+ print $sth->{NAME}->[$colno]."\t";
+ }
+ print "\n";
+ while (@row= $sth->fetchrow_array()) {
+ foreach $field (0..$#row) {
+ print $row[$field]."\t";
+ }
+ print "\n";
+ }
+ } until (!$sth->more_results)
+
+For more examples, please see the eg/ directory. This is where helpful
+DBD::mysql code snippits will be added in the future.
+
+=head2 Issues with Multiple result sets
+
+So far, the main issue is if your result sets are "jagged", meaning, the
+number of columns of your results vary. Varying numbers of columns could
+result in your script crashing. This is something that will be fixed soon.
+
+
+=head1 MULTITHREADING
+
+The multithreading capabilities of DBD::mysql depend completely
+on the underlying C libraries: The modules are working with handle data
+only, no global variables are accessed or (to the best of my knowledge)
+thread unsafe functions are called. Thus DBD::mysql is believed
+to be completely thread safe, if the C libraries are thread safe
+and you don't share handles among threads.
+
+The obvious question is: Are the C libraries thread safe?
+In the case of MySQL the answer is "mostly" and, in theory, you should
+be able to get a "yes", if the C library is compiled for being thread
+safe (By default it isn't.) by passing the option -with-thread-safe-client
+to configure. See the section on I<How to make a threadsafe client> in
+the manual.
+
+
+=head1 INSTALLATION
+
+Windows users may skip this section and pass over to L<WIN32
+INSTALLATION> below. Others, go on reading.
+
+First of all, you do not need an installed MySQL server for installing
+DBD::mysql. However, you need at least the client
+libraries and possibly the header files, if you are compiling DBD::mysql
+from source. In the case of MySQL you can create a
+client-only version by using the configure option --without-server.
+If you are using precompiled binaries, then it may be possible to
+use just selected RPM's like MySQL-client and MySQL-devel or something
+similar, depending on the distribution.
+
+First you need to install the DBI module. For using I<dbimon>, a
+simple DBI shell it is recommended to install Data::ShowTable another
+Perl module.
+
+I recommend trying automatic installation via the CPAN module. Try
+
+ perl -MCPAN -e shell
+
+If you are using the CPAN module for the first time, it will prompt
+you a lot of questions. If you finally receive the CPAN prompt, enter
+
+ install Bundle::DBD::mysql
+
+If this fails (which may be the case for a number of reasons, for
+example because you are behind a firewall or don't have network
+access), you need to do a manual installation. First of all you
+need to fetch the modules from CPAN search
+
+ http://search.cpan.org/
+
+The following modules are required
+
+ DBI
+ Data::ShowTable
+ DBD::mysql
+
+Then enter the following commands (note - versions are just examples):
+
+ gzip -cd DBI-(version).tar.gz | tar xf -
+ cd DBI-(version)
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+ cd ..
+ gzip -cd Data-ShowTable-(version).tar.gz | tar xf -
+ cd Data-ShowTable-3.3
+ perl Makefile.PL
+ make
+ make install
+
+ cd ..
+ gzip -cd DBD-mysql-(version)-tar.gz | tar xf -
+ cd DBD-mysql-(version)
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+During "perl Makefile.PL" you will be prompted some questions.
+Other questions are the directories with header files and libraries.
+For example, of your file F<mysql.h> is in F</usr/include/mysql/mysql.h>,
+then enter the header directory F</usr>, likewise for
+F</usr/lib/mysql/libmysqlclient.a> or F</usr/lib/libmysqlclient.so>.
+
+
+=head1 WIN32 INSTALLATION
+
+If you are using ActivePerl, you may use ppm to install DBD-mysql.
+For Perl 5.6, upgrade to Build 623 or later, then it is sufficient
+to run
+
+ ppm install DBI
+ ppm install DBD::mysql
+
+If you need an HTTP proxy, you might need to set the environment
+variable http_proxy, for example like this:
+
+ set http_proxy=http://myproxy.com:8080/
+
+As of this writing, DBD::mysql is missing in the ActivePerl 5.8.0
+repository. However, Randy Kobes has kindly donated an own
+distribution and the following might succeed:
+
+ ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd
+
+Otherwise you definitely *need* a C compiler. And it *must* be the same
+compiler that was being used for compiling Perl itself. If you don't
+have a C compiler, the file README.win32 from the Perl source
+distribution tells you where to obtain freely distributable C compilers
+like egcs or gcc. The Perl sources are available via CPAN search
+
+ http://search.cpan.org
+
+I recommend using the win32clients package for installing DBD::mysql
+under Win32, available for download on www.tcx.se. The following steps
+have been required for me:
+
+=over
+
+=item -
+
+The current Perl versions (5.6, as of this writing) do have a problem
+with detecting the C libraries. I recommend to apply the following
+patch:
+
+ *** c:\Perl\lib\ExtUtils\Liblist.pm.orig Sat Apr 15 20:03:40 2000
+ --- c:\Perl\lib\ExtUtils\Liblist.pm Sat Apr 15 20:03:45 2000
+ ***************
+ *** 230,235 ****
+ --- 230,239 ----
+ # add "$Config{installarchlib}/CORE" to default search path
+ push @libpath, "$Config{installarchlib}/CORE";
+
+ + if ($VC and exists($ENV{LIB}) and defined($ENV{LIB})) {
+ + push(@libpath, split(/;/, $ENV{LIB}));
+ + }
+ +
+ foreach (Text::ParseWords::quotewords('\s+', 0, $potential_libs)){
+
+ $thislib = $_;
+
+=item -
+
+Extract sources into F<C:\>. This will create a directory F<C:\mysql>
+with subdirectories include and lib.
+
+IMPORTANT: Make sure this subdirectory is not shared by other TCX
+files! In particular do *not* store the MySQL server in the same
+directory. If the server is already installed in F<C:\mysql>,
+choose a location like F<C:\tmp>, extract the win32clients there.
+Note that you can remove this directory entirely once you have
+installed DBD::mysql.
+
+=item -
+
+Extract the DBD::mysql sources into another directory, for
+example F<C:\src\siteperl>
+
+=item -
+
+Open a DOS shell and change directory to F<C:\src\siteperl>.
+
+=item -
+
+The next step is only required if you repeat building the modules: Make
+sure that you have a clean build tree by running
+
+ nmake realclean
+
+If you don't have VC++, replace nmake with your flavour of make. If
+error messages are reported in this step, you may safely ignore them.
+
+=item -
+
+Run
+
+ perl Makefile.PL
+
+which will prompt you for some settings. The really important ones are:
+
+ Which DBMS do you want to use?
+
+enter a 1 here (MySQL only), and
+
+ Where is your mysql installed? Please tell me the directory that
+ contains the subdir include.
+
+where you have to enter the win32clients directory, for example
+F<C:\mysql> or F<C:\tmp\mysql>.
+
+=item -
+
+Continued in the usual way:
+
+ nmake
+ nmake install
+
+=back
+
+If you want to create a PPM package for the ActiveState Perl version, then
+modify the above steps as follows: Run
+
+ perl Makefile.PL NAME=DBD-mysql BINARY_LOCATION=DBD-mysql.tar.gz
+ nmake ppd
+ nmake
+
+Once that is done, use tar and gzip (for example those from the CygWin32
+distribution) to create an archive:
+
+ mkdir x86
+ tar cf x86/DBD-mysql.tar blib
+ gzip x86/DBD-mysql.tar
+
+Put the files x86/DBD-mysql.tar.gz and DBD-mysql.ppd onto some WWW server
+and install them by typing
+
+ install http://your.server.name/your/directory/DBD-mysql.ppd
+
+in the PPM program.
+
+
+=head1 AUTHORS
+
+The current version of B<DBD::mysql> is almost completely written
+by Jochen Wiedmann, and is now being maintained by
+Patrick Galbraith (I<patg@mysql.com>).
+The first version's author was Alligator Descartes, who was aided
+and abetted by Gary Shea, Andreas König and Tim Bunce amongst others.
+
+The B<Mysql> module was originally written by Andreas König
+<koenig@kulturbox.de>. The current version, mainly an emulation
+layer, is from Jochen Wiedmann.
+
+
+=head1 COPYRIGHT
+
+
+This module is
+Large Portions Copyright (c) 2004-2006 MySQL Patrick Galbraith, Alexey Stroganov,
+Large Portions Copyright (c) 2003-2005 Rudolf Lippan; Large Portions
+Copyright (c) 1997-2003 Jochen Wiedmann, with code portions
+Copyright (c)1994-1997 their original authors This module is
+released under the same license as Perl itself. See the Perl README
+for details.
+
+
+=head1 MAILING LIST SUPPORT
+
+This module is maintained and supported on a mailing list,
+
+ perl@lists.mysql.com
+
+To subscribe to this list, go to
+
+http://lists.mysql.com/perl?sub=1
+
+Mailing list archives are available at
+
+http://lists.mysql.com/perl
+
+Additionally you might try the dbi-user mailing list for questions about
+DBI and its modules in general. Subscribe via
+
+dbi-users-subscribe@perl.org
+
+Mailing list archives are at
+
+http://groups.google.com/group/perl.dbi.users?hl=en&lr=
+
+Also, the main DBI site is at
+
+http://dbi.perl.org/
+
+=head1 ADDITIONAL DBI INFORMATION
+
+Additional information on the DBI project can be found on the World
+Wide Web at the following URL:
+
+ http://dbi.perl.org
+
+where documentation, pointers to the mailing lists and mailing list
+archives and pointers to the most current versions of the modules can
+be used.
+
+Information on the DBI interface itself can be gained by typing:
+
+ perldoc DBI
+
+right now!
+
+
+=head1 BUG REPORTING, ENHANCEMENT/FEATURE REQUESTS
+
+Please report bugs, including all the information needed
+such as DBD::mysql version, MySQL version, OS type/version, etc
+to this link:
+
+http://bugs.mysql.com/
+
+
+=cut
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/lib/DBD/mysql/GetInfo.pm Tue Jul 20 23:33:58 2010 +0100
@@ -0,0 +1,306 @@
+package DBD::mysql::GetInfo;
+########################################
+# DBD::mysql::GetInfo
+#
+#
+# Generated by DBI::DBD::Metadata
+# $Author$ <-- the person to blame
+# $Revision$
+# $Date$
+
+use strict;
+use DBD::mysql;
+# Beware: not officially documented interfaces...
+# use DBI::Const::GetInfoType qw(%GetInfoType);
+# use DBI::Const::GetInfoReturn qw(%GetInfoReturnTypes %GetInfoReturnValues);
+
+my $sql_driver = 'mysql';
+my $sql_ver_fmt = '%02d.%02d.%04d'; # ODBC version string: ##.##.#####
+my $sql_driver_ver = do {
+ no warnings;
+ sprintf $sql_ver_fmt, split (/./, $DBD::mysql::VERSION);
+};
+
+my @Keywords = qw(
+
+BIGINT
+BLOB
+DEFAULT
+KEYS
+LIMIT
+LONGBLOB
+MEDIMUMBLOB
+MEDIUMINT
+MEDIUMTEXT
+PROCEDURE
+REGEXP
+RLIKE
+SHOW
+TABLES
+TINYBLOB
+TINYTEXT
+UNIQUE
+UNSIGNED
+ZEROFILL
+);
+
+
+sub sql_keywords {
+
+ return join ',', @Keywords;
+
+}
+
+
+
+sub sql_data_source_name {
+ my $dbh = shift;
+ return "dbi:$sql_driver:" . $dbh->{Name};
+}
+
+sub sql_user_name {
+ my $dbh = shift;
+ # Non-standard attribute
+ return $dbh->{CURRENT_USER};
+}
+
+
+####################
+# makefunc()
+# returns a ref to a sub that that calls into XS to get
+# values for info types that must needs be coded in C
+
+sub makefunk ($) {
+ my $type = shift;
+ return sub {dbd_mysql_get_info(shift, $type)}
+}
+
+
+
+
+our %info = (
+ 20 => 'N', # SQL_ACCESSIBLE_PROCEDURES
+ 19 => 'Y', # SQL_ACCESSIBLE_TABLES
+ 0 => 0, # SQL_ACTIVE_CONNECTIONS
+ 116 => 0, # SQL_ACTIVE_ENVIRONMENTS
+ 1 => 0, # SQL_ACTIVE_STATEMENTS
+ 169 => 127, # SQL_AGGREGATE_FUNCTIONS
+ 117 => 0, # SQL_ALTER_DOMAIN
+ 86 => 3, # SQL_ALTER_TABLE
+ 10021 => 0, # SQL_ASYNC_MODE
+ 120 => 2, # SQL_BATCH_ROW_COUNT
+ 121 => 2, # SQL_BATCH_SUPPORT
+ 82 => 0, # SQL_BOOKMARK_PERSISTENCE
+ 114 => 1, # SQL_CATALOG_LOCATION
+ 10003 => 'Y', # SQL_CATALOG_NAME
+ 41 => makefunk 41, # SQL_CATALOG_NAME_SEPARATOR
+ 42 => makefunk 42, # SQL_CATALOG_TERM
+ 92 => 29, # SQL_CATALOG_USAGE
+ 10004 => '', # SQL_COLLATING_SEQUENCE
+ 10004 => '', # SQL_COLLATION_SEQ
+ 87 => 'Y', # SQL_COLUMN_ALIAS
+ 22 => 0, # SQL_CONCAT_NULL_BEHAVIOR
+ 53 => 259071, # SQL_CONVERT_BIGINT
+ 54 => 0, # SQL_CONVERT_BINARY
+ 55 => 259071, # SQL_CONVERT_BIT
+ 56 => 259071, # SQL_CONVERT_CHAR
+ 57 => 259071, # SQL_CONVERT_DATE
+ 58 => 259071, # SQL_CONVERT_DECIMAL
+ 59 => 259071, # SQL_CONVERT_DOUBLE
+ 60 => 259071, # SQL_CONVERT_FLOAT
+ 48 => 0, # SQL_CONVERT_FUNCTIONS
+# 173 => undef, # SQL_CONVERT_GUID
+ 61 => 259071, # SQL_CONVERT_INTEGER
+ 123 => 0, # SQL_CONVERT_INTERVAL_DAY_TIME
+ 124 => 0, # SQL_CONVERT_INTERVAL_YEAR_MONTH
+ 71 => 0, # SQL_CONVERT_LONGVARBINARY
+ 62 => 259071, # SQL_CONVERT_LONGVARCHAR
+ 63 => 259071, # SQL_CONVERT_NUMERIC
+ 64 => 259071, # SQL_CONVERT_REAL
+ 65 => 259071, # SQL_CONVERT_SMALLINT
+ 66 => 259071, # SQL_CONVERT_TIME
+ 67 => 259071, # SQL_CONVERT_TIMESTAMP
+ 68 => 259071, # SQL_CONVERT_TINYINT
+ 69 => 0, # SQL_CONVERT_VARBINARY
+ 70 => 259071, # SQL_CONVERT_VARCHAR
+ 122 => 0, # SQL_CONVERT_WCHAR
+ 125 => 0, # SQL_CONVERT_WLONGVARCHAR
+ 126 => 0, # SQL_CONVERT_WVARCHAR
+ 74 => 1, # SQL_CORRELATION_NAME
+ 127 => 0, # SQL_CREATE_ASSERTION
+ 128 => 0, # SQL_CREATE_CHARACTER_SET
+ 129 => 0, # SQL_CREATE_COLLATION
+ 130 => 0, # SQL_CREATE_DOMAIN
+ 131 => 0, # SQL_CREATE_SCHEMA
+ 132 => 1045, # SQL_CREATE_TABLE
+ 133 => 0, # SQL_CREATE_TRANSLATION
+ 134 => 0, # SQL_CREATE_VIEW
+ 23 => 2, # SQL_CURSOR_COMMIT_BEHAVIOR
+ 24 => 2, # SQL_CURSOR_ROLLBACK_BEHAVIOR
+ 10001 => 0, # SQL_CURSOR_SENSITIVITY
+ 2 => \&sql_data_source_name, # SQL_DATA_SOURCE_NAME
+ 25 => 'N', # SQL_DATA_SOURCE_READ_ONLY
+ 119 => 7, # SQL_DATETIME_LITERALS
+ 17 => 'MySQL', # SQL_DBMS_NAME
+ 18 => makefunk 18, # SQL_DBMS_VER
+ 170 => 3, # SQL_DDL_INDEX
+ 26 => 2, # SQL_DEFAULT_TRANSACTION_ISOLATION
+ 26 => 2, # SQL_DEFAULT_TXN_ISOLATION
+ 10002 => 'N', # SQL_DESCRIBE_PARAMETER
+# 171 => undef, # SQL_DM_VER
+ 3 => 137076632, # SQL_DRIVER_HDBC
+# 135 => undef, # SQL_DRIVER_HDESC
+ 4 => 137076088, # SQL_DRIVER_HENV
+# 76 => undef, # SQL_DRIVER_HLIB
+# 5 => undef, # SQL_DRIVER_HSTMT
+ 6 => 'libmyodbc3.so', # SQL_DRIVER_NAME
+ 77 => '03.51', # SQL_DRIVER_ODBC_VER
+ 7 => $sql_driver_ver, # SQL_DRIVER_VER
+ 136 => 0, # SQL_DROP_ASSERTION
+ 137 => 0, # SQL_DROP_CHARACTER_SET
+ 138 => 0, # SQL_DROP_COLLATION
+ 139 => 0, # SQL_DROP_DOMAIN
+ 140 => 0, # SQL_DROP_SCHEMA
+ 141 => 7, # SQL_DROP_TABLE
+ 142 => 0, # SQL_DROP_TRANSLATION
+ 143 => 0, # SQL_DROP_VIEW
+ 144 => 0, # SQL_DYNAMIC_CURSOR_ATTRIBUTES1
+ 145 => 0, # SQL_DYNAMIC_CURSOR_ATTRIBUTES2
+ 27 => 'Y', # SQL_EXPRESSIONS_IN_ORDERBY
+ 8 => 63, # SQL_FETCH_DIRECTION
+ 84 => 0, # SQL_FILE_USAGE
+ 146 => 97863, # SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1
+ 147 => 6016, # SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
+ 81 => 11, # SQL_GETDATA_EXTENSIONS
+ 88 => 3, # SQL_GROUP_BY
+ 28 => 4, # SQL_IDENTIFIER_CASE
+ #29 => sub {dbd_mysql_get_info(shift,$GetInfoType {SQL_IDENTIFIER_QUOTE_CHAR})},
+ 29 => makefunk 29, # SQL_IDENTIFIER_QUOTE_CHAR
+ 148 => 0, # SQL_INDEX_KEYWORDS
+ 149 => 0, # SQL_INFO_SCHEMA_VIEWS
+ 172 => 7, # SQL_INSERT_STATEMENT
+ 73 => 'N', # SQL_INTEGRITY
+ 150 => 0, # SQL_KEYSET_CURSOR_ATTRIBUTES1
+ 151 => 0, # SQL_KEYSET_CURSOR_ATTRIBUTES2
+ 89 => \&sql_keywords, # SQL_KEYWORDS
+ 113 => 'Y', # SQL_LIKE_ESCAPE_CLAUSE
+ 78 => 0, # SQL_LOCK_TYPES
+ 34 => 64, # SQL_MAXIMUM_CATALOG_NAME_LENGTH
+ 97 => 0, # SQL_MAXIMUM_COLUMNS_IN_GROUP_BY
+ 98 => 32, # SQL_MAXIMUM_COLUMNS_IN_INDEX
+ 99 => 0, # SQL_MAXIMUM_COLUMNS_IN_ORDER_BY
+ 100 => 0, # SQL_MAXIMUM_COLUMNS_IN_SELECT
+ 101 => 0, # SQL_MAXIMUM_COLUMNS_IN_TABLE
+ 30 => 64, # SQL_MAXIMUM_COLUMN_NAME_LENGTH
+ 1 => 0, # SQL_MAXIMUM_CONCURRENT_ACTIVITIES
+ 31 => 18, # SQL_MAXIMUM_CURSOR_NAME_LENGTH
+ 0 => 0, # SQL_MAXIMUM_DRIVER_CONNECTIONS
+ 10005 => 64, # SQL_MAXIMUM_IDENTIFIER_LENGTH
+ 102 => 500, # SQL_MAXIMUM_INDEX_SIZE
+ 104 => 0, # SQL_MAXIMUM_ROW_SIZE
+ 32 => 0, # SQL_MAXIMUM_SCHEMA_NAME_LENGTH
+ 105 => makefunk 105, # SQL_MAXIMUM_STATEMENT_LENGTH
+# 20000 => undef, # SQL_MAXIMUM_STMT_OCTETS
+# 20001 => undef, # SQL_MAXIMUM_STMT_OCTETS_DATA
+# 20002 => undef, # SQL_MAXIMUM_STMT_OCTETS_SCHEMA
+ 106 => makefunk 106, # SQL_MAXIMUM_TABLES_IN_SELECT
+ 35 => 64, # SQL_MAXIMUM_TABLE_NAME_LENGTH
+ 107 => 16, # SQL_MAXIMUM_USER_NAME_LENGTH
+ 10022 => 0, # SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
+ 112 => 0, # SQL_MAX_BINARY_LITERAL_LEN
+ 34 => 64, # SQL_MAX_CATALOG_NAME_LEN
+ 108 => 0, # SQL_MAX_CHAR_LITERAL_LEN
+ 97 => 0, # SQL_MAX_COLUMNS_IN_GROUP_BY
+ 98 => 32, # SQL_MAX_COLUMNS_IN_INDEX
+ 99 => 0, # SQL_MAX_COLUMNS_IN_ORDER_BY
+ 100 => 0, # SQL_MAX_COLUMNS_IN_SELECT
+ 101 => 0, # SQL_MAX_COLUMNS_IN_TABLE
+ 30 => 64, # SQL_MAX_COLUMN_NAME_LEN
+ 1 => 0, # SQL_MAX_CONCURRENT_ACTIVITIES
+ 31 => 18, # SQL_MAX_CURSOR_NAME_LEN
+ 0 => 0, # SQL_MAX_DRIVER_CONNECTIONS
+ 10005 => 64, # SQL_MAX_IDENTIFIER_LEN
+ 102 => 500, # SQL_MAX_INDEX_SIZE
+ 32 => 0, # SQL_MAX_OWNER_NAME_LEN
+ 33 => 0, # SQL_MAX_PROCEDURE_NAME_LEN
+ 34 => 64, # SQL_MAX_QUALIFIER_NAME_LEN
+ 104 => 0, # SQL_MAX_ROW_SIZE
+ 103 => 'Y', # SQL_MAX_ROW_SIZE_INCLUDES_LONG
+ 32 => 0, # SQL_MAX_SCHEMA_NAME_LEN
+ 105 => 8192, # SQL_MAX_STATEMENT_LEN
+ 106 => 31, # SQL_MAX_TABLES_IN_SELECT
+ 35 => makefunk 35, # SQL_MAX_TABLE_NAME_LEN
+ 107 => 16, # SQL_MAX_USER_NAME_LEN
+ 37 => 'Y', # SQL_MULTIPLE_ACTIVE_TXN
+ 36 => 'Y', # SQL_MULT_RESULT_SETS
+ 111 => 'N', # SQL_NEED_LONG_DATA_LEN
+ 75 => 1, # SQL_NON_NULLABLE_COLUMNS
+ 85 => 2, # SQL_NULL_COLLATION
+ 49 => 16777215, # SQL_NUMERIC_FUNCTIONS
+ 9 => 1, # SQL_ODBC_API_CONFORMANCE
+ 152 => 2, # SQL_ODBC_INTERFACE_CONFORMANCE
+ 12 => 1, # SQL_ODBC_SAG_CLI_CONFORMANCE
+ 15 => 1, # SQL_ODBC_SQL_CONFORMANCE
+ 73 => 'N', # SQL_ODBC_SQL_OPT_IEF
+ 10 => '03.80', # SQL_ODBC_VER
+ 115 => 123, # SQL_OJ_CAPABILITIES
+ 90 => 'Y', # SQL_ORDER_BY_COLUMNS_IN_SELECT
+ 38 => 'Y', # SQL_OUTER_JOINS
+ 115 => 123, # SQL_OUTER_JOIN_CAPABILITIES
+ 39 => '', # SQL_OWNER_TERM
+ 91 => 0, # SQL_OWNER_USAGE
+ 153 => 2, # SQL_PARAM_ARRAY_ROW_COUNTS
+ 154 => 3, # SQL_PARAM_ARRAY_SELECTS
+ 80 => 3, # SQL_POSITIONED_STATEMENTS
+ 79 => 31, # SQL_POS_OPERATIONS
+ 21 => 'N', # SQL_PROCEDURES
+ 40 => '', # SQL_PROCEDURE_TERM
+ 114 => 1, # SQL_QUALIFIER_LOCATION
+ 41 => '.', # SQL_QUALIFIER_NAME_SEPARATOR
+ 42 => 'database', # SQL_QUALIFIER_TERM
+ 92 => 29, # SQL_QUALIFIER_USAGE
+ 93 => 3, # SQL_QUOTED_IDENTIFIER_CASE
+ 11 => 'N', # SQL_ROW_UPDATES
+ 39 => '', # SQL_SCHEMA_TERM
+ 91 => 0, # SQL_SCHEMA_USAGE
+ 43 => 7, # SQL_SCROLL_CONCURRENCY
+ 44 => 17, # SQL_SCROLL_OPTIONS
+ 14 => '\\', # SQL_SEARCH_PATTERN_ESCAPE
+ 13 => makefunk 13, # SQL_SERVER_NAME
+ 94 => 'ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúñÑ', # SQL_SPECIAL_CHARACTERS
+ 155 => 7, # SQL_SQL92_DATETIME_FUNCTIONS
+ 156 => 0, # SQL_SQL92_FOREIGN_KEY_DELETE_RULE
+ 157 => 0, # SQL_SQL92_FOREIGN_KEY_UPDATE_RULE
+ 158 => 8160, # SQL_SQL92_GRANT
+ 159 => 0, # SQL_SQL92_NUMERIC_VALUE_FUNCTIONS
+ 160 => 0, # SQL_SQL92_PREDICATES
+ 161 => 466, # SQL_SQL92_RELATIONAL_JOIN_OPERATORS
+ 162 => 32640, # SQL_SQL92_REVOKE
+ 163 => 7, # SQL_SQL92_ROW_VALUE_CONSTRUCTOR
+ 164 => 255, # SQL_SQL92_STRING_FUNCTIONS
+ 165 => 0, # SQL_SQL92_VALUE_EXPRESSIONS
+ 118 => 4, # SQL_SQL_CONFORMANCE
+ 166 => 2, # SQL_STANDARD_CLI_CONFORMANCE
+ 167 => 97863, # SQL_STATIC_CURSOR_ATTRIBUTES1
+ 168 => 6016, # SQL_STATIC_CURSOR_ATTRIBUTES2
+ 83 => 7, # SQL_STATIC_SENSITIVITY
+ 50 => 491519, # SQL_STRING_FUNCTIONS
+ 95 => 0, # SQL_SUBQUERIES
+ 51 => 7, # SQL_SYSTEM_FUNCTIONS
+ 45 => 'table', # SQL_TABLE_TERM
+ 109 => 0, # SQL_TIMEDATE_ADD_INTERVALS
+ 110 => 0, # SQL_TIMEDATE_DIFF_INTERVALS
+ 52 => 106495, # SQL_TIMEDATE_FUNCTIONS
+ 46 => 3, # SQL_TRANSACTION_CAPABLE
+ 72 => 15, # SQL_TRANSACTION_ISOLATION_OPTION
+ 46 => 3, # SQL_TXN_CAPABLE
+ 72 => 15, # SQL_TXN_ISOLATION_OPTION
+ 96 => 0, # SQL_UNION
+ 96 => 0, # SQL_UNION_STATEMENT
+ 47 => \&sql_user_name, # SQL_USER_NAME
+ 10000 => 1992, # SQL_XOPEN_CLI_YEAR
+);
+
+1;
+
+__END__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/lib/DBD/mysql/INSTALL.pod Tue Jul 20 23:33:58 2010 +0100
@@ -0,0 +1,801 @@
+=head1 NAME
+
+INSTALL - How to install and configure DBD::mysql
+
+
+=head1 SYNOPSIS
+
+ perl Makefile.PL [options]
+ make
+ make test
+ make install
+
+
+=head1 DESCRIPTION
+
+This document describes the installation and configuration of
+DBD::mysql, the Perl DBI driver for the MySQL database. Before
+reading on, make sure that you have the prerequisites available:
+Perl, MySQL and DBI. For details see the separate section.
+L</PREREQUISITES>.
+
+Depending on your version of Perl, it might be possible to
+use a binary distribution of DBD::mysql. If possible, this is
+recommended. Otherwise you need to install from the sources.
+If so, you will definitely need a C compiler. Installation
+from binaries and sources are both described in separate
+sections. L<BINARY INSTALLATION>. L<SOURCE INSTALLATION>.
+
+Finally, if you encounter any problems, do not forget to
+read the section on known problems. L<KNOWN PROBLEMS>. If
+that doesn't help, you should look into the archive of the
+mailing list B<perl@lists.mysql.com>. See
+http://www.mysql.com for archive locations. And if that
+still doesn't help, please post a question on this mailing
+list.
+
+
+=head1 PREREQUISITES
+
+=over
+
+=item Perl
+
+Preferrably a version of Perl, that comes preconfigured with
+your system. For example, all Linux and FreeBSD distributions
+come with Perl. For Windows, ActivePerl is recommended, see
+http://www.activestate.com for details.
+
+=item MySQL
+
+You need not install the actual MySQL database server, the
+client files and the devlopment files are sufficient. For
+example, Fedora Core 4 Linux distribution comes with RPM files
+(using YUM) B<mysql.i386> and B<mysql-server.i386> (use "yum search"
+to find exact package names). These are sufficient, if the MySQL
+server is located on a foreign machine. You may also create client
+files by compiling from the MySQL source distribution and using
+
+ configure --without-server
+
+If you are using Windows and need to compile from sources
+(which is only the case if you are not using ActivePerl),
+then you must ensure that the header and library files are
+installed. This may require choosing a "Custom installation"
+and selecting the appropriate option when running the
+MySQL setup program.
+
+=item DBI
+
+DBD::mysql is a DBI driver, hence you need DBI. It is available
+from the same source where you got the DBD::mysql distribution
+from.
+
+=item C compiler
+
+A C compiler is only required, if you install from source. In
+most cases there are binary distributions of DBD::mysql
+available. However, if you need a C compiler, make sure, that
+it is the same C compiler that was used for compiling Perl and
+MySQL! Otherwise you will almost definitely encounter problems
+because of differences in the underlying C runtime libraries.
+
+In the worst case, this might mean to compile Perl and MySQL
+yourself. But believe me, experience shows that a lot of problems
+are fixed this way.
+
+=item Gzip libraries
+
+Late versions of MySQL come with support for compression. Thus
+it B<may> be required that you have install an RPM package like
+libz-devel, libgz-devel or something similar.
+
+=back
+
+
+=head1 BINARY INSTALLATION
+
+Binary installation is possible in the most cases, depending
+on your system. I give some examples:
+
+
+=head2 Windows
+
+ActivePerl offers a PPM archive of DBD::mysql. All you need to
+do is typing
+
+ ppm
+ install DBI
+ install DBD-mysql
+
+This will fetch the modules via HTTP and install them. If you
+need to use a WWW proxy server, the environment variable
+HTTP_proxy must be set:
+
+ set HTTP_proxy=http://my.proxy.server:8000/
+ ppm
+ install DBI
+ install DBD-mysql
+
+Of course you need to replace the host name C<my.proxy.server>
+and the port number C<8000> with your local values.
+
+If the above procedure doesn't work, please upgrade to the latest
+version of ActivePerl. Versions before build 623 are known to
+have problems.
+
+PPM 3 is said to miss DBD::mysql in the repository. Thus use of
+PPM 3 is discouraged, in favour of PPM 2. If you need to use
+PPM 3, try
+
+ ppm
+ rep add PPM2 http://ppm.activestate.com/PPMPackages/5.6plus/
+ rep 2
+ install DBI
+ install DBD-mysql
+
+
+
+=head2 Red Hat Linux
+
+As of version 7.1, Red Hat Linux comes with MySQL and DBD::mysql.
+You need to ensure that the following RPM's are installed:
+
+ mysql
+ perl-DBI
+ perl-DBD-MySQL
+
+For installation from source the following RPM's are required
+
+ mysql-devel
+ libz-devel
+
+Optional are
+
+ mysql-server
+
+=head2 Fedora Core Linux
+
+As of version 3, Fedora Linux comes with MySQL and DBD::mysql.
+You need to ensure that the following RPM's are installed:
+
+ mysql or mysql-server
+ perl-DBD-MySQL
+
+For installation from source the following RPM's are required
+
+ mysql-devel
+ libz-devel
+
+Please try
+
+ yum search mysql
+
+To see the exact names
+
+Note: (important) FC 3 comes with MySQL 3.x, and some people have
+upgraded using MySQL RPMs for newer versions. If you do this, you
+must re-compile you DBD::mysql because your existing DBD::mysql will be
+linked against the old version of MySQL's client libs. CPAN has no way to
+know or detect that you have upgraded MySQL.
+
+=head2 Other systems
+
+In the case of Linux or FreeBSD distributions it is very likely
+that all you need comes with your distribution, as in the case
+of Red Hat Linux. I just cannot give you names, as I am not using
+these systems.
+
+Please let me know if you find the files in your SuSE Linux, Debian
+Linux or FreeBSD distribution so that I can extend the above list.
+
+
+=head1 SOURCE INSTALLATION
+
+So you need to install from sources. If you are lucky, the Perl
+module C<CPAN> will do all for you, thanks to the excellent work
+of Andreas Koenig. Otherwise you will need to do a manual
+installation. Some of you, in particular system administrators
+of multiple sites, will choose automatic installation. All of
+these installation types have an own section. L</CPAN installation>.
+L</Manual installation>. L</Configuration>.
+
+The DBD::mysql Makefile.PL needs to know where to find your MySQL
+installation. This may be achieved using command line switches
+(see L</Configuration>) or automatically using the mysql_config binary
+which comes with most MySQL distributions. If your MySQL distribution
+contains mysql_config the easiest method is to ensure this binary
+is on your path.
+
+e.g.
+
+ PATH=$PATH:/usr/local/mysql/bin
+ export PATH
+
+
+=head2 CPAN installation
+
+Installation of DBD::mysql can be incredibly easy:
+
+ cpan
+ install DBD::mysql
+
+If you are using the CPAN module for the first time, just answer
+the questions by accepting the defaults which are fine in most
+cases. If you are using an older version of Perl, you might
+instead need a
+
+ perl -MCPAN -e shell
+ install DBD::mysql
+
+If you cannot get the CPAN module working, you might try manual
+installation. If installation with CPAN fails because the your local
+settings have been guessed wrong, you need to ensure MySQL's
+mysql_config is on your path (see L</SOURCE INSTALLATION>) or
+alternatively create a script called C<mysql_config>. This is
+described in more details later. L</Configuration>.
+
+
+=head2 Manual installation
+
+For a manual installation you need to fetch the DBD::mysql
+source distribution. The latest version is always available
+from
+
+ http://www.cpan.org/modules/by-module/DBD/
+
+The name is typically something like
+
+ DBD-mysql-1.2216.tar.gz
+
+The archive needs to be extracted. On Windows you may use a tool
+like WinZip, on Unix you type
+
+ gzip -cd DBD-mysql-1.2216.tar.gz | tar xf -
+
+This will create a subdirectory DBD-mysql-1.2216. Enter this
+subdirectory and type
+
+ perl Makefile.PL
+ make
+ make test
+
+(On Windows you may need to replace "make" with "nmake" or
+"dmake".) If the tests seem to look fine, you may continue with
+
+ make install
+
+If the compilation (make) or tests fail, you might need to
+configure some settings.
+
+For example you might choose a different database, the C
+compiler or the linker might need some flags. L</Configuration>.
+L</Compiler flags>. L</Linker flags>.
+
+For Windows/CygWin there is a special section below.
+L<Windows/CygWin>.
+
+
+=head2 Configuration
+
+The install script "Makefile.PL" can be configured via a lot of
+switches. All switches can be used on the command line. For
+example, the test database:
+
+ perl Makefile.PL --testdb=<db>
+
+If you do not like configuring these switches on the command
+line, you may alternatively create a script called C<mysql_config>.
+This is described later on.
+
+Available switches are:
+
+=over
+
+=item testdb
+
+Name of the test database, defaults to B<test>.
+
+=item testuser
+
+Name of the test user, defaults to empty. If the name is empty,
+then the currently logged in users name will be used.
+
+=item testpassword
+
+Password of the test user, defaults to empty.
+
+=item testhost
+
+Host name or IP number of the test database; defaults to localhost.
+
+=item testport
+
+Port number of the test database
+
+=item ps-protcol=1 or 0
+
+Whether to run the test suite using server prepared statements or driver
+emulated prepared statemetns. ps-protocol=1 means use server prepare,
+ps-protocol=0 means driver emulated.
+
+=item cflags
+
+This is a list of flags that you want to give to the C compiler.
+The most important flag is the location of the MySQL header files.
+For example, on Red Hat Linux the header files are in /usr/include/mysql
+and you might try
+
+ -I/usr/include/mysql
+
+On Windows the header files may be in C:\mysql\include and you might try
+
+ -IC:\mysql\include
+
+The default flags are determined by running
+
+ mysql_config --cflags
+
+More details on the C compiler flags can be found in the following
+section. L</Compiler flags>.
+
+=item libs
+
+This is a list of flags that you want to give to the linker
+or loader. The most important flags are the locations and names
+of additional libraries. For example, on Red Hat Linux your
+MySQL client libraries are in /usr/lib/mysql and you might try
+
+ -L/usr/lib/mysql -lmysqlclient -lz
+
+On Windows the libraries may be in C:\mysql\lib and
+
+ -LC:\mysql\lib -lmysqlclient
+
+might be a good choice. The default flags are determined by running
+
+ mysql_config --libs
+
+More details on the linker flags can be found in a separate section.
+L<Linker flags>.
+
+=back
+
+If a switch is not present on the command line, then the
+script C<mysql_config> will be executed. This script comes
+as part of the MySQL distribution. For example, to determine
+the C compiler flags, we are executing
+
+ mysql_config --cflags
+ mysql_config --libs
+
+If you want to configure your own settings for database name,
+database user and so on, then you have to create a script with
+the same name, that replies
+
+
+=head2 Compiler flags
+
+Note: the folling info about compiler and linker flags, you shouldn't have
+to use these options because Makefile.PL is pretty good at utilising
+mysql_config to get the flags that you need for a successful compile.
+
+It is typically not so difficult to determine the appropriate
+flags for the C compiler. The linker flags, which you find in
+the next section, are another story.
+
+The determination of the C compiler flags is usually left to
+a configuration script called F<mysql_config>, which can be
+invoked with
+
+ mysql_config --cflags
+
+When doing so, it will emit a line with suggested C compiler
+flags, for example like this:
+
+ -L/usr/include/mysql
+
+The C compiler must find some header files. Header files have
+the extension C<.h>. MySQL header files are, for example,
+F<mysql.h> and F<mysql_version.h>. In most cases the header
+files are not installed by default. For example, on Windows
+it is an installation option of the MySQL setup program
+(Custom installation), whether the header files are installed
+or not. On Red Hat Linux, you need to install an RPM archive
+F<mysql-devel> or F<MySQL-devel>.
+
+If you know the location of the header files, then you will
+need to add an option
+
+ -L<header directory>
+
+to the C compiler flags, for example C<-L/usr/include/mysql>.
+
+
+=head2 Linker flags
+
+Appropriate linker flags are the most common source of problems
+while installing DBD::mysql. I will only give a rough overview,
+you'll find more details in the troubleshooting section.
+L<KNOWN PROBLEMS>
+
+The determination of the C compiler flags is usually left to
+a configuration script called F<mysql_config>, which can be
+invoked with
+
+ mysql_config --libs
+
+When doing so, it will emit a line with suggested C compiler
+flags, for example like this:
+
+ -L'/usr/lib/mysql' -lmysqlclient -lnsl -lm -lz -lcrypt
+
+The following items typically need to be configured for the
+linker:
+
+=over
+
+=item The mysqlclient library
+
+The MySQL client library comes as part of the MySQL distribution.
+Depending on your system it may be a file called
+
+ F<libmysqlclient.a> statically linked library, Unix
+ F<libmysqlclient.so> dynamically linked library, Unix
+ F<mysqlclient.lib> statically linked library, Windows
+ F<mysqlclient.dll> dynamically linked library, Windows
+
+or something similar.
+
+As in the case of the header files, the client library is typically
+not installed by default. On Windows you will need to select them
+while running the MySQL setup program (Custom installation). On
+Red Hat Linux an RPM archive F<mysql-devel> or F<MySQL-devel> must
+be installed.
+
+The linker needs to know the location and name of the mysqlclient
+library. This can be done by adding the flags
+
+ -L<lib directory> -lmysqlclient
+
+or by adding the complete path name. Examples:
+
+ -L/usr/lib/mysql -lmysqlclient
+ -LC:\mysql\lib -lmysqlclient
+
+If you would like to use the static libraries (and there are
+excellent reasons to do so), you need to create a separate
+directory, copy the static libraries to that place and use
+the -L switch above to point to your new directory. For example:
+
+ mkdir /tmp/mysql-static
+ cp /usr/lib/mysql/*.a /tmp/mysql-static
+ perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient"
+ make
+ make test
+ make install
+ rm -rf /tmp/mysql-static
+
+
+=item The gzip library
+
+The MySQL client can use compression when talking to the MySQL
+server, a nice feature when sending or receiving large texts over
+a slow network.
+
+On Unix you typically find the appropriate file name by running
+
+ ldconfig -p | grep libz
+ ldconfig -p | grep libgz
+
+Once you know the name (libz.a or libgz.a is best), just add it
+to the list of linker flags. If this seems to be causing problem
+you may also try to link without gzip libraries.
+
+=back
+
+
+=head1 SPECIAL SYSTEMS
+
+Below you find information on particular systems:
+
+
+=head2 Windows/CygWin
+
+If you are a user of Cygwin (the Redhat distribution) you already
+know, it contains a nicely running perl 5.6.1, installation of
+additional modules usually works as a charme via the standard
+procedure of
+
+ perl makefile.PL
+ make
+ make test
+ make install
+
+The Windows binary distribution of MySQL runs smoothly under Cygwin.
+You can start/stop the server and use all Windows clients without problem.
+But to install DBD::mysql you have to take a little special action.
+
+Don't attempt to build DBD::mysql against either the MySQL Windows or
+Linux/Unix BINARY distributions: neither will work!
+
+You MUST compile the MySQL clients yourself under Cygwin, to get a
+'libmysqlclient.a' compiled under Cygwin. Really! You'll only need
+that library and the header files, you don't need any other client parts.
+Continue to use the Windows binaries. And don't attempt (currently) to
+build the MySQL Server part, it is unneccessary, as MySQL AB does an
+excellent job to deliver optimized binaries for the mainstream
+operating systems, and it is told, that the server compiled under Cygwin is
+unstable.
+
+Install MySQL (if you havn't already)
+
+=over
+
+=item -
+
+download the MySQL Windows Binaries from
+http://www.mysql.com/downloads/index.html
+
+=item -
+
+unzip mysql-<version>-win.zip into some temporary location
+
+=item -
+
+start the setup.exe there and follow the instructions
+
+=item -
+
+start the server
+
+=item -
+
+alternatively download, install and start the server on a remote
+server, on what supported OS ever
+
+=back
+
+
+Build MySQL clients under Cygwin:
+
+=over
+
+=item -
+
+download the MySQL LINUX source from
+http://www.mysql.com/downloads/index.html
+
+=item -
+
+unpack mysql-<version>.tar.gz into some tmp location
+
+=item -
+
+cd into the unpacked dir mysql-<version>
+
+ ./configure --prefix=/usr/local/mysql --without-server
+
+This prepares the Makefile with the installed Cygwin features. It
+takes some time, but should finish without error. The 'prefix', as
+given, installs the whole Cygwin/MySQL thingy into a location not
+normally in your PATH, so that you continue to use already installed
+Windows binaries. The --without-server parameter tells configure to
+only build the clients.
+
+=item -
+
+ make
+
+This builds all MySQL client parts ... be patient. It should finish
+finally without any error.
+
+=item -
+
+ make install
+
+This installs the compiled client files under /usr/local/mysql/.
+Remember, you don't need anything except the library under
+/usr/local/mysql/lib and the headers under /usr/local/mysql/include!
+
+Essentially you are now done with this part. If you want, you may try
+your compiled binaries shortly; for that, do:
+
+=item -
+
+ cd /usr/local/mysql/bin
+ ./mysql -h 127.0.0.1
+
+The host (-h) parameter 127.0.0.1 targets the local host, but forces
+the mysql client to use a TCP/IP connection. The default would be a
+pipe/socket connection (even if you say '-h localhost') and this
+doesn't work between Cygwin and Windows (as far as I know).
+
+If you have your MySQL server running on some other box, then please
+substitute '127.0.0.1' with the name or IP-number of that box.
+
+=back
+
+Please note, in my environment the 'mysql' client did not accept a
+simple RETURN, I had to use CTRL-RETURN to send commands
+... strange,
+but I didn't attempt to fix that, as we are only interested in the
+built lib and headers.
+
+At the 'mysql>' prompt do a quick check:
+
+ mysql> use mysql
+ mysql> show tables;
+ mysql> select * from db;
+ mysql> exit
+
+You are now ready to build DBD::mysql!
+
+
+Build DBD::mysql:
+
+=over
+
+=item -
+
+download DBD-mysql-<version>.tar.gz from CPAN
+
+=item -
+
+unpack DBD-mysql-<version>.tar.gz
+
+=item -
+
+cd into unpacked dir DBD-mysql-<version>
+you probably did that already, if you are reading this!
+
+=item -
+
+ cp /usr/local/mysql/bin/mysql_config .
+
+This copies the executable script mentioned in the DBD::mysql docs
+from your just built Cywin/MySQL client directory; it knows about
+your Cygwin installation, especially about the right libraries to link
+with.
+
+=item -
+
+ perl Makefile.PL --testhost=127.0.0.1
+
+The --testhost=127.0.0.1 parameter again forces a TCP/IP connection
+to the MySQL server on the local host instead of a pipe/socket
+connection for the 'make test' phase.
+
+=item -
+
+ make
+
+This should run without error
+
+=item -
+
+ make test
+
+with DBD-mysql-2.1022 or earlier you will see several errors in
+dbdadmin.t, mysql.t and mysql2.t; with later versions you should not
+get errors (except possibly one, indicating, that some tables could
+not be dropped. I'm hunting for a solution to that problem, but have
+none yet).
+
+=item -
+
+ make install
+
+This installs DBD::mysql into the Perl hierarchy.
+
+=back
+
+Notes:
+
+This was tested with MySQL version 3.23.54a and DBD::mysql version
+2.1022. I patched the above mentioned test scripts and sent the
+patches
+to the author of DBD::mysql Jochen Wiedman.
+
+Georg Rehfeld 15. Jan. 2003
+
+
+=head1 KNOWN PROBLEMS
+
+=over
+
+=item 1.)
+
+Some Linux distributions don't come with a gzip library by default.
+Running "make" terminates with an error message like
+
+ LD_RUN_PATH="/usr/lib/mysql:/lib:/usr/lib" gcc
+ -o blib/arch/auto/DBD/mysql/mysql.so -shared
+ -L/usr/local/lib dbdimp.o mysql.o -L/usr/lib/mysql
+ -lmysqlclient -lm -L/usr/lib/gcc-lib/i386-redhat-linux/2.96
+ -lgcc -lz
+ /usr/bin/ld: cannot find -lz
+ collect2: ld returned 1 exit status
+ make: *** [blib/arch/auto/DBD/mysql/mysql.so] Error 1
+
+If this is the case for you, install an RPM archive like
+libz-devel, libgz-devel, zlib-devel or gzlib-devel or something
+similar.
+
+=item 2.)
+
+If Perl was compiled with gcc or egcs, but MySQL was compiled
+with another compiler or on another system, an error message like
+this is very likely when running "Make test":
+
+ t/00base............install_driver(mysql) failed: Can't load
+ '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql:
+ ../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: _umoddi3
+ at /usr/local/perl-5.005/lib/5.005/i586-linux-thread/DynaLoader.pm
+ line 168.
+
+This means, that your linker doesn't include libgcc.a. You have
+the following options:
+
+The solution is telling the linker to use libgcc. Run
+
+ gcc --print-libgcc-file
+
+to determine the exact location of libgcc.a or for older versions
+of gcc
+
+ gcc -v
+
+to determine the directory. If you know the directory, add a
+
+ -L<directory> -lgcc
+
+to the list of C compiler flags. L</Configuration>. L</Linker flags>.
+
+=item 3.)
+
+There are known problems with shared versions of libmysqlclient,
+at least on some Linux boxes. If you receive an error message
+similar to
+
+ install_driver(mysql) failed: Can't load
+ '/usr/lib/perl5/site_perl/i586-linux/auto/DBD/mysql/mysql.so'
+ for module DBD::mysql: File not found at
+ /usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166
+
+then this error message can be misleading: It's not mysql.so
+that fails being loaded, but libmysqlclient.so! The usual
+problem is that this file is located in a directory like
+
+ /usr/lib/mysql
+
+where the linker doesn't look for it.
+
+The best workaround is using a statically linked mysqlclient
+library, for example
+
+ /usr/lib/mysql/libmysqlclient.a
+
+The use of a statically linked library is described in the
+previous section on linker flags. L</Configuration>.
+L</Linker flags>.
+
+=item 4.)
+
+Red Hat 8 & 9 set the Default locale to UTF which causes problems with
+MakeMaker. To build DBD::mysql on these systems, do a 'unset LANG'
+before runing 'perl Makefile.PL'
+
+=back
+
+
+=head1 SUPPORT
+
+Finally, if everything else fails, you are not alone. First of
+all, for an immediate answer, you should look into the archives
+of the mailing list B<perl@lists.mysql.com>. See
+http://www.mysql.com for archive locations.
+
+If you don't find an appropriate posting and reply in the
+mailing list, please post a question. Typically a reply will
+be seen within one or two days.
Binary file common/tools/lib/auto/DBD/mysql/libmysql.dll has changed
Binary file common/tools/lib/auto/DBD/mysql/mysql.dll has changed
Binary file common/tools/lib/auto/DBD/mysql/mysql.exp has changed
Binary file common/tools/lib/auto/DBD/mysql/mysql.lib has changed
--- a/common/tools/uh2diamonds.pl Thu Jul 08 18:13:52 2010 +0100
+++ b/common/tools/uh2diamonds.pl Tue Jul 20 23:33:58 2010 +0100
@@ -18,6 +18,7 @@
my $input = "\\output\\logs\\html\\index.html";
my $output = "\\output\\logs\\diamonds_uh.xml";
+my $bit_output = "\\output\\logs\\bitinfo.txt";
my $help = 0;
GetOptions((
'in=s' => \$input,
@@ -87,4 +88,13 @@
else
{
warn "Could not write to file: $output\n";
+}
+
+if (open(BITINFO, ">>$bit_output"))
+{
+ print BITINFO "failure\tmissing,$missing\n";
+ print BITINFO "failure\tminor,$minor\n";
+ print BITINFO "failure\tmajor,$major\n";
+ print BITINFO "failure\tcritical,$critical\n";
+ close(BITINFO);
}
\ No newline at end of file
--- a/sf-package/build.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/sf-package/build.xml Tue Jul 20 23:33:58 2010 +0100
@@ -58,7 +58,7 @@
<arg line="-t ${sf.spec.sbs.retry.limit}"/>
<arg line="${sf.spec.sbs.options}"/>
<arg name="--filters" value=""${sf.spec.sbs.filter.list}""/>
- <arg name="--logfile" value="${compile.log.dir}/${build.id}_@{item.sbs.splitconfig}_compile.log" />
+ <arg name="--logfile" value="${build.log.dir}/${build.id}_@{item.sbs.splitconfig}_compile.log" />
<arg name="--makefile" value="${compile.log.dir}/${build.id}_@{item.sbs.splitconfig}_Makefile" />
</sbsOptions>
</hlm:sbsinput>
--- a/sf-package/package_props.ant.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/sf-package/package_props.ant.xml Tue Jul 20 23:33:58 2010 +0100
@@ -13,7 +13,7 @@
<property name="sf.spec.toolsbaseline.enable" value="false"/>
- <property name="sf.spec.package.src.enable" value="true"/>
+ <property name="sf.spec.package.src.enable" value="false"/>
<property name="sf.spec.build.clean.enable" value="true"/>
--- a/sf-platform/build.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/sf-platform/build.xml Tue Jul 20 23:33:58 2010 +0100
@@ -150,41 +150,21 @@
== Desc: Override of common sf-compile target defined in
== common\build.xml
==
- == os build will be skipped if sf.spec.os.skipbuild=true
- == s60 build will be skipped if sf.spec.s60.skipbuild=true
- ==
-->
<target name="sf-compile">
<stopwatch name="sf-compile"/>
- <!-- TODO clean up to single target once genxml v2.0.0 merge is fixed -->
- <if><istrue value="${sf.spec.splitbuild}"/>
- <then>
- <if><istrue value="${sf.spec.os.skipbuild}" />
- <then><echo message="Skipping OS build"/></then>
- <else><runtarget target="sf-os-compile"/></else>
- </if>
-
- <if><istrue value="${sf.spec.s60.skipbuild}" />
- <then><echo message="Skipping S60 build"/></then>
- <else><runtarget target="sf-s60-compile"/></else>
- </if>
- </then>
- <else>
- <!-- TODO targets for single sysdef build -->
- <runtarget target="sf-os-compile"/>
- </else>
- </if>
+ <runtarget target="sf-os-compile"/>
<!-- always run cenrep -->
<if><equals arg1="${sf.spec.job.name}" arg2="symbian2"/>
- <then>
+ <then>
<runtarget target="sf-s60-create-cenrep"/>
- </then>
- <else>
+ </then>
+ <else>
<!-- symbian3+ should use ConE -->
<runtarget target="sf-s60-cone-cenrep"/>
- </else>
+ </else>
</if>
<stopwatch name="sf-compile" action="elapsed"/>
</target>
--- a/sf-platform/compile-hlm-5.ant.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/sf-platform/compile-hlm-5.ant.xml Tue Jul 20 23:33:58 2010 +0100
@@ -36,7 +36,6 @@
<param name="build.system" value="${sf.spec.build.system}" />
<param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<reference refid="sbs.main.clean.sbs.var" torefid="sbs.var" />
<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
<reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
@@ -85,7 +84,6 @@
<param name="build.system" value="${sf.spec.build.system}" />
<param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<reference refid="sbs.tools2.var" torefid="sbs.var" />
<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
<reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
@@ -108,7 +106,6 @@
<param name="build.system" value="${sf.spec.build.system}" />
<param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<reference refid="sbs.tools.var" torefid="sbs.var" />
<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
<reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
@@ -140,7 +137,6 @@
<param name="build.system" value="${sf.spec.build.system}" />
<param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<reference refid="sbs.main.iterate.sbs.var" torefid="sbs.var" />
<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
<reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
@@ -159,7 +155,6 @@
<param name="build.system" value="${sf.spec.build.system}" />
<param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
<param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
<reference refid="sbs.main.sbs.var" torefid="sbs.var" />
<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
<reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
@@ -189,136 +184,7 @@
</antcall>
</else>
</if>
-
</target>
- <!--
- == Name: SF-S60-COMPILE
- ==
- == Desc: Compile S60 part of build using the spec defined in:
- ==
- == - job_props.ant.xml
- == - job_refs.ant.xml
- ==
- -->
- <target name="sf-s60-compile" depends="sf-compile-options">
-
- <hlm:argSet id="sbs.tools.var">
- <hlm:arg name="config" value="${sf.spec.sbs.tools.config}" />
- <hlm:arg name="singlejob" value="true" />
- <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
- <hlm:arg name="retry-limit" value="${sf.spec.sbs.retry.limit}" />
- </hlm:argSet>
-
- <hlm:argSet id="sbs.tools.clean.var">
- <hlm:arg name="config" value="${sf.spec.sbs.tools.config}" />
- <hlm:arg name="singlejob" value="true" />
- <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
- </hlm:argSet>
-
- <hlm:argSet id="sbs.main.sbs.var">
- <hlm:arg name="config" value="${sf.spec.sbs.config}" />
- <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
- <hlm:arg name="retry-limit" value="${sf.spec.sbs.retry.limit}" />
- </hlm:argSet>
-
- <hlm:argSet id="sbs.main.clean.sbs.var">
- <hlm:arg name="config" value="${sf.spec.sbs.config}" />
- <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
- <hlm:arg name="command" value="CLEAN --check" />
- </hlm:argSet>
-
- <hlm:argSet id="sbs.main.what.sbs.var">
- <hlm:arg name="config" value="${sf.spec.sbs.config}" />
- <hlm:arg name="enable-filter" value="${sf.spec.logs.raptorfilter.enable}" />
- <hlm:arg name="command" value="WHAT" />
- </hlm:argSet>
-
- <hlm:sbsMakeOptions engine="gmake" id="sbs.toolsbuild.options" />
- <hlm:sbsMakeOptions engine="gmake" id="sbs.fullbuild.options" />
-
- <antcall target="sf-list-dir" inheritAll="false">
- <param name="sf.list.name" value="s60-baseline"/>
- </antcall>
-
- <!-- s60 what -->
- <!--
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value="${sf.spec.s60.sysdef.version}"/>
- <reference refid="sbs.main.what.sbs.var" torefid="sbs.var" />
- <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
- -->
- <!-- s60 clean main build -->
- <if><istrue value="${sf.spec.baseline.clean}"/>
- <then>
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value="${sf.spec.s60.sysdef.version}"/>
- <reference refid="sbs.main.clean.sbs.var" torefid="sbs.var" />
- <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
- </then>
- </if>
-
- <antcall target="sf-list-dir" inheritAll="false">
- <param name="sf.list.name" value="post-s60-clean"/>
- </antcall>
-
- <!-- what has been cleaned from baseline PDK by s60 model -->
- <antcall target="sf-delta-dir" inheritAll="false">
- <param name="sf.list_a.name" value="s60-baseline"/>
- <param name="sf.list_b.name" value="post-s60-clean"/>
- </antcall>
-
-
- <!-- s60 tools build -->
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
- <reference refid="sbs.tools.var" torefid="sbs.var" />
- <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
-
- <antcall target="sf-list-dir" inheritAll="false">
- <param name="sf.list.name" value="post-s60-build-tools"/>
- </antcall>
-
- <!-- s60 main build -->
- <antcall target="compile-main" inheritAll="false" inheritRefs="true">
- <param name="build.system" value="${sf.spec.build.system}" />
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <param name="sf.spec.sysdef.version" value="${sf.spec.s60.sysdef.version}"/>
- <reference refid="sbs.main.sbs.var" torefid="sbs.var" />
- <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
-
-
- <antcall target="sf-list-dir" inheritAll="false">
- <param name="sf.list.name" value="post-s60-build-main"/>
- </antcall>
-
- <!-- what has been built by tools+2+main -->
- <antcall target="sf-delta-dir" inheritAll="false">
- <param name="sf.list_a.name" value="s60-baseline"/>
- <param name="sf.list_b.name" value="post-s60-build-main"/>
- </antcall>
-
- <!-- what has been cleaned and rebuilt -->
- <antcall target="sf-intersect-dir" inheritAll="false">
- <param name="sf.list_a.name" value="post-s60-clean_delta"/> <!-- clean list -->
- <param name="sf.list_b.name" value="post-s60-build-main_delta"/> <!-- built list -->
- </antcall>
-
- </target>
-
</project>
--- a/sf-platform/compile.ant.xml Thu Jul 08 18:13:52 2010 +0100
+++ b/sf-platform/compile.ant.xml Tue Jul 20 23:33:58 2010 +0100
@@ -12,14 +12,6 @@
</antcall>
</target>
- <!-- compile specified sysdef file. called from sf-compile target in sf-platform/build.xml -->
- <target name="sf-s60-compile">
- <antcall target="sf-do-compile" inheritAll="false" inheritRefs="true">
- <param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
- <reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
- </antcall>
- </target>
-
<!-- compile sbs.tools.config and sbs.config. tools built only if its not being unpacked first.
note: must be called from sf-os/s60-compile targets, as sys model input needed -->
<target name="sf-do-compile" depends="create-canonical-sysdef-file">