1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>8.Configuring MySQL++</title><link rel="stylesheet" href="tangentsoft.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"><link rel="start" href="index.html" title="MySQL++ v3.0.9 User Manual"><link rel="up" href="index.html" title="MySQL++ v3.0.9 User Manual"><link rel="prev" href="threads.html" title="7.Using MySQL++ in a Multithreaded Program"><link rel="next" href="incorporating.html" title="9.Using MySQL++ in Your Own Project"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">8.Configuring MySQL++</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="threads.html">Prev</a></td><th width="60%" align="center"></th><td width="20%" align="right"><a accesskey="n" href="incorporating.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configuration"></a>8.Configuring MySQL++</h2></div></div></div><p>The default configuration of MySQL++ is suitable for most
purposes, but there are a few things you can change to make it meet
special needs.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="mysql-loc"></a>8.1.The Location of the MySQL Development Files</h3></div></div></div><p>MySQL++ is built on top of the MySQL C API. It relies on
this low-level library for all communication with the database
server. Consequently, the build process for MySQL++ may fail if
it can’t find the C API headers and library.</p><p>On platforms that use Autoconf<sup>[<a name="id2686920" href="#ftn.id2686920">15</a>]</sup>, the <code class="filename">configure</code>
script can usually figure out the location of the C API
development files by itself. It simply tries a bunch of common
installation locations until it finds one that works. If
your MySQL server was installed in a nonstandard location,
you will have to tell the <code class="filename">configure</code>
script where these files are with some combination
of the <code class="computeroutput">--with-mysql</code>,
<code class="computeroutput">--with-mysql-include</code>, and
<code class="computeroutput">--with-mysql-lib</code> flags. See
<code class="filename">README-Unix.txt</code> for details.</p><p>No other platform allows this sort of auto-discovery,
so the build files for these platforms simply hard-code the
default installation location for the current Generally
Available version of MySQL. For example, the Visual C++
project files currently assume MySQL is in <code class="filename">c:\Program
Files\MySQL\MySQL Server 5.0</code>. If you’re using
some other release of MySQL or you installed it in a nonstandard
location, you will have to modify the build files. How you do
this, exactly, varies based on platform and what tools you have
on hand. See <code class="filename">README-Visual-C++.txt</code>,
<code class="filename">README-MinGW.txt</code>, or
<code class="filename">README-Mac-OS-X.txt</code>, as appropriate.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="max-columns"></a>8.2.The Maximum Number of Columns Allowed</h3></div></div></div><p>MySQL++ offers two ways to automatically build SQL queries at
run time: <a href="tquery.html">Template Queries</a> and <a href="ssqls.html" title="5.Specialized SQL Structures">SSQLS</a>. There’s a limit on the number
of template query parameters and the number of SSQLS fields, due to
the way these mechanisms work. Both are set to 25, by default. We
arrived at these limits empirically, partly by looking at good
database designs, and by testing compilers to find their limits. We
wanted a limit that doesn’t often need to be raised without
unduly narrowing the list of supported platforms by exceeding
compiler limits.</p><p>If it happens that your database design does need more than
25 columns or template query parameters, first look to see if
there’s a good way to change the design. It’s usually
a sign of too many unrelated things in one table if you need so
many columns. If you decide the design is good, you can raise these
limits by re-generating the <code class="filename">lib/ssqls.h</code> and/or
<code class="filename">lib/querydef.h</code> headers using Perl scripts with
the same name, except with a <code class="filename">pl</code> extension.
Instructions for this are at the top of each script.</p><p>If you’re on a platform that uses
Autoconf<sup>[<a name="id2673358" href="#ftn.id2673358">16</a>]</sup>, you can change
these scripts like you would any other part of the library. After
making your changes, just say <span><strong class="command">make</strong></span> to rebuild
the library, including these headers. This requires a Perl
interpreter on the system to work, but Perl is nearly ubiquitous
on systems that also use autoconf these days.</p><p>On all other platforms, you’ll have to rebuild
these headers by running Perl by hand. Just say <span><strong class="command">perl
ssqls.pl</strong></span> or <span><strong class="command">perl querydef.pl</strong></span> in the
<code class="filename">lib</code> subdirectory of the MySQL++ sources,
then build the library as you normally would.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="buried-headers"></a>8.3.Buried MySQL C API Headers</h3></div></div></div><p>It’s common these days on Unixy systems to install
the MySQL C API headers in a <code class="filename">mysql</code> directory
under some common <code class="filename">include</code> directory. If the
C API headers are in <code class="filename">/usr/include/mysql</code>, we
say they are “buried” underneath the system’s
main include directory, <code class="filename">/usr/include</code>. Since
the MySQL++ headers depend on these C API headers, it can be
useful for MySQL++ to know this fact.</p><p>When MySQL++ includes one of the C API headers, it normally
does so in the obvious way:</p><pre class="programlisting">
#include <mysql.h>
</pre><p>But, if you define the
<code class="varname">MYSQLPP_MYSQL_HEADERS_BURIED</code> macro, it switches
to this style:</p><pre class="programlisting">
#include <mysql/mysql.h>
</pre><p>In common situations like the
<code class="filename">/usr/include/mysql</code> one, this simplifies the
include path options you pass to your compiler.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="c99"></a>8.4.Building MySQL++ on Systems Without Complete C99
Support</h3></div></div></div><p>MySQL++ uses the <a href="http://en.wikipedia.org/wiki/C_(programming_language)#C99" target="_top">C99</a>
header <code class="filename">stdint.h</code> for portable fixed-size
integer typedefs where possible. The C99 extensions aren’t
yet officially part of the C++ Standard, so there are still
some C++ compilers that don’t offer this header. MySQL++
works around the lack of this header where it knows it needs
to, but your platform might not be recognized, causing
the build to break. If this happens, you can define the
<code class="varname">MYSQLPP_NO_STDINT_H</code> macro to make MySQL++
use its best guess for suitable integer types instead of relying
on <code class="filename">stdint.h</code>.</p><p>MySQL++ also uses C99’s <span class="type">long long</span>
data type where available. MySQL++ has workarounds for platforms
where this is known not to be available, but if you get errors in
<code class="filename">common.h</code> about this type, you can define the
macro <code class="varname">MYSQLPP_NO_LONG_LONGS</code> to make MySQL++
fall back to portable constructs.</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2686920" href="#id2686920">15</a>] </sup>Linux,
Solaris, the BSDs, Mac OS X command line (as opposed to the
Xcode IDE), Cygwin... Basically, Unix or anything that works
like it.</p></div><div class="footnote"><p><sup>[<a name="ftn.id2673358" href="#id2673358">16</a>] </sup>ditto</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="threads.html">Prev</a></td><td width="20%" align="center"></td><td width="40%" align="right"><a accesskey="n" href="incorporating.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7.Using MySQL++ in a Multithreaded Program</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">9.Using MySQL++ in Your Own Project</td></tr></table></div></body></html>
|